From b24f5fda68f3f6800a68fce44676db8dcb59d910 Mon Sep 17 00:00:00 2001 From: Xebax Date: Tue, 29 Jan 2019 08:47:46 +0100 Subject: [PATCH 01/13] FIX Fix PHP warning "count(): Parameter must be an array..." --- htdocs/api/class/api.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 2d18568bf2d..b9e7f2075ef 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -251,7 +251,7 @@ class DolibarrApi //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); $tmp=$sqlfilters; $ok=0; - $i=0; $nb=count($tmp); + $i=0; $nb=strlen($tmp); $counter=0; while ($i < $nb) { From eca1a2cd6472efa4b6ffae90e91263da8536e0db Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:08:13 +0100 Subject: [PATCH 02/13] Update societe.class.php --- htdocs/societe/class/societe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a240c83b89f..18a4dbda8f2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3798,6 +3798,7 @@ class Societe extends CommonObject $sql .= " WHERE fk_soc = ". $this->id; $sql .= " AND paye = 0"; $sql .= " AND fk_statut <> 0"; // Not a draft + $sql .= " AND entity IN (".getEntity('invoice').")"; //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason $sql .= " AND fk_statut <> 3"; // Not abandonned $sql .= " AND fk_statut <> 2"; // Not clasified as paid From 508fb5c9cb82234a6523a35560d3c10cce473091 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:13:11 +0100 Subject: [PATCH 03/13] =?UTF-8?q?Prise=20en=20charge=20des=20Travaux=20sup?= =?UTF-8?q?pl=C3=A9mentaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige la filtration lors des situations client afin de prendre en compte la possibilité d'ajouter des travaux en cours de chantier. --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 313a4ee4def..ac2de384ddc 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -283,7 +283,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; situation_counter == 1 || !$this->situation_cycle_ref) && empty($disableremove)) { + if (($line->fk_prev_id == NULL ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation print 'id . '">'; print img_delete(); print ''; From 30548d977fc46ccb6dee6952e5523e2438a01745 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:19:11 +0100 Subject: [PATCH 04/13] =?UTF-8?q?Prise=20en=20charge=20des=20Travaux=20sup?= =?UTF-8?q?pl=C3=A9mentaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige la filtration pour permettre l'ajout de ligne lors de la présence de travaux supplémentaires en cours de chantier. --- htdocs/compta/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 9ad79393499..bec4097935f 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4540,7 +4540,7 @@ else if ($id > 0 || ! empty($ref)) $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1); // Form to add new line - if ($object->statut == 0 && $user->rights->facture->creer && $action != 'valid' && $action != 'editline' && ($object->is_first() || !$object->situation_cycle_ref)) + if ($object->statut == 0 && $usercancreate && $action != 'valid' && $action != 'editline') { if ($action != 'editline' && $action != 'selectlines') { From dd0f6b38290a6660b2a68b0bd1960cd882c1d110 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:30:14 +0100 Subject: [PATCH 05/13] =?UTF-8?q?Edition=20Ligne=20Travaux=20Suppl=C3=A9me?= =?UTF-8?q?ntaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correction pour permettre l'édition si la ligne n'existe pas dans une précédente situation. Permet l'édition d'une ligne si elle a été ajouté dans la situation actuelle. --- htdocs/core/tpl/objectline_edit.tpl.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d3dc9807c5a..62387001de5 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td } // Do not allow editing during a situation cycle - if (empty($this->situation_cycle_ref) || $this->situation_counter == 1) + if ($line->fk_prev_id == NULL ) { // editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -137,7 +137,7 @@ $coldisplay=-1; // We remove first td } $coldisplay++; - if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { + if ($line->fk_prev_id == NULL ) { print '' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . ''; } else { print '%'; @@ -145,7 +145,7 @@ $coldisplay=-1; // We remove first td $coldisplay++; print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != NULL ) print ' readonly'; print '>'; if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { @@ -156,7 +156,7 @@ $coldisplay=-1; // We remove first td { $coldisplay++; print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != NULL ) print ' readonly'; print '>'; } ?> @@ -167,7 +167,7 @@ $coldisplay=-1; // We remove first td // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != NULL ) print ' readonly'; print '>'; } else { ?>   @@ -186,7 +186,7 @@ $coldisplay=-1; // We remove first td info_bits & 2) != 2) { print 'situation_counter > 1) print ' readonly'; + if ($line->fk_prev_id != NULL ) print ' readonly'; print '>%'; } else { ?>   From f9b86225454e6a15f141fdec5c264fc45d0ae476 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:33:22 +0100 Subject: [PATCH 06/13] Prise en charge de Multicompany MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correction pour éviter que les factures appartenant à d'autres entités n'apparaissent dans celle qui est consultée sur le moment. --- htdocs/fourn/recap-fourn.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index e680c18074e..577ffc6a99a 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2019 Pierre Ardoin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,6 +77,7 @@ if ($socid > 0) $sql.= " u.login, u.rowid as userid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$societe->id; + $sql.= " AND f.entity IN (".getEntity("facture_fourn").")"; // Reconaissance de l'entité attribuée à cette facture pour Multicompany $sql.= " AND f.fk_user_valid = u.rowid"; $sql.= " ORDER BY f.datef DESC"; From e75170137e5ded0c3bd1145c2b87ac71aac12ab1 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:42:44 +0100 Subject: [PATCH 07/13] =?UTF-8?q?Correction=20de=20la=20filtration=20de=20?= =?UTF-8?q?l'entit=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrige pour que la marge réalisée sur d'autres entités n'apparaisse pas sur celle sur laquelle l'utilisateur est connecté. --- htdocs/margin/tabs/productMargins.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index e6c51e2217d..3b826501614 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -147,7 +147,7 @@ if ($id > 0 || ! empty($ref)) if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.fk_statut > 0"; - $sql.= " AND s.entity = ".$conf->entity; + $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND d.fk_facture = f.rowid"; $sql.= " AND d.fk_product =".$object->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; From b6df02e795664a188d3f9981f49d7707b8594386 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 11:47:39 +0100 Subject: [PATCH 08/13] Correction oubli date de livraison Corrige l'oubli de la substitution de la date de livraison pour les commandes et demande de prix fournisseurs --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 90167504f3f..792da337aac 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5993,6 +5993,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob $substitutionarray['__REF__'] = $object->ref; $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : '')); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : ''); + $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs): ''); // TODO Use this ? $msgishtml = 0; From 5ea1cf077502d05f7f89fd20a24113579a8726f5 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 14:25:34 +0100 Subject: [PATCH 09/13] Update objectline_edit.tpl.php --- htdocs/core/tpl/objectline_edit.tpl.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 62387001de5..00fc4f8e885 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -99,7 +99,7 @@ $coldisplay=-1; // We remove first td } // Do not allow editing during a situation cycle - if ($line->fk_prev_id == NULL ) + if ($line->fk_prev_id == null ) { // editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -137,7 +137,7 @@ $coldisplay=-1; // We remove first td } $coldisplay++; - if ($line->fk_prev_id == NULL ) { + if ($line->fk_prev_id == null ) { print '' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . ''; } else { print '%'; @@ -145,7 +145,7 @@ $coldisplay=-1; // We remove first td $coldisplay++; print 'fk_prev_id != NULL ) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>'; if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { @@ -156,7 +156,7 @@ $coldisplay=-1; // We remove first td { $coldisplay++; print 'fk_prev_id != NULL ) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>'; } ?> @@ -167,7 +167,7 @@ $coldisplay=-1; // We remove first td // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; print 'fk_prev_id != NULL ) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>'; } else { ?>   @@ -186,7 +186,7 @@ $coldisplay=-1; // We remove first td info_bits & 2) != 2) { print 'fk_prev_id != NULL ) print ' readonly'; + if ($line->fk_prev_id != null ) print ' readonly'; print '>%'; } else { ?>   From 80cfe86508535e74b407fa118de6def4c69f8343 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 14:26:14 +0100 Subject: [PATCH 10/13] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index ac2de384ddc..e8ede7c59e7 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -283,7 +283,7 @@ $domData .= ' data-product_type="'.$line->product_type.'"'; fk_prev_id == NULL ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation print 'id . '">'; print img_delete(); print ''; From 99892c13b0eda7b26747701f14567e9ae0c79e72 Mon Sep 17 00:00:00 2001 From: Pierre Ardoin <32256817+mapiolca@users.noreply.github.com> Date: Tue, 29 Jan 2019 23:26:08 +0100 Subject: [PATCH 11/13] FIX : Erreur dans le Total Corrige l'erreur de calcul dans le total des produits et services --- htdocs/product/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 9f11813fdee..bfd6f6ad18f 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -184,7 +184,7 @@ else if ($type == '1') else { print $statProducts.$statServices; - $total=round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2]); + $total=round($prodser[0][0])+round($prodser[0][1])+round($prodser[0][2])+round($prodser[0][3])+round($prodser[1][0])+round($prodser[1][1])+round($prodser[1][2])+round($prodser[1][3]); //Calcul du Total des Produits et Services } print ''.$langs->trans("Total").''; print $total; From 94909292162a303223760a79da5a7d31c91e0ee0 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 30 Jan 2019 10:49:32 +0100 Subject: [PATCH 12/13] FIX : $conf->fournisseur->commande->enabled doesn't exist, we must use $conf->fournisseur->enabled --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 3c9880ef4ec..6ebbd24ac58 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -175,7 +175,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id ); // First classify billed the order to allow the proposal classify process - if (! empty($conf->fournisseur->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) + if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_SUPPLIER_ORDER)) { $object->fetchObjectLinked('','order_supplier',$object->id,$object->element); if (! empty($object->linkedObjects)) From 869159c09f41f5b585bdb93bd292f9518f000eb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Jan 2019 15:31:18 +0100 Subject: [PATCH 13/13] Fix regression in look and feel (if empty, we do not sho value) --- htdocs/comm/card.php | 2 +- htdocs/societe/class/societe.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index fc2c027713a..2cf3c120af6 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -387,7 +387,7 @@ if ($object->id > 0) print ''.img_edit($langs->trans("Modify")).''; } print ''; - print ''.($object->remise_percent?''.price2num($object->remise_percent).'%':'').''; + print ''.($object->remise_percent?''.$object->remise_percent.'%':'').''; print ''; // Absolute discounts (Discounts-Drawbacks-Rebates) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e4f5a32783c..a78aaf83a9d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1296,7 +1296,7 @@ class Societe extends CommonObject $this->prefix_comm = $obj->prefix_comm; - $this->remise_percent = $obj->remise_client; + $this->remise_percent = price2num($obj->remise_client); // 0.000000 must be 0 $this->remise_supplier_percent = $obj->remise_supplier; $this->mode_reglement_id = $obj->mode_reglement; $this->cond_reglement_id = $obj->cond_reglement;