From c45b191330951781f18b5fcee91fae7b5a0755f9 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Mon, 1 Jul 2019 10:18:04 +0200 Subject: [PATCH 01/28] FIX: when STOCK_CALCULATE_ON_SHIPMENT_CLOSE is set, deleting a "closed" shipment now increases stock as expected --- htdocs/expedition/class/expedition.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3ab96fed1fa..dd0d4842276 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1111,7 +1111,9 @@ class Expedition extends CommonObject } // Stock control - if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) + if (! $error && $conf->stock->enabled && + (($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) || + ($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == 2))) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); From 64d1ebf59cd6ee27117cca10fc552257d0e17ea4 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Thu, 4 Jul 2019 15:06:39 +0200 Subject: [PATCH 02/28] FIX: on shipment delete confirm dialog, a new checkbox allows the user to choose if they want their stock re-incremented after the deletion. --- htdocs/expedition/card.php | 24 ++++++++++++++++++-- htdocs/expedition/class/expedition.class.php | 4 ++-- htdocs/langs/fr_FR/sendings.lang | 2 ++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index aa85132b243..ed6b0227f91 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -468,7 +468,8 @@ if (empty($reshook)) else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer) { - $result = $object->delete(); + $also_update_stock = GETPOST('alsoUpdateStock', 'alpha') ?: 0; + $result = $object->delete($also_update_stock); if ($result > 0) { header("Location: ".DOL_URL_ROOT.'/expedition/index.php'); @@ -1648,7 +1649,26 @@ else if ($id || $ref) // Confirm deleteion if ($action == 'delete') { - $formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id,$langs->trans('DeleteSending'),$langs->trans("ConfirmDeleteSending",$object->ref),'confirm_delete','',0,1); + $formquestion = array(); + if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + $formquestion = array( + array( + 'label' => $langs->trans('ShipmentIncrementStockOnDelete'), + 'name' => 'alsoUpdateStock', + 'type' => 'checkbox', + 'value' => 0 + ), + ); + } + $formconfirm=$form->formconfirm( + $_SERVER['PHP_SELF'].'?id='.$object->id, + $langs->trans('DeleteSending'), + $langs->trans("ConfirmDeleteSending",$object->ref), + 'confirm_delete', + $formquestion, + 0, + 1 + ); } // Confirmation validation diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 3ab96fed1fa..814d8ccc5a1 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1079,7 +1079,7 @@ class Expedition extends CommonObject * * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO */ - function delete() + function delete($also_update_stock = false) { global $conf, $langs, $user; @@ -1111,7 +1111,7 @@ class Expedition extends CommonObject } // Stock control - if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) + if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT && $also_update_stock) { require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php"); diff --git a/htdocs/langs/fr_FR/sendings.lang b/htdocs/langs/fr_FR/sendings.lang index 1071d5f23f9..4f4bfc514e2 100644 --- a/htdocs/langs/fr_FR/sendings.lang +++ b/htdocs/langs/fr_FR/sendings.lang @@ -60,6 +60,8 @@ NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouver dans WeightVolShort=Poids/vol. ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une expédition. +ShipmentIncrementStockOnDelete=Remettre en stock les éléments de cette expédition + # Sending methods # ModelDocument DocumentModelTyphon=Modèle de bon de réception/livraison complet (logo…) From 4f0316580672122e1154c148935d5e17264ad433 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Thu, 11 Jul 2019 12:28:24 +0200 Subject: [PATCH 03/28] FIX: outdated phpdoc --- htdocs/expedition/class/expedition.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index a8d9acc7b48..ea6e003d326 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1073,12 +1073,14 @@ class Expedition extends CommonObject } } - /** - * Delete shipment. - * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) - * - * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO - */ + /** + * Delete shipment. + * Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element) + * + * @param bool $also_update_stock true if the stock should be increased back (false by default) + * @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO + * @throws Exception + */ function delete($also_update_stock = false) { global $conf, $langs, $user; From 294bc5dcb5e0fedca685b6976e4d7e042fa03067 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 15 Jul 2019 10:19:06 +0200 Subject: [PATCH 04/28] FIX avoid conflict with "$classname" in card.php --- htdocs/commande/card.php | 4 ++-- htdocs/core/tpl/object_discounts.tpl.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 10629ec3452..96ea54c5c84 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1436,11 +1436,11 @@ if ($action == 'create' && $user->rights->commande->creer) if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } - if ($element == 'propal') { + elseif ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } - if ($element == 'contract') { + elseif ($element == 'contract') { $element = $subelement = 'contrat'; } diff --git a/htdocs/core/tpl/object_discounts.tpl.php b/htdocs/core/tpl/object_discounts.tpl.php index 70698bfa7eb..3d02d3c5a73 100644 --- a/htdocs/core/tpl/object_discounts.tpl.php +++ b/htdocs/core/tpl/object_discounts.tpl.php @@ -24,7 +24,7 @@ * $backtopage URL to come back to from discount modification pages */ -$classname = get_class($object); +$objclassname = get_class($object); $isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier')); $isNewObject = empty($object->id) && empty($object->rowid); @@ -53,11 +53,11 @@ if($isNewObject) print ' ('.$addrelativediscount.')'; // Is there is commercial discount or down payment available ? if ($absolute_discount > 0) { - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) { + if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) { $translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount'; $text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.'; - if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { + if ($isInvoice && ! $isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) { $text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse')); } @@ -77,11 +77,11 @@ if ($absolute_discount > 0) { if ($absolute_creditnote > 0) { // If validated, we show link "add credit note to payment" - if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) { + if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) { $translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote'; $text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.'; - if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) { + if ($isInvoice && ! $isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) { $text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse')); } @@ -101,7 +101,7 @@ if($absolute_discount <= 0 && $absolute_creditnote <= 0) { $translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount'; print '
'.$langs->trans($translationKey).'.'; - if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) { + if ($isInvoice && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) { print ' (' . $addabsolutediscount . ')'; } } From ae540cb25e5b6b671258f2c4ae71b2c5bca5d4ee Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Tue, 9 Jul 2019 18:00:54 +0200 Subject: [PATCH 05/28] FIX: add missing hook calls --- htdocs/fourn/product/list.php | 57 ++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 16ed559814d..90ff76231d1 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -75,7 +75,12 @@ if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks( + 'doActions', + $parameters, + $object, + $action +); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -128,6 +133,17 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions); $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,"; $sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; $sql.= " s.rowid as socid, s.nom as name"; + +// Add fields to SELECT from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks( + 'printFieldListSelect', + $parameters, + $object, + $action +); +$sql .= $hookmanager->resPrint; + $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product"; @@ -158,6 +174,14 @@ if ($fourn_id > 0) $sql .= " AND ppf.fk_soc = ".$fourn_id; } +// Add WHERE filters from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks( + 'printFieldListWhere', + $parameters +); +$sql .= $hookmanager->resPrint; + $sql .= $db->order($sortfield,$sortorder); // Count total nb of records without orderby and limit @@ -242,6 +266,17 @@ if ($resql) print ''; print ''; print ''; + + // add filters from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldPreListTitle', + $parameters, + $object, + $action + ); + if (!empty($reshook)) print $hookmanager->resPrint; + print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; @@ -257,6 +292,16 @@ if ($resql) print_liste_field_titre("BuyingPrice",$_SERVER["PHP_SELF"], "ppf.price",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre("QtyMin",$_SERVER["PHP_SELF"], "ppf.quantity",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre("UnitPrice",$_SERVER["PHP_SELF"], "ppf.unitprice",$param,"",'align="right"',$sortfield,$sortorder); + + // add header cells from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListTitle', + $parameters, + $object, + $action + ); + if (!empty($reshook)) print $hookmanager->resPrint; print_liste_field_titre('',$_SERVER["PHP_SELF"]); print "\n"; @@ -292,6 +337,16 @@ if ($resql) print ''.(isset($objp->unitprice) ? price($objp->unitprice) : '').''; + // add additional columns from hooks + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $objp, + $action + ); + if (!empty($reshook)) print $hookmanager->resPrint; + print ''; print "\n"; From 8aa147a4e518f7b1a4ba203c7825bcc8e82b2d79 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Wed, 10 Jul 2019 19:00:20 +0200 Subject: [PATCH 06/28] # missing hooks from dispatch.php and list.php --- htdocs/fourn/commande/dispatch.php | 83 ++++++++++++++++++++++++++++++ htdocs/fourn/product/list.php | 11 ++-- 2 files changed, 91 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4b15f04faa0..af2a2218410 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -491,11 +491,35 @@ if ($id > 0 || ! empty($ref)) { $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,"; $sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse"; + + // Enable hooks to alter the SQL query (SELECT) + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListSelect', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $sql .= $hookmanager->resPrint; + $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; $sql .= " WHERE l.fk_commande = " . $object->id; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql .= " AND l.product_type = 0"; + + // Enable hooks to alter the SQL query (WHERE) + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListWhere', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $sql .= $hookmanager->resPrint; + $sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product $sql .= " ORDER BY p.ref, p.label"; @@ -526,6 +550,18 @@ if ($id > 0 || ! empty($ref)) { print '' . $langs->trans("QtyToDispatchShort") . ''; print ''; print '' . $langs->trans("Warehouse") . ''; + + // Enable hooks to append additional columns + $parameters = array(); + $reshook = $hookmanager->executeHooks( + 'printFieldListTitle', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print "\n"; } @@ -608,6 +644,23 @@ if ($id > 0 || ! empty($ref)) { //print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); print ''; // Dispatch column print ''; // Warehouse column + + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => true, // allows hook to distinguish between the + // rows with information and the rows with + // dispatch form input + 'objp' => $objp + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print ''; print ''; @@ -648,6 +701,23 @@ if ($id > 0 || ! empty($ref)) { //print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"'); print ''; // Dispatch column print ''; // Warehouse column + + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => true, // allows hook to distinguish between the + // rows with information and the rows with + // dispatch form input + 'objp' => $objp + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print ''; print ''; @@ -699,6 +769,19 @@ if ($id > 0 || ! empty($ref)) { } print "\n"; + // Enable hooks to append additional columns + $parameters = array( + 'is_information_row' => false // this is a dispatch form row + ); + $reshook = $hookmanager->executeHooks( + 'printFieldListValue', + $parameters, + $object, + $action + ); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; + print "\n"; } } diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 90ff76231d1..acfeb87fca9 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -142,6 +142,7 @@ $reshook = $hookmanager->executeHooks( $object, $action ); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $sql .= $hookmanager->resPrint; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; @@ -180,6 +181,7 @@ $reshook = $hookmanager->executeHooks( 'printFieldListWhere', $parameters ); +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); $sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield,$sortorder); @@ -275,7 +277,8 @@ if ($resql) $object, $action ); - if (!empty($reshook)) print $hookmanager->resPrint; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; print ''; $searchpicto=$form->showFilterButtons(); @@ -301,7 +304,8 @@ if ($resql) $object, $action ); - if (!empty($reshook)) print $hookmanager->resPrint; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; print_liste_field_titre('',$_SERVER["PHP_SELF"]); print "\n"; @@ -345,7 +349,8 @@ if ($resql) $objp, $action ); - if (!empty($reshook)) print $hookmanager->resPrint; + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + print $hookmanager->resPrint; print ''; From 6c23154a91f683f300bac2b114acce2aa4c2d201 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 22:59:18 +0200 Subject: [PATCH 07/28] FIX #11506 --- htdocs/accountancy/admin/journals_list.php | 20 +++++++++----------- htdocs/langs/en_US/accountancy.lang | 2 +- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index cac81bfbcae..78cd92f90e0 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -162,7 +162,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) { if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; - if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature'; + if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal'; } // Other checks if (isset($_POST["code"])) @@ -437,7 +437,7 @@ if ($id) $valuetoshow=$langs->trans("Label"); } if ($fieldlist[$field]=='nature') { - $valuetoshow=$langs->trans("Nature"); + $valuetoshow=$langs->trans("NatureOfJournal"); } if ($valuetoshow != '') { @@ -516,7 +516,7 @@ if ($id) } // Title line with search boxes - print ''; + /*print ''; print ''; print ''; print ''; @@ -524,16 +524,14 @@ if ($id) print ''; print ''; print ''; - if ($filterfound) - { - $searchpicto=$form->showFilterAndCheckAddButtons(0); - print $searchpicto; - } + $searchpicto=$form->showFilterButtons(); + print $searchpicto; print ''; print ''; - + */ + // Title of lines - print ''; + print ''; foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles @@ -558,7 +556,7 @@ if ($id) $valuetoshow=$langs->trans("Label"); } if ($fieldlist[$field]=='nature') { - $valuetoshow=$langs->trans("Nature"); + $valuetoshow=$langs->trans("NatureOfJournal"); } // Affiche nom du champ diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 6dfe4fc8c4f..4b22f512826 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -265,7 +265,7 @@ AccountingJournals=Accounting journals AccountingJournal=Accounting journal NewAccountingJournal=New accounting journal ShowAccoutingJournal=Show accounting journal -Nature=Nature +NatureOfJournal=Nature of Journal AccountingJournalType1=Miscellaneous operations AccountingJournalType2=Sales AccountingJournalType3=Purchases From ea349de0818dddff6859aaca349d0878d9a57cf3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 23:25:42 +0200 Subject: [PATCH 08/28] FIX #11498 --- dev/dolibarr_changes.txt | 9 +++++++++ htdocs/includes/mike42/escpos-php/Escpos.php | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 5bad55fd4d2..e87b082dd06 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -27,6 +27,15 @@ With +ESCPOS: +------- +Replace + private $connector; +With + protected $connector; + + + NUSOAP: ------- * In file nusoap.php, to avoid a warning, diff --git a/htdocs/includes/mike42/escpos-php/Escpos.php b/htdocs/includes/mike42/escpos-php/Escpos.php index 57e7eb2c8ac..b8568260738 100644 --- a/htdocs/includes/mike42/escpos-php/Escpos.php +++ b/htdocs/includes/mike42/escpos-php/Escpos.php @@ -144,9 +144,11 @@ class Escpos { /** * @var PrintConnector + * @CHANGE */ - private $connector; - + protected $connector; + // private $connector; + /** * @var AbstractCapabilityProfile */ From d694360c66bea525997c471f535948864574ece4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 23:46:54 +0200 Subject: [PATCH 09/28] Fix warning --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 3b7c05c5ad1..f84ad6cbcfa 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -418,6 +418,6 @@ class modAgenda extends DolibarrModules $this->export_sql_end[$r] .=' WHERE ac.entity IN ('.getEntity('agenda').')'; if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .=' AND (sc.fk_user = '.(empty($user)?0:$user->id).' OR ac.fk_soc IS NULL)'; if (empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .=' AND acr.fk_element = '.(empty($user)?0:$user->id); - $this->export_sql_order[$r] .=' ORDER BY ac.datep'; + $this->export_sql_order[$r] =' ORDER BY ac.datep'; } } From fb5af65f4d1bdb6925e95bca0f1ddb02f01355a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2019 23:56:05 +0200 Subject: [PATCH 10/28] FIX #11466 --- htdocs/product/price.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 26970f1dd13..6bc7033ec23 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1711,20 +1711,18 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) } print ''; - // Update all child soc - print ''; - print $langs->trans('ForceUpdateChildPriceSoc'); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; dol_fiche_end(); print '
'; + + // Update all child soc + print '
'; + print ' '; + print $langs->trans('ForceUpdateChildPriceSoc'); + print '
'; + print ''; print '     '; print ''; @@ -1804,10 +1802,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Update all child soc print ''; - print $langs->trans('ForceUpdateChildPriceSoc'); print ''; print ''; - print ''; print ''; print ''; @@ -1816,6 +1812,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) dol_fiche_end(); print '
'; + print '
'; + print ' '; + print $langs->trans('ForceUpdateChildPriceSoc'); + print "
"; + print ''; print '     '; print ''; @@ -2162,7 +2163,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Action if ($user->rights->produit->supprimer || $user->rights->service->supprimer) { - print ''; + print ''; print 'id . '&socid=' . $line->fk_soc . '">'; print img_info($langs->trans('PriceByCustomerLog')); print ''; From f826e9631cafe5e54cc6918714b81445713d4ea0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Jul 2019 00:12:22 +0200 Subject: [PATCH 11/28] FIX #11463 --- htdocs/societe/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 13838812d9d..53a1ee5d7ed 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->load(array("companies", "bills", "propal", "orders")); +$langs->loadLangs(array("companies", "bills", "propal", "orders")); if (GETPOST('actioncode', 'array')) { From 70ff806fdffdd50435afb1e043ea59f5011bbe90 Mon Sep 17 00:00:00 2001 From: John Botella Date: Tue, 16 Jul 2019 10:41:01 +0200 Subject: [PATCH 12/28] fix fourn code preload --- htdocs/societe/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index a8991614301..2a86465d4f2 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -949,12 +949,13 @@ else if(empty($duplicate_code_error)) { $object->code_client = GETPOST('customer_code', 'alpha'); $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); } else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'),'', 'warnings'); } - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); From c9fe91138d42963e6343923b0b812bfcb893051b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 16 Jul 2019 12:39:43 +0200 Subject: [PATCH 13/28] FIX better compatibility with Multicompany --- htdocs/opensurvey/index.php | 16 +++------------- htdocs/ticket/index.php | 4 ++-- htdocs/ticket/list.php | 3 +-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 4c60a807445..1ddfc47d99a 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -37,18 +37,6 @@ $langs->load("opensurvey"); llxHeader(); -$nbsondages=0; -$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; -$resql=$db->query($sql); -if ($resql) -{ - $obj=$db->fetch_object($resql); - $nbsondages=$obj->nb; -} -else dol_print_error($db,''); - - - print load_fiche_titre($langs->trans("OpenSurveyArea")); @@ -56,7 +44,9 @@ print '
'; $nbsondages=0; -$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$sql = 'SELECT COUNT(*) as nb'; +$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_sondage'; +$sql.= ' WHERE entity IN ('.getEntity('survey').')'; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 086ea63bc0e..59a2bae5f46 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -127,7 +127,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; $sql .= " AND t.fk_statut IS NOT NULL"; $sql .= " AND date_format(datec,'%Y') = '" . $endyear . "'"; if (!$user->rights->societe->client->voir && !$socid) { @@ -271,7 +271,7 @@ if (!$user->rights->societe->client->voir && !$socid) { $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } -$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')'; +$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')'; $sql .= " AND t.fk_statut=0"; if (!$user->rights->societe->client->voir && !$socid) { $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 64ec859cc0c..965677ded0e 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -209,8 +209,7 @@ $sql.=$hookmanager->resPrint; $sql=preg_replace('/, $/','', $sql); $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; -if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; -else $sql.=" WHERE 1 = 1"; +$sql.= " WHERE t.entity IN (".getEntity($object->element).")"; foreach($search as $key => $val) { if ($key == 'fk_statut' && $search[$key] == -1) continue; From 464bda996c5a846e3fea7d0df8d729285c6e2630 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 16 Jul 2019 13:59:00 +0200 Subject: [PATCH 14/28] FIX: propal createFrom hook: undefined parameter attached --- htdocs/comm/propal/class/propal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 647be1d0233..082281af1da 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1316,9 +1316,9 @@ class Propal extends CommonObject // Hook of thirdparty module if (is_object($hookmanager)) { - $parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj); + $parameters=array('objFrom'=>$this,'clonedObj'=>$object); $action=''; - $reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) $error++; } } From c72a59ad36641ab13dbe382c8d52fb36d68b0461 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 16 Jul 2019 14:55:19 +0200 Subject: [PATCH 15/28] FIX : we need to be able to add freeline with qty between 0 & 1 in supplierorder line --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 9198cf3ac22..f32d9d24c01 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1485,7 +1485,7 @@ class CommandeFournisseur extends CommonOrder $desc=trim($desc); // Check parameters - if ($qty < 1 && ! $fk_product) + if ($qty < 0 && ! $fk_product) { $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Product")); return -1; From aab23a15317a62e44f551eb71d43058e8f96b24e Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 16 Jul 2019 17:50:43 +0200 Subject: [PATCH 16/28] FIX : do not return formatted prices in json string --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a68f09e5ee1..64c5063e8a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2594,7 +2594,7 @@ class Form } $opt.= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From b5d348356dbc590b50ec97b25fceae111e7ac91a Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 17 Jul 2019 16:49:41 +0200 Subject: [PATCH 17/28] Fix socpeople assigned list in action com list --- htdocs/comm/action/list.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 2d8be09ee7a..aae2d48e9cf 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -524,6 +524,7 @@ if ($resql) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction=new CActionComm($db); $arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1); + $contactListCache = array(); while ($i < min($num,$limit)) { @@ -634,7 +635,34 @@ if ($resql) // Contact if (! empty($arrayfields['a.fk_contact']['checked'])) { print ''; - if ($obj->fk_contact > 0) + + + $actionstatic->fetchResources(); + if(!empty($actionstatic->socpeopleassigned)) + { + $contactList = array(); + foreach ($actionstatic->socpeopleassigned as $socpeopleId => $socpeopleassigned) + { + if(!isset($contactListCache[$socpeopleassigned['id']])) + { + // if no cache found we fetch it + $contact = new Contact($db); + if($contact->fetch($socpeopleassigned['id'])>0) + { + $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1,'',28); + $contactList[] = $contact->getNomUrl(1,'',28); + } + } + else{ + // use cache + $contactList[] = $contactListCache[$socpeopleassigned['id']]; + } + } + if(!empty($contactList)){ + print implode(', ', $contactList); + } + } + elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event { $contactstatic->id=$obj->fk_contact; $contactstatic->email=$obj->email; From 32bc8a5fafb51d4070014f29f84456b4690b1762 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Jul 2019 11:05:51 +0200 Subject: [PATCH 18/28] FIX fournrprice log for insert --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fc74890f150..49a7b1935cb 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -439,7 +439,7 @@ class ProductFournisseur extends Product $resql = $this->db->query($sql); if ($resql) { - $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); } else { $error++; @@ -462,7 +462,7 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); - return $idinserted; + return $this->product_fourn_price_id; } else { $this->db->rollback(); return -1; From 5daf0316f95b351fadfb4fee11ae42f5d0387908 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Jul 2019 11:18:25 +0200 Subject: [PATCH 19/28] also fix bad insert sql command --- htdocs/fourn/class/fournisseur.product.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 49a7b1935cb..fa597ab8f7e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -430,8 +430,8 @@ class ProductFournisseur extends Product $sql .= " " . $newnpr . ","; $sql .= $conf->entity . ","; $sql .= $delivery_time_days . ","; - $sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'"); - $sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'"); + $sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'") . ","; + $sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'") . ","; $sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'"); $sql .= ")"; From 29974a5fbff5bb6347b2d112cff8446fa6992cdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 13:26:19 +0200 Subject: [PATCH 20/28] Fix css --- htdocs/blockedlog/admin/blockedlog_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 8150bae3e78..2a7bee7335f 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -495,7 +495,7 @@ if (is_array($blocks)) print ''.$object_link.''; // Amount - print ''.price($block->amounts).''; + print ''.price($block->amounts).''; // Details link print ''.img_info($langs->trans('ShowDetails')).''; From e976195777077a9acbf9ce058ac18ed47876529f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 14:08:15 +0200 Subject: [PATCH 21/28] Fix missing key for api --- htdocs/user/list.php | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 8c780c703f7..9002b1eba82 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -81,8 +81,12 @@ $fieldstosearchall = array( 'u.firstname'=>"Firstname", 'u.accountancy_code'=>"AccountancyCode", 'u.email'=>"EMail", - 'u.note'=>"Note" + 'u.note'=>"Note", ); +if (! empty($conf->api->enabled)) +{ + $fieldstosearchall['u.api_key']="ApiKey"; +} // Definition of fields for list $arrayfields=array( @@ -93,6 +97,7 @@ $arrayfields=array( 'u.employee'=>array('label'=>$langs->trans("Employee"), 'checked'=>($mode=='employee'?1:0)), 'u.accountancy_code'=>array('label'=>$langs->trans("AccountancyCode"), 'checked'=>0), 'u.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1), + 'u.api_key'=>array('label'=>$langs->trans("ApiKey"), 'checked'=>0, "enabled"=>($conf->api->enabled && $user->admin)), 'u.fk_soc'=>array('label'=>$langs->trans("Company"), 'checked'=>1), 'u.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))), 'u.fk_user'=>array('label'=>$langs->trans("HierarchicalResponsible"), 'checked'=>1), @@ -121,10 +126,10 @@ $search_gender=GETPOST('search_gender', 'alpha'); $search_employee=GETPOST('search_employee', 'alpha'); $search_accountancy_code=GETPOST('search_accountancy_code', 'alpha'); $search_email=GETPOST('search_email', 'alpha'); +$search_api_key=GETPOST('search_api_key', 'alphanohtml'); $search_statut=GETPOST('search_statut', 'intcomma'); $search_thirdparty=GETPOST('search_thirdparty', 'alpha'); $search_supervisor=GETPOST('search_supervisor', 'intcomma'); -$search_previousconn=GETPOST('search_previousconn', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $search_categ = GETPOST("search_categ", 'int'); $catid = GETPOST('catid', 'int'); @@ -165,6 +170,7 @@ if (empty($reshook)) $search_statut=""; $search_thirdparty=""; $search_supervisor=""; + $search_api_key=""; $search_datelastlogin=""; $search_datepreviouslogin=""; $search_date_creation=""; @@ -185,7 +191,7 @@ $user2=new User($db); $buttonviewhierarchy='
'; -$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.employee, u.photo,"; +$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,"; $sql.= " u.datelastlogin, u.datepreviouslogin,"; $sql.= " u.ldap_sid, u.statut, u.entity,"; $sql.= " u.tms as date_update, u.datec as date_creation,"; @@ -223,6 +229,7 @@ if (is_numeric($search_employee) && $search_employee >= 0) { } if ($search_accountancy_code != '') $sql.= natural_search("u.accountancy_code", $search_accountancy_code); if ($search_email != '') $sql.= natural_search("u.email", $search_email); +if ($search_api_key != '') $sql.= natural_search("u.api_key", $search_api_key); if ($search_statut != '' && $search_statut >= 0) $sql.= " AND u.statut IN (".$db->escape($search_statut).")"; if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); if ($catid > 0) $sql.= " AND cu.fk_categorie = ".$catid; @@ -277,6 +284,7 @@ if ($search_gender != '') $param.="&search_gender=".urlencode($search_gender if ($search_employee != '') $param.="&search_employee=".urlencode($search_employee); if ($search_accountancy_code != '') $param.="&search_accountancy_code=".urlencode($search_accountancy_code); if ($search_email != '') $param.="&search_email=".urlencode($search_email); +if ($search_api_key != '') $param.="&search_api_key=".urlencode($search_api_key); if ($search_supervisor > 0) $param.="&search_supervisor=".urlencode($search_supervisor); if ($search_statut != '') $param.="&search_statut=".urlencode($search_statut); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -359,15 +367,15 @@ print ''; if (! empty($arrayfields['u.login']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['u.lastname']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['u.firstname']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['u.gender']['checked'])) { @@ -384,15 +392,19 @@ if (! empty($arrayfields['u.employee']['checked'])) } if (! empty($arrayfields['u.accountancy_code']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['u.email']['checked'])) { - print ''; + print ''; +} +if (! empty($arrayfields['u.api_key']['checked'])) +{ + print ''; } if (! empty($arrayfields['u.fk_soc']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['u.entity']['checked'])) { @@ -455,6 +467,7 @@ if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titr if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder); if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre("AccountancyCode", $_SERVER['PHP_SELF'], "u.accountancy_code", $param, "", "", $sortfield, $sortorder); if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre("EMail", $_SERVER['PHP_SELF'], "u.email", $param, "", "", $sortfield, $sortorder); +if (! empty($arrayfields['u.api_key']['checked'])) print_liste_field_titre("ApiKey", $_SERVER['PHP_SELF'], "u.api_key", $param, "", "", $sortfield, $sortorder); if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "u.fk_soc", $param, "", "", $sortfield, $sortorder); if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre("Entity", $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder); if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder); @@ -542,6 +555,11 @@ while ($i < min($num, $limit)) print ''; if (! $i) $totalarray['nbfield']++; } + if (! empty($arrayfields['u.api_key']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } if (! empty($arrayfields['u.fk_soc']['checked'])) { print "
'.$obj->email.''.$obj->api_key.'"; From 3b393e818a786b92b6a67de96cd909ca1662fe8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 14:17:29 +0200 Subject: [PATCH 22/28] Fix missing entity property into fetch --- htdocs/projet/class/project.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 6b1d5e0a07f..cbee8d181ca 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -440,7 +440,7 @@ class Project extends CommonObject $sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,"; $sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent,"; - $sql.= " note_private, note_public, model_pdf, bill_time"; + $sql.= " note_private, note_public, model_pdf, bill_time, entity"; $sql.= " FROM " . MAIN_DB_PREFIX . "projet"; if (! empty($id)) { @@ -488,6 +488,7 @@ class Project extends CommonObject $this->budget_amount = $obj->budget_amount; $this->modelpdf = $obj->model_pdf; $this->bill_time = (int) $obj->bill_time; + $this->entity = $obj->entity; $this->db->free($resql); From c961a397c480438be5c1ca78ec9bc4753b49f37b Mon Sep 17 00:00:00 2001 From: atm-ph Date: Thu, 18 Jul 2019 15:40:50 +0200 Subject: [PATCH 23/28] Fix missing hook then can't interact with actions --- htdocs/compta/facture/prelevement.php | 54 ++++++++++++++++----------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 6d5d52ce503..eb1493fcad0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -61,42 +61,52 @@ if ($id > 0 || ! empty($ref)) } } +$hookmanager->initHooks(array('levycard','globalcard')); + + /* * Actions */ -if ($action == "new") +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - if ($object->id > 0) + if ($action == "new") { - $db->begin(); - - $result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount')); - if ($result > 0) + if ($object->id > 0) { - $db->commit(); + $db->begin(); - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - $db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); + $result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount')); + if ($result > 0) + { + $db->commit(); + + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + } } + $action=''; } - $action=''; -} -if ($action == "delete") -{ - if ($object->id > 0) + if ($action == "delete") { - $result = $object->demande_prelevement_delete($user, GETPOST('did')); - if ($result == 0) + if ($object->id > 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; + $result = $object->demande_prelevement_delete($user, GETPOST('did')); + if ($result == 0) + { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } } } } From 984fe9834256fa3169f753589b414dab9fea82d2 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Thu, 18 Jul 2019 16:12:42 +0200 Subject: [PATCH 24/28] Fix missing hook --- htdocs/compta/prelevement/create.php | 69 ++++++++++++++++------------ 1 file changed, 40 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 02ccee567f5..d083d58fb26 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -51,43 +51,54 @@ $page = GETPOST("page",'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; +$hookmanager->initHooks(array('levycreatecard','globalcard')); + + /* * Actions */ -// Change customer bank information to withdraw -if ($action == 'modify') +$parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + +if (empty($reshook)) { - for ($i = 1 ; $i < 9 ; $i++) - { - dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"),'chaine',0,'',$conf->entity); - } -} -if ($action == 'create') -{ - // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty - $bprev = new BonPrelevement($db); + // Change customer bank information to withdraw + if ($action == 'modify') + { + for ($i = 1 ; $i < 9 ; $i++) + { + dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"),'chaine',0,'',$conf->entity); + } + } + if ($action == 'create') + { + // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty + $bprev = new BonPrelevement($db); $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format,$executiondate); - if ($result < 0) - { - setEventMessages($bprev->error, $bprev->errors, 'errors'); - } - elseif ($result == 0) - { - $mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format); - setEventMessages($mesg, null, 'errors'); - $mesg.='
'."\n"; - foreach($bprev->invoice_in_error as $key => $val) - { - $mesg.=''.$val."
\n"; - } - } - else - { - setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); - } + if ($result < 0) + { + setEventMessages($bprev->error, $bprev->errors, 'errors'); + } + elseif ($result == 0) + { + $mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format); + setEventMessages($mesg, null, 'errors'); + $mesg.='
'."\n"; + foreach($bprev->invoice_in_error as $key => $val) + { + $mesg.=''.$val."
\n"; + } + } + else + { + setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); + } + } } From f53f314211a29624cd3f61b8d3d2994ce9b69dc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 17:15:50 +0200 Subject: [PATCH 25/28] Update fournisseur.product.class.php --- htdocs/fourn/class/fournisseur.product.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index fa597ab8f7e..6847af5edf1 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -439,7 +439,7 @@ class ProductFournisseur extends Product $resql = $this->db->query($sql); if ($resql) { - $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $idinserted = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); } else { $error++; @@ -462,6 +462,7 @@ class ProductFournisseur extends Product if (empty($error)) { $this->db->commit(); + $this->product_fourn_price_id = $idinserted; return $this->product_fourn_price_id; } else { $this->db->rollback(); From e54887213357668d4173824d0bcc0977a1659549 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 17:23:05 +0200 Subject: [PATCH 26/28] Update prelevement.php --- htdocs/compta/facture/prelevement.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index eb1493fcad0..9e1d9bef887 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -61,7 +61,7 @@ if ($id > 0 || ! empty($ref)) } } -$hookmanager->initHooks(array('levycard','globalcard')); +$hookmanager->initHooks(array('directdebitcard','globalcard')); From b3182f65bc98db714a157c535db031845c5a007c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 17:23:52 +0200 Subject: [PATCH 27/28] Update create.php --- htdocs/compta/prelevement/create.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index d083d58fb26..8616fe5f528 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -51,7 +51,7 @@ $page = GETPOST("page",'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; -$hookmanager->initHooks(array('levycreatecard','globalcard')); +$hookmanager->initHooks(array('directdebitcreatecard','globalcard')); /* From a09d33b4277e41e7ae94f29223984b116cbfe4be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 18 Jul 2019 17:47:00 +0200 Subject: [PATCH 28/28] Fix responsive --- htdocs/admin/holiday.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index e3571fdb253..27dddf8668a 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -201,6 +201,7 @@ dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday'); print load_fiche_titre($langs->trans("HolidaysNumberingModules"), '', ''); +print '
'; print ''; print ''; print ''; @@ -294,8 +295,10 @@ foreach ($dirmodels as $reldir) } } -print '
'.$langs->trans("Name").'

'; +print '
'; +print '
'; +print '
'; if ($conf->global->MAIN_FEATURES_LEVEL >= 2) @@ -331,6 +334,7 @@ else } +print '
'; print ''; print ''; print ''; @@ -457,6 +461,7 @@ foreach ($dirmodels as $reldir) } print '
'.$langs->trans("Name").'
'; +print '
'; print "
"; @@ -469,6 +474,8 @@ print ''; print ''; print load_fiche_titre($langs->trans("OtherOptions"), '', ''); + +print '
'; print ''; print ''; print ''; @@ -506,6 +513,8 @@ print ''."\n"; print '
'.$langs->trans("Parameter").'
'; +print '
'; + print '
'; print '';