From ac7f1035e1c33f0525caae04e266febf80e65023 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sun, 3 Sep 2017 12:25:27 +0200 Subject: [PATCH 1/9] FIX #7325 Default VAT rate when editing template invoices is 0% Close #7325 --- htdocs/compta/facture/fiche-rec.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index a6b238ba3c7..5af3d71f3af 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -896,7 +896,7 @@ if ($action == 'create') $langs->load('projects'); print '' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); - print '   id).'">' . $langs->trans("AddProject") . ''; + print '   thirdparty->id).'">' . $langs->trans("AddProject") . ''; print ''; } @@ -963,7 +963,7 @@ if ($action == 'create') $disableedit=1; $disablemove=1; $disableremove=1; - $ret = $object->printObjectLines('', $mysoc, $soc, $lineid, 0); // No date selector for template invoice + $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid); // No date selector for template invoice } print "\n"; @@ -1307,7 +1307,7 @@ else { //$disableedit=1; //$disablemove=1; - $ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 0); // No date selector for template invoice + $ret = $object->printObjectLines($action, $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice } // Form to add new line @@ -1318,7 +1318,7 @@ else $var = true; // Add free products/services - $object->formAddObjectLine(0, $mysoc, $soc); // No date selector for template invoice + $object->formAddObjectLine(0, $mysoc, $object->thirdparty); // No date selector for template invoice $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook From eb9e8c9dfcb9f94e8c1f06d8b4ecfc881c265d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garc=C3=ADa?= Date: Sun, 3 Sep 2017 12:42:05 +0200 Subject: [PATCH 2/9] FIX #7000 Dashboard link for late pending payment supplier invoices do not work Close #7000 --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/facture/list.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index bb3d303b32e..3aa9051a5c6 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1507,7 +1507,7 @@ class FactureFournisseur extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->fournisseur->warning_delay/60/60/24; $response->label=$langs->trans("SupplierBillsToPay"); - $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=fac.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills'; + $response->url=DOL_URL_ROOT.'/fourn/facture/list.php?filtre=f.fk_statut:1,paye:0&mainmenu=accountancy&leftmenu=suppliers_bills'; $response->img=img_object($langs->trans("Bills"),"bill"); $facturestatic = new FactureFournisseur($this->db); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 66411dc8422..706a78ccb1e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -84,9 +84,12 @@ $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); $toselect = GETPOST('toselect', 'array'); +$filter = GETPOST('filtre'); $option = GETPOST('option'); -if ($option == 'late') $filter = 'paye:0'; +if ($option == 'late') { + $filter = 'paye:0'; +} $search_all = GETPOST('sall'); $search_label = GETPOST("search_label","alpha"); From 1154f871f13bbcf9bcf931c94eb3175d16cf39b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Sep 2017 10:52:49 +0200 Subject: [PATCH 3/9] Update fiche-rec.php --- htdocs/compta/facture/fiche-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 5af3d71f3af..9e118a460a5 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -963,7 +963,7 @@ if ($action == 'create') $disableedit=1; $disablemove=1; $disableremove=1; - $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid); // No date selector for template invoice + $ret = $object->printObjectLines('', $mysoc, $object->thirdparty, $lineid, 0); // No date selector for template invoice } print "\n"; From 4dd58a94f3303cde838bb49066f39c137b8dd768 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Sep 2017 10:54:50 +0200 Subject: [PATCH 4/9] Update list.php --- htdocs/fourn/facture/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 706a78ccb1e..6a0606dce86 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -84,7 +84,7 @@ $day_lim = GETPOST('day_lim','int'); $month_lim = GETPOST('month_lim','int'); $year_lim = GETPOST('year_lim','int'); $toselect = GETPOST('toselect', 'array'); -$filter = GETPOST('filtre'); +$filter = GETPOST('filtre','alpha'); $option = GETPOST('option'); if ($option == 'late') { From 237270a27eb52c60bc8898700c98a5e5ae997da1 Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 5 Sep 2017 21:40:04 +0200 Subject: [PATCH 5/9] Add missing transfer of line extrafields in create invoice from supplier order --- htdocs/fourn/facture/card.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ac94d1b0e62..f1d684261d9 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -456,7 +456,13 @@ if (empty($reshook)) $date_end=$lines[$i]->date_fin_prevue; if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; - + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; + $extrafields = new ExtraFields($db); + $targetExtraLabels = $extrafields->fetch_name_optionals_label($object->table_element_line); + $lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraLabels); + } // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline( $desc, From f5e14c9d7060882595021306b42584c877e0db23 Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 5 Sep 2017 21:41:49 +0200 Subject: [PATCH 6/9] Transfer of customer order line extrafield should only transfer fields available in target --- htdocs/compta/facture.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 8a35fd7583d..33462e6370a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1153,7 +1153,9 @@ if (empty($reshook)) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); + $extrafields = new ExtraFields($db); + $targetExtraLabels = $extrafields->fetch_name_optionals_label($object->table_element_line); + $lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraLabels); $array_options = $lines[$i]->array_options; } From 5a75e14a8ab3541a82ed8ca731e3d6874b570b3a Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 5 Sep 2017 22:50:34 +0200 Subject: [PATCH 7/9] Add supplier qty and supplier discount for export --- htdocs/core/modules/modProduct.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 154639f848d..6edcb0e2708 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -151,14 +151,14 @@ class modProduct extends DolibarrModules if ($mysoc->useNPR()) $this->export_fields_array[$r]['p.recuperableonly']='NPR'; if (! empty($conf->stock->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.stock'=>'Stock','p.seuil_stock_alerte'=>'StockLimit','p.desiredstock'=>'DesiredStock','p.pmp'=>'PMPValue')); if (! empty($conf->barcode->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.barcode'=>'BarCode')); - if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'SuppliersPrices')); + if (! empty($conf->fournisseur->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('s.nom'=>'Supplier','pf.ref_fourn'=>'SupplierRef','pf.unitprice'=>'BuyingPrice','pf.quantity'=>'QtyMin','pf.remise_percent'=>'DiscountQtyMin')); if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('p.cost_price'=>'CostPrice')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('group_concat(cat.label)'=>'Categories')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r],array('l.lang'=>'Language', 'l.label'=>'TranslatedLabel','l.description'=>'TranslatedDescription','l.note'=>'TranslatedNote')); $this->export_TypeFields_array[$r]=array('p.ref'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.url'=>"Text",'p.accountancy_code_sell'=>"Text",'p.accountancy_code_buy'=>"Text",'p.note'=>"Text",'p.length'=>"Numeric",'p.surface'=>"Numeric",'p.volume'=>"Numeric",'p.weight'=>"Numeric",'p.customcode'=>'Text','p.price_base_type'=>"Text",'p.price'=>"Numeric",'p.price_ttc'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.datec'=>'Date','p.tms'=>'Date'); if (! empty($conf->stock->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.stock'=>'Numeric','p.seuil_stock_alerte'=>'Numeric','p.desiredstock'=>'Numeric','p.pmp'=>'Numeric','p.cost_price'=>'Numeric')); if (! empty($conf->barcode->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('p.barcode'=>'Text')); - if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric')); + if (! empty($conf->fournisseur->enabled)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('s.nom'=>'Text','pf.ref_fourn'=>'Text','pf.unitprice'=>'Numeric','pf.quantity'=>'Numeric','pf.remise_percent'=>'Numeric')); if (! empty($conf->global->MAIN_MULTILANGS)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array('l.lang'=>'Text', 'l.label'=>'Text','l.description'=>'Text','l.note'=>'Text')); if (! empty($conf->global->EXPORTTOOL_CATEGORIES)) $this->export_TypeFields_array[$r]=array_merge($this->export_TypeFields_array[$r],array("group_concat(cat.label)"=>'Text')); $this->export_entities_array[$r]=array('p.rowid'=>"product",'p.ref'=>"product",'p.label'=>"product",'p.description'=>"product",'p.url'=>"product",'p.accountancy_code_sell'=>'product','p.accountancy_code_sell'=>'product','p.note'=>"product",'p.length'=>"product",'p.surface'=>"product",'p.volume'=>"product",'p.weight'=>"product",'p.customcode'=>'product','p.price_base_type'=>"product",'p.price'=>"product",'p.price_ttc'=>"product",'p.tva_tx'=>"product",'p.tosell'=>"product",'p.tobuy'=>"product",'p.datec'=>"product",'p.tms'=>"product"); From 7c743eb7da87046c1416c6a3d04ed9d810e8539c Mon Sep 17 00:00:00 2001 From: fappels Date: Thu, 7 Sep 2017 21:04:15 +0200 Subject: [PATCH 8/9] Rename $extrafields because already used --- htdocs/compta/facture.php | 6 +++--- htdocs/fourn/facture/card.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 33462e6370a..f229b3d999c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1153,9 +1153,9 @@ if (empty($reshook)) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $extrafields = new ExtraFields($db); - $targetExtraLabels = $extrafields->fetch_name_optionals_label($object->table_element_line); - $lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraLabels); + $targetExtraFields = new ExtraFields($db); + $targetExtraFieldLabels = $targetExtraFields->fetch_name_optionals_label($object->table_element_line); + $lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraFieldLabels); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f1d684261d9..224a1443a4f 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -459,9 +459,9 @@ if (empty($reshook)) // Extrafields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($db); - $targetExtraLabels = $extrafields->fetch_name_optionals_label($object->table_element_line); - $lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraLabels); + $targetExtraFields = new ExtraFields($db); + $targetExtraFieldLabels = $targetExtraFields->fetch_name_optionals_label($object->table_element_line); + $lines[$i]->fetch_optionals($lines[$i]->rowid, $targetExtraFieldLabels); } // FIXME Missing $lines[$i]->ref_supplier and $lines[$i]->label into addline and updateline methods. They are filled when coming from order for example. $result = $object->addline( From 8b9b99ac408239cd81f35aa24ce4d0d6b81f5d21 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 15 Sep 2017 13:02:49 +0200 Subject: [PATCH 9/9] fix : advance target emailing --- htdocs/comm/mailing/class/advtargetemailing.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 453d1f75319..5307237919b 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -474,7 +474,7 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid "; } if (array_key_exists('cust_categ', $arrayquery)) { - $sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_societe=t.rowid "; + $sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_soc=t.rowid "; } if (!empty($arrayquery['cust_name'])) {