From 747b2af06bdc42169d58a78c439bc0b8033d19f5 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 19 Dec 2014 11:57:47 +0100 Subject: [PATCH 01/11] FIX: check for expedition batch lines check if expedition batch lines are available before foreach --- htdocs/expedition/class/expedition.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2cc0667d58a..fd06131d8b4 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -604,9 +604,11 @@ class Expedition extends CommonObject if (! empty($conf->productbatch->enabled)) { $details=ExpeditionLigneBatch::FetchAll($this->db,$obj->rowid); - foreach ($details as $dbatch) { - $result=$mouvS->livraison_batch($dbatch->fk_origin_stock,$dbatch->dluo_qty); - if ($result < 0) { $error++; $this->errors[]=$mouvS->$error; break 2; } + if (! empty($details)) { + foreach ($details as $dbatch) { + $result=$mouvS->livraison_batch($dbatch->fk_origin_stock,$dbatch->dluo_qty); + if ($result < 0) { $error++; $this->errors[]=$mouvS->$error; break 2; } + } } } } From 8996953077b48206bda83a2ccb2e7304be79daf0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Dec 2014 15:42:03 +0100 Subject: [PATCH 02/11] Fix: error reported by scrutinizer --- dev/skeletons/skeleton_webservice_server.php | 2 +- htdocs/adherents/class/adherent.class.php | 2 +- htdocs/compta/bank/class/bankcateg.class.php | 6 ++--- htdocs/compta/facture/class/facture.class.php | 12 +++++----- .../class/bonprelevement.class.php | 4 ++-- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/core/db/pgsql.class.php | 4 ++-- htdocs/core/db/sqlite.class.php | 4 ++-- htdocs/core/lib/pdf.lib.php | 2 +- .../modules/syslog/logHandlerInterface.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/fichinter/class/fichinter.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 2 +- htdocs/holiday/tomergewithdefine_holiday.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- htdocs/user/class/user.class.php | 2 +- htdocs/webservices/server_contact.php | 2 +- .../webservices/server_productorservice.php | 24 +++++++++---------- htdocs/webservices/server_user.php | 2 +- 20 files changed, 40 insertions(+), 42 deletions(-) diff --git a/dev/skeletons/skeleton_webservice_server.php b/dev/skeletons/skeleton_webservice_server.php index 52bb46455cb..54a050ff9da 100644 --- a/dev/skeletons/skeleton_webservice_server.php +++ b/dev/skeletons/skeleton_webservice_server.php @@ -141,7 +141,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @return mixed */ function getSkeleton($authentication,$id,$ref='',$ref_ext='') diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 6c61c51f1f1..8c8c2d604ca 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1045,7 +1045,7 @@ class Adherent extends CommonObject * @param int $rowid Id of object to load * @param string $ref To load member from its ref * @param int $fk_soc To load member from its link to third party - * @param int $ref_ext External reference + * @param string $ref_ext External reference * @return int >0 if OK, 0 if not found, <0 if KO */ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='') diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 8811ad7c878..fb796b219ee 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -30,9 +30,7 @@ /** - * \class BankCateg - * \brief Class to manage bank categories - * \remarks Initialy built by build_class_from_table on 2009-01-02 15:26 + * Class to manage bank categories */ class BankCateg // extends CommonObject { @@ -300,7 +298,7 @@ class BankCateg // extends CommonObject $error=0; - $object=new Bank_categ($this->db); + $object=new BankCateg($this->db); $this->db->begin(); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index cd8ba3b06a1..632381c8541 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2479,7 +2479,7 @@ class Facture extends CommonInvoice * Return next reference of customer invoice not already used (or last reference) * according to numbering module defined into constant FACTURE_ADDON * - * @param Society $soc object company + * @param Societe $soc object company * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ @@ -2838,7 +2838,7 @@ class Facture extends CommonInvoice function demande_prelevement($user) { $error=0; - + dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG); if ($this->statut > 0 && $this->paye == 0) @@ -2896,12 +2896,12 @@ class Facture extends CommonInvoice { // Force payment mode of invoice to withdraw $payment_mode_id = dol_getIdFromCode($this->db, 'PRE', 'c_paiement'); - if ($payment_mode_id > 0) + if ($payment_mode_id > 0) { $result=$this->setPaymentMethods($payment_mode_id); } - } - + } + if ($error) return -1; return 1; } @@ -3519,7 +3519,7 @@ class FactureLigne extends CommonInvoiceLine return -1; } } - + // POS or by external module, take lowest buying price if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 5da94a28b76..497d690072b 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -58,7 +58,7 @@ class BonPrelevement extends CommonObject var $invoice_in_error=array(); - + /** * Constructor * @@ -1634,7 +1634,7 @@ class BonPrelevement extends CommonObject * @param int $nombre 0 or 1 * @param float $total Total * @param string $CrLf End of line character - * @return SEPA + * @return string String with SEAP Sender */ function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') { // SEPA INITIALISATION diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index a86af28cace..a300579fc1f 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -343,7 +343,7 @@ class Tva extends CommonObject } /** - * Total of the VAT from invoices emitted by the society. + * Total of the VAT from invoices emitted by the thirdparty. * * @param int $year Year * @return double Amount diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1399ae40215..ae384195162 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -88,7 +88,7 @@ class Contrat extends CommonObject /** * Return next contract ref * - * @param Societe $soc objet society + * @param Societe $soc Thirdparty object * @return string free reference for contract */ function getNextNumRef($soc) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index a7baf59783d..1c0d1ee21fc 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -669,7 +669,7 @@ class DoliDBPgsql extends DoliDB /** * Renvoie le code erreur generique de l'operation precedente. * - * @return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) + * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) */ function errno() { @@ -735,7 +735,7 @@ class DoliDBPgsql extends DoliDB /** * Renvoie le texte de l'erreur pgsql de l'operation precedente * - * @return error_text + * @return string Error text */ function error() { diff --git a/htdocs/core/db/sqlite.class.php b/htdocs/core/db/sqlite.class.php index 53ecb880dce..88efde86394 100644 --- a/htdocs/core/db/sqlite.class.php +++ b/htdocs/core/db/sqlite.class.php @@ -536,7 +536,7 @@ class DoliDBSqlite extends DoliDB /** * Renvoie le code erreur generique de l'operation precedente. * - * @return string $error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) + * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...) */ function errno() { @@ -598,7 +598,7 @@ class DoliDBSqlite extends DoliDB /** * Renvoie le texte de l'erreur mysql de l'operation precedente. * - * @return string $error_text + * @return string Error text */ function error() { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index bf2e5f2c218..129d32fc7d9 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1273,7 +1273,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0) * * @param Object $object Object * @param int $i Current line number - * @param Tranlate $outputlangs Object langs for output + * @param Translate $outputlangs Object langs for output * @param int $hidedetails Hide value (0 = no, 1 = yes, 2 = just special lines) * @return void */ diff --git a/htdocs/core/modules/syslog/logHandlerInterface.php b/htdocs/core/modules/syslog/logHandlerInterface.php index 7b5a4aa1bdd..47807d8f8f6 100644 --- a/htdocs/core/modules/syslog/logHandlerInterface.php +++ b/htdocs/core/modules/syslog/logHandlerInterface.php @@ -44,7 +44,7 @@ interface LogHandlerInterface /** * Return if logger active * - * @return boolen True if active + * @return boolean True if active */ public function isActive(); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 2cc0667d58a..7d96d1de12c 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -113,7 +113,7 @@ class Expedition extends CommonObject /** * Return next contract ref * - * @param Societe $soc Objet society + * @param Societe $soc Thirdparty object * @return string Free reference for contract */ function getNextNumRef($soc) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index bc12821530f..28ef737de13 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -572,7 +572,7 @@ class Fichinter extends CommonObject * Returns the next non used reference of intervention * depending on the module numbering assets within FICHEINTER_ADDON * - * @param Societe $soc Object society + * @param Societe $soc Thirdparty object * @return string Free reference for intervention */ function getNextNumRef($soc) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 69c235fd831..95da7550db7 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1493,7 +1493,7 @@ class FactureFournisseur extends CommonInvoice * Return next reference of supplier invoice not already used (or last reference) * according to numbering module defined into constant INVOICE_SUPPLIER_ADDON_NUMBER * - * @param Society $soc object company + * @param Societe $soc Thirdparty object * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ diff --git a/htdocs/holiday/tomergewithdefine_holiday.php b/htdocs/holiday/tomergewithdefine_holiday.php index 4bf904528a0..46dde3028a4 100644 --- a/htdocs/holiday/tomergewithdefine_holiday.php +++ b/htdocs/holiday/tomergewithdefine_holiday.php @@ -46,7 +46,7 @@ llxHeader(array(),$langs->trans('CPTitreMenu')); print_fiche_titre($langs->trans('MenuConfCP')); -$congespayes = new Holidays($db); +$congespayes = new Holiday($db); $listUsers = $congespayes->fetchUsers(false, true); // Si il y a une action de mise à jour diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index fbdf42d86f5..2732080e944 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2382,7 +2382,7 @@ class Societe extends CommonObject * * @param int $idprof 1,2,3,4 (Example: 1=siren,2=siret,3=naf,4=rcs/rm) * @param string $value Value of profid - * @param int $socid Id of society if update + * @param int $socid Id of thirdparty if update * @return boolean true if exists, false if not */ function id_prof_exists($idprof,$value,$socid=0) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 0b0c452020c..837be155929 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -138,7 +138,7 @@ class User extends CommonObject * * @param int $id Si defini, id a utiliser pour recherche * @param string $login Si defini, login a utiliser pour recherche - * @param strinf $sid Si defini, sid a utiliser pour recherche + * @param string $sid Si defini, sid a utiliser pour recherche * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) * @return int <0 if KO, 0 not found, >0 if OK */ diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 4d19dbe2d10..b7550244fc2 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -234,7 +234,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @return mixed */ function getContact($authentication,$id,$ref='',$ref_ext='') diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index ffe25f8e3e8..6f36b664a3b 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -327,7 +327,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @param string $lang Lang to force * @return mixed */ @@ -378,7 +378,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"]; if (! empty($product->multilangs[$langs->defaultlang]["description"])) $product->description = $product->multilangs[$langs->defaultlang]["description"]; if (! empty($product->multilangs[$langs->defaultlang]["note"])) $product->note = $product->multilangs[$langs->defaultlang]["note"]; - + $productorservice_result_fields = array( 'id' => $product->id, 'ref' => $product->ref, @@ -396,7 +396,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' 'country_id' => $product->country_id>0?$product->country_id:'', 'country_code' => $product->country_code, 'custom_code' => $product->customcode, - + 'price_net' => $product->price, 'price' => $product->price_ttc, 'price_min_net' => $product->price_min, @@ -408,7 +408,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' //! Spanish local taxes 'localtax1_tx' => $product->localtax1_tx, 'localtax2_tx' => $product->localtax2_tx, - + 'stock_real' => $product->stock_reel, 'stock_alert' => $product->seuil_stock_alerte, 'pmp' => $product->pmp, @@ -416,19 +416,19 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' 'dir' => $pdir, 'images' => $product->liste_photos($dir,$nbmax=10) ); - + //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); //Get extrafield values $product->fetch_optionals($product->id,$extralabels); - + foreach($extrafields->attribute_label as $key=>$label) { $productorservice_result_fields=array_merge($productorservice_result_fields,array('options_'.$key => $product->array_options['options_'.$key])); } - + // Create $objectresp = array( 'result'=>array('result_code'=>'OK', 'result_label'=>''), @@ -533,7 +533,7 @@ function createProductOrService($authentication,$product) }*/ //var_dump($product['ref_ext']); //var_dump($product['lines'][0]['type']); - + $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); foreach($extrafields->attribute_label as $key=>$label) @@ -652,7 +652,7 @@ function updateProductOrService($authentication,$product) }*/ //var_dump($product['ref_ext']); //var_dump($product['lines'][0]['type']); - + $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); foreach($extrafields->attribute_label as $key=>$label) @@ -965,19 +965,19 @@ function getProductsForCategory($authentication,$id,$lang='') 'dir' => $pdir, 'images' => $obj->liste_photos($dir,$nbmax=10) ); - + //Retreive all extrafield for thirdsparty // fetch optionals attributes and labels $extrafields=new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label('product',true); //Get extrafield values $product->fetch_optionals($obj->id,$extralabels); - + foreach($extrafields->attribute_label as $key=>$label) { $products[$iProduct]=array_merge($products[$iProduct],array('options_'.$key => $product->array_options['options_'.$key])); } - + $iProduct++; } diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 4fb5cc81e8c..6339486922f 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -299,7 +299,7 @@ $server->register( * @param array $authentication Array of authentication information * @param int $id Id of object * @param string $ref Ref of object - * @param ref_ext $ref_ext Ref external of object + * @param string $ref_ext Ref external of object * @return mixed */ function getUser($authentication,$id,$ref='',$ref_ext='') From c05c2fe427d2b203bd30c96310058323e3303823 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 20 Dec 2014 18:46:29 +0100 Subject: [PATCH 03/11] Info to help debug perf pb. --- htdocs/admin/system/perf.php | 8 ++++++++ htdocs/admin/system/phpinfo.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 27c447e7c15..0e49564ece7 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -24,6 +24,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("admin"); $langs->load("install"); @@ -51,6 +52,13 @@ print_fiche_titre($langs->trans("PerfDolibarr"),'','setup'); print $langs->trans("YouMayFindPerfAdviceHere",'http://wiki.dolibarr.org/index.php/FAQ_Increase_Performance').' ('.$langs->trans("Reload").')
'; +// Recupere la version de PHP +$phpversion=version_php(); +print "
PHP - ".$langs->trans("Version").": ".$phpversion."
\n"; + +// Recupere la version du serveur web +print "
Web server - ".$langs->trans("Version").": ".$_SERVER["SERVER_SOFTWARE"]."
\n"; + // XDebug print '
'; print ''.$langs->trans("XDebug").': '; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 22fecdfd524..681c5d43cf3 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -54,7 +54,7 @@ print "\n"; $var=false; -// Recupere la version de l'OS +// Recupere la version de PHP $phpversion=version_php(); print "'.$langs->trans("Version")."".$phpversion."\n"; From 268723be7bb02499c8c12ae9d50207a4a3275114 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2014 01:39:20 +0100 Subject: [PATCH 04/11] Fixed: sql syntax error --- htdocs/core/class/html.form.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 936a3b9cb53..445aa827416 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1256,7 +1256,7 @@ class Form if (is_array($exclude) && $excludeUsers) $sql.= " AND u.rowid NOT IN ('".$excludeUsers."')"; if (is_array($include) && $includeUsers) $sql.= " AND u.rowid IN ('".$includeUsers."')"; if (! empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND u.statut <> 0"; - if (! empty($morefilter)) $sql.=$morefilter; + if (! empty($morefilter)) $sql.=" ".$morefilter; $sql.= " ORDER BY u.lastname ASC"; dol_syslog(get_class($this)."::select_dolusers", LOG_DEBUG); @@ -1342,7 +1342,7 @@ class Form $out.= ''; } $out.= ''; - + if (! empty($conf->use_javascript_ajax) && ! $show_empty) // ajaxcombo works only on list with no empty value because of   { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; From 22c27e870364f57f5a859f3805dfc93298251f7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2014 02:21:12 +0100 Subject: [PATCH 05/11] PHPCS --- htdocs/core/class/dolprintipp.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 71ee2a1be37..b6e09547743 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -45,7 +45,6 @@ class dolprintIPP * @param string $userid userid * @param string $user user * @param string $password password - * @return printIPP */ function __construct($db,$host,$port,$userid,$user,$password) { @@ -90,7 +89,7 @@ class dolprintIPP global $conf,$db; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; - + $ipp = new CupsPrintIPP(); $ipp->setLog(DOL_DATA_ROOT.'/dolibarr_printipp.log','file',3); // logging very verbose $ipp->setHost($this->host); @@ -121,12 +120,12 @@ class dolprintIPP } } } - + // Set number of copy $ipp->setCopies($obj->copy); $ipp->setData(DOL_DATA_ROOT.'/'.$module.'/'.$file); $ipp->printJob(); - + return ''; } From bdb47921e7bbfc5e6de690e7266b413050e4fb6e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2014 14:15:36 +0100 Subject: [PATCH 06/11] Fixed: Bad value for % increase for first year. --- htdocs/compta/stats/index.php | 109 +++++++++++++++++----------------- 1 file changed, 56 insertions(+), 53 deletions(-) diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index b3fb130e185..cfd816c29b6 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -209,6 +209,8 @@ $maxyear=substr($maxyearmonth,0,4); $nowyear=strftime("%Y",dol_now()); $nowyearmonth=strftime("%Y-%m",dol_now()); $maxyearmonth=max($maxyearmonth,$nowyearmonth); +$now=dol_now(); +$casenow = dol_print_date($now,"%Y-%m"); // Loop on each month $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; @@ -220,22 +222,37 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) print ""; print "".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B").""; - for ($annee = $year_start ; $annee <= $year_end ; $annee++) + for ($annee = $year_start -1 ; $annee <= $year_end ; $annee++) // We start one year before to have data to be able to make delta { - $now=dol_now(); $annee_decalage=$annee; if ($mois>12) {$annee_decalage=$annee+1;} - $casenow = dol_print_date($now,"%Y-%m"); $case = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois_modulo,1,$annee_decalage-1),"%Y-%m"); - if ($modecompta == 'CREANCES-DETTES') { - // Valeur CA du mois w/o VAT + if ($annee >= $year_start) + { + if ($modecompta == 'CREANCES-DETTES') { + // Valeur CA du mois w/o VAT + print ''; + if ($cum_ht[$case]) + { + $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. + print ''.price($cum_ht[$case],1).''; + } + else + { + if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } + else { print ' '; } + } + print ""; + } + + // Valeur CA du mois print ''; - if ($cum_ht[$case]) + if ($cum[$case]) { $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. - print ''.price($cum_ht[$case],1).''; + print ''.price($cum[$case],1).''; } else { @@ -243,60 +260,46 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) else { print ' '; } } print ""; - } - // Valeur CA du mois - print ''; - if ($cum[$case]) - { - $now_show_delta=1; // On a trouve le premier mois de la premiere annee generant du chiffre. - print ''.price($cum[$case],1).''; - } - else - { - if ($minyearmonth < $case && $case <= max($maxyearmonth,$nowyearmonth)) { print '0'; } - else { print ' '; } - } - print ""; - - // Pourcentage du mois - if ($annee_decalage > $minyear && $case <= $casenow) - { - if ($cum[$caseprev] && $cum[$case]) + // Pourcentage du mois + if ($annee_decalage > $minyear && $case <= $casenow) { - $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); - //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; - print ''.($percent>=0?"+$percent":"$percent").'%'; + if ($cum[$caseprev] && $cum[$case]) + { + $percent=(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100); + //print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X"; + print ''.($percent>=0?"+$percent":"$percent").'%'; + } + if ($cum[$caseprev] && ! $cum[$case]) + { + print '-100%'; + } + if (! $cum[$caseprev] && $cum[$case]) + { + //print '+Inf%'; + print '-'; + } + if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) + { + print '+0%'; + } + if (! isset($cum[$caseprev]) && ! $cum[$case]) + { + print '-'; + } } - if ($cum[$caseprev] && ! $cum[$case]) + else { - print '-100%'; + print ''; + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } + else { print ' '; } + print ''; } - if (! $cum[$caseprev] && $cum[$case]) - { - //print '+Inf%'; - print '-'; - } - if (isset($cum[$caseprev]) && ! $cum[$caseprev] && ! $cum[$case]) - { - print '+0%'; - } - if (! isset($cum[$caseprev]) && ! $cum[$case]) - { - print '-'; - } - } - else - { - print ''; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } - else { print ' '; } - print ''; + if ($annee_decalage != $year_end) print ' '; } $total_ht[$annee]+=!empty($cum_ht[$case]) ? $cum_ht[$case] : 0;; $total[$annee]+=$cum[$case]; - if ($annee_decalage != $year_end) print ' '; } print ''; @@ -406,7 +409,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) } if (! $total[$annee-1] && $total[$annee]) { - print '+Inf%'; + print '+zzzz'.$total[$annee-1].$langs->trans('Inf').'%'; } if (! $total[$annee-1] && ! $total[$annee]) { From 31f782ffe9119db94683f06bac91bf727f550487 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 21 Dec 2014 14:58:18 +0100 Subject: [PATCH 07/11] Fix: Several fixes into tasks and time spent management --- htdocs/core/class/html.form.class.php | 82 ++++++++++++++++++--------- htdocs/core/lib/project.lib.php | 20 ++++--- htdocs/projet/activity/list.php | 2 +- htdocs/projet/tasks/contact.php | 2 - htdocs/projet/tasks/document.php | 2 - htdocs/projet/tasks/note.php | 2 - htdocs/projet/tasks/task.php | 8 +-- htdocs/projet/tasks/time.php | 11 ++-- 8 files changed, 75 insertions(+), 54 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 445aa827416..61d1c08f2aa 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3800,7 +3800,7 @@ class Form * @param string $prefix Prefix for fields name * @param int $h 1=Show also hours * @param int $m 1=Show also minutes - * @param int $empty 0=Fields required, 1=Empty input is allowed + * @param int $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only * @param string $form_name Not used * @param int $d 1=Show days, month, years * @param int $addnowbutton Add a button "Now" @@ -3819,9 +3819,13 @@ class Form if($prefix=='') $prefix='re'; if($h == '') $h=0; if($m == '') $m=0; - if($empty == '') $empty=0; + $emptydate=0; + $emptyhours=0; + if ($empty == 1) { $emptydate=1; $emptyhours=1; } + if ($empty == 2) { $emptydate=0; $emptyhours=1; } + $orig_set_time=$set_time; - if ($set_time === '' && $empty == 0) + if ($set_time === '' && $emptydate == 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $set_time = dol_now('tzuser')-(getServerTimeZoneInt('now')*3600); // set_time must be relative to PHP server timezone @@ -3843,8 +3847,11 @@ class Form $syear = dol_print_date($set_time, "%Y"); $smonth = dol_print_date($set_time, "%m"); $sday = dol_print_date($set_time, "%d"); - $shour = dol_print_date($set_time, "%H"); - $smin = dol_print_date($set_time, "%M"); + if ($orig_set_time != '') + { + $shour = dol_print_date($set_time, "%H"); + $smin = dol_print_date($set_time, "%M"); + } } else { @@ -3906,7 +3913,7 @@ class Form // Day $retstring.=''; - if ($empty || $set_time == -1) + if ($emptydate || $set_time == -1) { $retstring.=''; } @@ -3919,7 +3926,7 @@ class Form $retstring.=""; $retstring.=''; - if ($empty || $set_time == -1) + if ($emptydate || $set_time == -1) { $retstring.=''; } @@ -3934,7 +3941,7 @@ class Form $retstring.=""; // Year - if ($empty || $set_time == -1) + if ($emptydate || $set_time == -1) { $retstring.=''; } @@ -3957,7 +3964,7 @@ class Form { // Show hour $retstring.=''; - if ($empty) $retstring.=''; + if ($emptyhours) $retstring.=''; for ($hour = 0; $hour < 24; $hour++) { if (strlen($hour) < 2) $hour = "0" . $hour; @@ -3971,7 +3978,7 @@ class Form { // Show minutes $retstring.=''; - if ($empty) $retstring.=''; + if ($emptyhours) $retstring.=''; for ($min = 0; $min < 60 ; $min++) { if (strlen($min) < 2) $min = "0" . $min; @@ -4030,18 +4037,22 @@ class Form /** * Function to show a form to select a duration on a page * - * @param string $prefix Prefix + * @param string $prefix Prefix for input fields * @param int $iSecond Default preselected duration (number of seconds) * @param int $disabled Disable the combo box * @param string $typehour If 'select' then input hour and input min is a combo, if 'text' input hour is in text and input min is a combo * @param string $minunderhours If 1, show minutes selection under the hours + * @param int $nooutput Do not output html string but return it * @return void */ - function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0) + function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) { global $langs; + $retstring=''; + $hourSelected=0; $minSelected=0; + if ($iSecond) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -4052,36 +4063,51 @@ class Form if ($typehour=='select') { - print ''; for ($hour = 0; $hour < 25; $hour++) // For a duration, we allow 24 hours { - print '"; + $retstring.=">".$hour.""; } - print ""; + $retstring.=""; } elseif ($typehour=='text') { - print ''; + $retstring.=''; } - print ' '.$langs->trans('HourShort'); + else return 'BadValueForParameterTypeHour'; - if ($minunderhours) print '
'; - else print " "; + $retstring.=' '.$langs->trans('HourShort'); - print ''; + for ($min = 0; $min <= 55; $min=$min+5) + { + $retstring.='