From 72449ddef4be0bb5150eebc04c02ef02459b7e3f Mon Sep 17 00:00:00 2001 From: atm-greg Date: Fri, 15 Jun 2018 16:55:23 +0200 Subject: [PATCH 01/70] add hooks on stock replenish --- htdocs/product/stock/replenish.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 5a61e8b2a98..27a60b09257 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -43,6 +43,9 @@ if ($user->societe_id) { } $result=restrictedArea($user,'produit|service'); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('stockreplenishlist', 'globalcard')); + //checks if a product has been ordered $action = GETPOST('action','alpha'); @@ -87,6 +90,9 @@ if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) $usevirtualstock=0; if ($mode == 'virtual') $usevirtualstock=1; +$parameters=array(); +$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'); /* * Actions @@ -670,6 +676,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) } $i++; } + +$parameters=array('sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print ''; print ''; From 2cdae2ec98d09f15f9c5e18e658d183b82d77085 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Mon, 18 Jun 2018 11:30:38 +0200 Subject: [PATCH 02/70] remove globalcard context --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 27a60b09257..b2386c4b8a1 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -44,7 +44,7 @@ if ($user->societe_id) { $result=restrictedArea($user,'produit|service'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('stockreplenishlist', 'globalcard')); +$hookmanager->initHooks(array('stockreplenishlist')); //checks if a product has been ordered From 0ee7befa1943b33ecd7ed506b002b42713df8bb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 21 Aug 2018 13:27:49 +0200 Subject: [PATCH 03/70] Update replenish.php --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index b2386c4b8a1..7c5189d488b 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Laurent Destaileur + * Copyright (C) 2013-2018 Laurent Destaileur * Copyright (C) 2014 Regis Houssin * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2016 ATM Consulting From d6a9da57e11d64ecb68f21437c50fd2e0c0e7d44 Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 1 Oct 2018 14:11:19 +0200 Subject: [PATCH 04/70] FIX : need to round with 2 decimals to avoid movements not correctly balanced --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 9dcb924779e..50af8a6855d 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -651,8 +651,8 @@ if ($action == 'create') print "\n"; } - $total_debit = price2num($total_debit); - $total_credit = price2num($total_credit); + $total_debit = price2num($total_debit, 2); + $total_credit = price2num($total_credit, 2); if ($total_debit != $total_credit) { From 2a7b3c7d7d327128f4b33acf4287185af501daa3 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Mon, 14 Jan 2019 10:48:34 +0100 Subject: [PATCH 05/70] FIX : Check for old picture name if the new one was not found --- htdocs/theme/eldy/style.css.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0097eb4715c..14dad44a89d 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1783,6 +1783,12 @@ foreach($mainmenuusedarray as $val) $found=1; break; } + else if (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité + { + $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); + $found=1; + break; + } } // Img file not found if (! $found) From 1cf786acff1dc3c31c0006e47238c349e5179fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Tue, 22 Jan 2019 00:09:36 +0100 Subject: [PATCH 06/70] Fix #10278 Fix #10278 --- htdocs/core/class/commonobject.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 676e76fe16a..d8d27a0378a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4932,8 +4932,6 @@ abstract class CommonObject $new_array_options[$key] = price2num($this->array_options[$key]); break; case 'date': - $new_array_options[$key] = $this->db->idate($this->array_options[$key]); - break; case 'datetime': // If data is a string instead of a timestamp, we convert it if (! is_int($this->array_options[$key])) { From 4624f1b1b84d036b6eac7ca9e747217affef2555 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 6 Feb 2019 17:19:16 +0100 Subject: [PATCH 07/70] FIX positive values creating diff on addline rounding --- htdocs/fourn/class/fournisseur.facture.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 086f154184d..a006b5391b1 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1665,9 +1665,9 @@ class FactureFournisseur extends CommonInvoice $this->line->rang=$rang; $this->line->info_bits=$info_bits; $this->line->total_ht= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); // For credit note and if qty is negative, total is negative - $this->line->total_tva= $total_tva; - $this->line->total_localtax1=$total_localtax1; - $this->line->total_localtax2=$total_localtax2; + $this->line->total_tva= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); + $this->line->total_localtax1=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax1):$total_localtax1); + $this->line->total_localtax2=(($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_localtax2):$total_localtax2); $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $this->line->special_code=$this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; @@ -1837,11 +1837,11 @@ class FactureFournisseur extends CommonInvoice $line->localtax2_tx = $txlocaltax2; $line->localtax1_type = $localtaxes_type[0]; $line->localtax2_type = $localtaxes_type[2]; - $line->total_ht = $total_ht; - $line->total_tva = $total_tva; + $line->total_ht = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ht):$total_ht); + $line->total_tva = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_tva):$total_tva); $line->total_localtax1 = $total_localtax1; $line->total_localtax2 = $total_localtax2; - $line->total_ttc = $total_ttc; + $line->total_ttc = (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); $line->fk_product = $idproduct; $line->product_type = $product_type; $line->info_bits = $info_bits; From 2142ccee8a6490257e06135d87aef8a6f38b7f94 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 8 Feb 2019 15:17:40 +0100 Subject: [PATCH 08/70] FIX : better method --- htdocs/accountancy/bookkeeping/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 50af8a6855d..67217954467 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -651,8 +651,8 @@ if ($action == 'create') print "\n"; } - $total_debit = price2num($total_debit, 2); - $total_credit = price2num($total_credit, 2); + $total_debit = price2num($total_debit, 'MT'); + $total_credit = price2num($total_credit, 'MT'); if ($total_debit != $total_credit) { From b017213131e278ab1603d0e1a78402bed704e100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 17 Feb 2019 20:59:39 +0100 Subject: [PATCH 09/70] selectMulticurrency avoid malformed empty value --- 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 58df0ad4e22..c451a83a4fb 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4517,7 +4517,7 @@ class Form $out=''; $out.= ' '; - print ' '; + print ''.$langs->trans('DiscountType').''; + if ($isCustomer) { + print ' '; + } + if ($isSupplier) { + print ' '; + } print ''; } From 85d46a5270198d12bb6e7a458ab71a9dcc47ff1e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Feb 2019 11:24:07 +0100 Subject: [PATCH 20/70] Update xinputfile.modules.php --- htdocs/core/modules/mailings/xinputfile.modules.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index a026d4b53cf..e636c4885c7 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -180,7 +180,8 @@ class mailing_xinputfile extends MailingTargets $i++; $langs->load("errors"); $msg = $langs->trans("ErrorFoundBadEmailInFile",$i,$cpt,$email); - if(!empty($msg)) $this->error = $msg; + if (!empty($msg)) $this->error = $msg; + else $this->error = 'ErrorFoundBadEmailInFile '.$i.' '.$cpt.' '.$email; // We experience case where $langs->trans return an empty string. } } } From cefaeb583ff12ad09c836fcbf6b39d01209e901b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Feb 2019 11:24:43 +0100 Subject: [PATCH 21/70] Update xinputfile.modules.php --- htdocs/core/modules/mailings/xinputfile.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index e636c4885c7..1453f247d28 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -179,7 +179,7 @@ class mailing_xinputfile extends MailingTargets { $i++; $langs->load("errors"); - $msg = $langs->trans("ErrorFoundBadEmailInFile",$i,$cpt,$email); + $msg = $langs->trans("ErrorFoundBadEmailInFile", $i, $cpt, $email); if (!empty($msg)) $this->error = $msg; else $this->error = 'ErrorFoundBadEmailInFile '.$i.' '.$cpt.' '.$email; // We experience case where $langs->trans return an empty string. } From 855aaaffd8f2a6df7e93019b6fa2ad68ca777a0e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 28 Feb 2019 11:44:10 +0100 Subject: [PATCH 22/70] Better fix for type of discount --- htdocs/comm/card.php | 63 +++++++++++++++++++++++------------------- htdocs/comm/remise.php | 31 +++++++++++---------- 2 files changed, 51 insertions(+), 43 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 2cf3c120af6..be60c4fa574 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -377,38 +377,43 @@ if ($object->id > 0) print ''; } - // Relative discounts (Discounts-Drawbacks-Rebates) - print ''; - print '
'; - print $langs->trans("CustomerRelativeDiscountShort"); - print ''; - if ($user->rights->societe->creer && !$user->societe_id > 0) - { - print ''.img_edit($langs->trans("Modify")).''; - } - print '
'; - print ''.($object->remise_percent?''.$object->remise_percent.'%':'').''; - print ''; + $isCustomer = ($object->client == 1 || $object->client == 3); - // Absolute discounts (Discounts-Drawbacks-Rebates) - print ''; - print ''; - print ''; + print ''; + + // Absolute discounts (Discounts-Drawbacks-Rebates) + print ''; + print ''; + print ''; } - print '
'; - print $langs->trans("CustomerAbsoluteDiscountShort"); - print ''; - if ($user->rights->societe->creer && !$user->societe_id > 0) + // Relative discounts (Discounts-Drawbacks-Rebates) + if ($isCustomer) { - print ''.img_edit($langs->trans("Modify")).''; + print '
'; + print '
'; + print $langs->trans("CustomerRelativeDiscountShort"); + print ''; + if ($user->rights->societe->creer && !$user->societe_id > 0) + { + print ''.img_edit($langs->trans("Modify")).''; + } + print '
'; + print '
'.($object->remise_percent?''.$object->remise_percent.'%':'').'
'; + print ''; + print '
'; + print $langs->trans("CustomerAbsoluteDiscountShort"); + print ''; + if ($user->rights->societe->creer && !$user->societe_id > 0) + { + print ''.img_edit($langs->trans("Modify")).''; + } + print '
'; + print '
'; + $amount_discount=$object->getAvailableDiscounts(); + if ($amount_discount < 0) dol_print_error($db,$object->error); + if ($amount_discount > 0) print ''.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).''; + //else print $langs->trans("DiscountNone"); + print '
'; - print ''; - print ''; - $amount_discount=$object->getAvailableDiscounts(); - if ($amount_discount < 0) dol_print_error($db,$object->error); - if ($amount_discount > 0) print ''.price($amount_discount,1,$langs,1,-1,-1,$conf->currency).''; - //else print $langs->trans("DiscountNone"); - print ''; - print ''; // Max outstanding bill if ($object->client) diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 7cc675b1816..13e4f13ec3d 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -106,7 +106,7 @@ if ($socid > 0) $head = societe_prepare_head($object); - $isCustomer = $object->client == 1 || $object->client == 3; + $isCustomer = ($object->client == 1 || $object->client == 3); $isSupplier = $object->fournisseur == 1; print '
'; @@ -122,7 +122,7 @@ if ($socid > 0) print '
'; - if(! $isCustomer && ! $isSupplier) { + if (! $isCustomer && ! $isSupplier) { print '

'.$langs->trans('ThirdpartyIsNeitherCustomerNorClientSoCannotHaveDiscounts').'

'; dol_fiche_end(); @@ -136,13 +136,13 @@ if ($socid > 0) print ''; - if($isCustomer) { + if ($isCustomer) { // Customer discount print '"; } - if($isSupplier) { + if ($isSupplier) { // Supplier discount print '"; @@ -155,24 +155,27 @@ if ($socid > 0) print '
'; - if($isCustomer && ! $isSupplier) { - print ''; - } - - if(! $isCustomer && $isSupplier) { - print ''; - } + /*if (! ($isCustomer && $isSupplier)) + { + if ($isCustomer && ! $isSupplier) { + print ''; + } + if (! $isCustomer && $isSupplier) { + print ''; + } + }*/ print '
'; print $langs->trans("CustomerRelativeDiscount").''.price2num($object->remise_percent)."%
'; print $langs->trans("SupplierRelativeDiscount").''.price2num($object->remise_supplier_percent)."%
'; - if($isCustomer || $isSupplier) { + if ($isCustomer || $isSupplier) + { // Discount type print ''; } From 786c1140267c6c6977f7c636a7c15b035fa2876c Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 28 Feb 2019 16:13:45 +0100 Subject: [PATCH 23/70] FIX : project_title for display of getNomUrl() --- htdocs/fourn/commande/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index d26c950d4fe..0c0a9d6583b 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -482,7 +482,7 @@ $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " cf.rowid, cf.ref, cf.ref_supplier, cf.fk_statut, cf.billed, cf.total_ht, cf.tva as total_tva, cf.total_ttc, cf.fk_user_author, cf.date_commande as date_commande, cf.date_livraison as date_delivery,"; $sql.= ' cf.date_creation as date_creation, cf.tms as date_update,'; -$sql.= " p.rowid as project_id, p.ref as project_ref,"; +$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_title,"; $sql.= " u.firstname, u.lastname, u.photo, u.login"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); @@ -988,6 +988,7 @@ if ($resql) { $projectstatic->id=$obj->project_id; $projectstatic->ref=$obj->project_ref; + $projectstatic->title=$obj->project_title; print ''; From b96ac794e9f69b1d22690ea4df34c895db7beee7 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Thu, 28 Feb 2019 16:15:32 +0100 Subject: [PATCH 24/70] FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work --- htdocs/core/modules/modAgenda.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 6c8fda578f2..75630b4895a 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -395,7 +395,7 @@ class modAgenda extends DolibarrModules $this->export_TypeFields_array[$r]=array('ac.ref_ext'=>"Text",'ac.datec'=>"Date",'ac.datep'=>"Date", 'ac.datep2'=>"Date",'ac.label'=>"Text",'ac.note'=>"Text",'ac.percent'=>"Numeric", 'ac.durationp'=>"Duree", - 'cac.libelle'=>"List:c_actioncomm:libelle:id", + 'cac.libelle'=>"List:c_actioncomm:libelle:libelle", 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text', 'co.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text', 's.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text'); @@ -417,7 +417,7 @@ 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_end[$r] .=' ORDER BY ac.datep'; + $this->export_sql_order[$r] .=' ORDER BY ac.datep'; } From 3037e4a15730bd5f632f9902df631786123e64bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Mar 2019 20:49:53 +0100 Subject: [PATCH 25/70] Update DolibarrModules.class.php --- htdocs/core/modules/DolibarrModules.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 0140f850e34..9b9ed4f7a60 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -895,6 +895,8 @@ class DolibarrModules // Can not be abstract, because we need to insta { global $conf; + $err = 0; + $sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " AND entity IN (0, ".$conf->entity.")"; @@ -921,6 +923,8 @@ class DolibarrModules // Can not be abstract, because we need to insta { global $conf; + $err = 0; + $sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " AND entity IN (0, ".$conf->entity.")"; From 526bd1d02e28995e5485769f80df60c282c2515d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Mar 2019 17:36:43 +0100 Subject: [PATCH 26/70] Fix number format --- htdocs/product/stock/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 5dca091c56b..cdbc49da21e 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -509,7 +509,7 @@ else print ''; print ''; $totalunit+=$objp->value; From dada8c8ff57ce95538bda83a0074b585dbe5ad1c Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 4 Mar 2019 17:23:29 +0100 Subject: [PATCH 27/70] FIX : wrong redirect link on holiday refuse --- htdocs/holiday/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index be61223d704..b69f6fb185b 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -568,7 +568,7 @@ if ($action == 'confirm_refuse') } } else { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.'&error=NoMotifRefuse'); + header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.'&error=NoMotifRefuse'); exit; } } From 54b9681257171e9c15215290f71295bb09384344 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 4 Mar 2019 20:15:31 +0100 Subject: [PATCH 28/70] More log to help debug --- htdocs/core/login/functions_dolibarr.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 25d5f2dc30c..eede3bf2ee6 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -80,7 +80,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) $cryptType=$conf->global->DATABASE_PWD_ENCRYPTED; // By default, we used MD5 - if (! in_array($cryptType,array('md5'))) $cryptType='md5'; + if (! in_array($cryptType, array('md5'))) $cryptType='md5'; // Check crypted password according to crypt algorithm if ($cryptType == 'md5') { @@ -109,8 +109,9 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= } else { - dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'"); - sleep(2); // Anti brut force protection + dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."', cryptType=".$cryptType); + //dol_syslog("passclear=".$passclear." passtyped=".$passtyped." passcrypted=".$passcrypted); + sleep(2); // Anti brut force protection $langs->load('main'); $langs->load('errors'); $_SESSION["dol_loginmesg"]=$langs->trans("ErrorBadLoginPassword"); From 1bbf6737ecbf48948cb2c70f52a0ab513d2e3455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 5 Mar 2019 15:27:31 +0100 Subject: [PATCH 29/70] add session newtoken --- htdocs/exports/export.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index ec11f9c1771..6888f638a27 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -761,6 +761,7 @@ if ($step == 3 && $datatoexport) // un formulaire en plus pour recuperer les filtres print ''; + print ''; print '
'.$langs->trans('DiscountType').''; if ($isCustomer) { - print ' '; + print ' '; } if ($isSupplier) { - print ' '; + print ' '; } print '
'; if ($obj->project_id > 0) print $projectstatic->getNomUrl(1); print ''.$objp->produit.''; - $valtoshow=price2num($objp->value, 'MS'); + $valtoshow=price(price2num($objp->value, 'MS'), 0, '', 0, 0); // TODO replace with a qty() function print empty($valtoshow)?'0':$valtoshow; print '
'; print ''; print ''; From 0ff29051802d477a47071e75d5ebba9744b48f99 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 6 Mar 2019 12:10:24 +0100 Subject: [PATCH 30/70] FIX : we need to keep originline special_code --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/fourn/facture/card.php | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 309230a4dcc..b0351252c0b 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1386,7 +1386,7 @@ class FactureFournisseur extends CommonInvoice * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='') + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='') { dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type,$fk_unit", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1481,7 +1481,7 @@ class FactureFournisseur extends CommonInvoice $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); - $this->line->special_code=$this->special_code; + $this->line->special_code=!empty($special_code) ? $special_code : $this->special_code; $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index cc9164b753f..3e7df0b27f3 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -716,7 +716,10 @@ if (empty($reshook)) 0, $lines[$i]->array_options, $lines[$i]->fk_unit, - $lines[$i]->id + $lines[$i]->id, + 0, + '', + $lines[$i]->special_code ); if ($result < 0) From 96b8da0d6247fd0d12f77f71ba664e2dc485dee2 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 22:04:01 +0100 Subject: [PATCH 31/70] fix supllier discount --- htdocs/core/tpl/objectline_create.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 61818d4deb9..d598c18a33e 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -268,7 +268,7 @@ else { } else { - $ajaxoptions = array(); + $ajaxoptions = array('update' => array('remise_percent' => 'discount')); $alsoproductwithnosupplierprice=1; } From e3fb228a4d148265945c5a0008019f9534b18221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 12:28:19 +0100 Subject: [PATCH 32/70] Update fournisseur.facture.class.php --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b0351252c0b..4642c0bf753 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1481,7 +1481,7 @@ class FactureFournisseur extends CommonInvoice $this->line->total_localtax1=$total_localtax1; $this->line->total_localtax2=$total_localtax2; $this->line->total_ttc= (($this->type==self::TYPE_CREDIT_NOTE||$qty<0)?-abs($total_ttc):$total_ttc); - $this->line->special_code=!empty($special_code) ? $special_code : $this->special_code; + $this->line->special_code=((string) $special_code != '' ? $special_code : $this->special_code); $this->line->fk_parent_line=$this->fk_parent_line; $this->line->origin=$this->origin; $this->line->origin_id=$origin_id; From 0349f9bfaae2331f818d3c97f7a13aa15af88457 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 13:26:25 +0100 Subject: [PATCH 33/70] Update objectline_create.tpl.php --- htdocs/core/tpl/objectline_create.tpl.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d598c18a33e..73d06b3e0aa 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -260,15 +260,17 @@ else { if ($senderissupplier != 2) { $ajaxoptions=array( - 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with which ajax json response key - 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done - 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) + 'update' => array('qty'=>'qty','remise_percent' => 'discount','idprod' => 'idprod'), // html id tags that will be edited with each ajax json response key + 'option_disabled' => 'idthatdoesnotexists', // html id to disable once select is done + 'warning' => $langs->trans("NoPriceDefinedForThisSupplier") // translation of an error saved into var 'warning' (for exemple shown we select a disabled option into combo) ); $alsoproductwithnosupplierprice=0; } else { - $ajaxoptions = array('update' => array('remise_percent' => 'discount')); + $ajaxoptions = array( + 'update' => array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key + ); $alsoproductwithnosupplierprice=1; } From 9a9fd15077dfe3eacac754f537ffeda956601747 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2019 14:10:33 +0100 Subject: [PATCH 34/70] Fix doxygen --- htdocs/fourn/class/fournisseur.facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index d08e8efd919..3a27690e7ac 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1501,6 +1501,7 @@ class FactureFournisseur extends CommonInvoice * @param int $origin_id id origin document * @param double $pu_ht_devise Amount in currency * @param string $ref_supplier Supplier ref + * @param string $special_code Special code * @return int >0 if OK, <0 if KO */ public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_options=0, $fk_unit=null, $origin_id=0, $pu_ht_devise=0, $ref_supplier='', $special_code='') From d92665753495b317e5b8b05addd35a1f82c316be Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 8 Mar 2019 10:57:14 +0100 Subject: [PATCH 35/70] FIX: Accountancy - Format EBP import Add doc --- .../iso-normes/Accountancy-format_Ebp_txt.pdf | Bin 0 -> 18984 bytes .../class/accountancyexport.class.php | 11 ++++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 dev/resources/iso-normes/Accountancy-format_Ebp_txt.pdf diff --git a/dev/resources/iso-normes/Accountancy-format_Ebp_txt.pdf b/dev/resources/iso-normes/Accountancy-format_Ebp_txt.pdf new file mode 100644 index 0000000000000000000000000000000000000000..24e6fca05e972989f059b0853f8215b3fc1048d8 GIT binary patch literal 18984 zcmeIaby!s07C%l1N+YEr;E>WY3@{AcNJ~jK3?U6eDo810_m9f~POZK6+Ml)7-utX`)}~bulVD+E<;0;~S{@w5!348`0U&^l z;ZqzwKA^0*HO#=?+zn<7U<1km*r41{4&Y+|n2iG{4q#*B-~s{V5qDG&cOVcppd>&G zzyW0kut6X?0s=TNYvXG^fWQ49>HtIjtV0ZDWMd3dFtE3BK-4H|W9evR?Ev5aD%it} z&5htT_5e1pfB;a!+!7A62TE8Pz+pd%0HwsV_(a6T#YCV`5IeU7n45zG$}J`W5)o$; z6BT6_hj5CC3-GavNU(uKAY5#sA|et{4zREox45`Cx0tYqFefJ`ltVxVC}nL7bJ4nP zIT(C>W@3YAA{#+K+7xaE;NrZN$LV`J!9XP&8#sc3{X2y+0v-UEodc-iY6}CZ zE5S^FYFcanFn|q#fdkwgW?+SbX*OqQXpFC~Z>XPlgCKYSAVMw)GDXH95yvmR)BfSc zZC)W?EdP@mR7KwYYC_&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wldWTs7b?(wq&Tpoc50%D)VQ_H^@FD33g|+PFc#R7TcTWQCDMvXM&s_5ZSvP zCD=cnwyb`Hh<9p`N}^sZ?^B#m{TURR8(AnAuP^{b5QQFGbNpy8yNJ8OHLgIidd#ASZ!e literal 0 HcmV?d00001 diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 52b5f1c411f..6cad9372701 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -517,14 +517,19 @@ class AccountancyExport print $line->id . $separator; print $date . $separator; print $line->code_journal . $separator; - print length_accountg($line->numero_compte) . $separator; - print substr(length_accountg($line->numero_compte),0,2) . $separator; + + if (empty($line->subledger_account)) { + print $line->numero_compte . $separator; + } else { + print $line->subledger_account . $separator; + } + //print substr(length_accountg($line->numero_compte),0,2) . $separator; print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $separator; print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$separator; print price2num($line->montant).$separator; print $line->sens.$separator; print $date . $separator; - print 'EUR'; + //print 'EUR'; print $end_line; } } From 233bd4374a3849b6cd575ecc36b78528bbd5caba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2019 19:52:26 +0100 Subject: [PATCH 36/70] Fix phpcs --- htdocs/fourn/class/fournisseur.facture.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4642c0bf753..46c50a75256 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1382,6 +1382,7 @@ class FactureFournisseur extends CommonInvoice * @param int $origin_id id origin document * @param double $pu_ht_devise Amount in currency * @param string $ref_supplier Supplier ref + * @param string $special_code Special code * @return int >0 if OK, <0 if KO * * FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order. From 4022d5f5296746526ea5b6d332764bf6b9884fa2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2019 23:58:04 +0100 Subject: [PATCH 37/70] FIX Can not create contract with numbering module without autogen rule --- htdocs/contrat/class/contrat.class.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index dc94d57809f..2b9de7fc9e2 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -892,6 +892,7 @@ class Contrat extends CommonObject $sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL"); $sql.= ")"; $resql=$this->db->query($sql); + if ($resql) { $error=0; @@ -908,9 +909,8 @@ class Contrat extends CommonObject if ($result > 0) { $modCodeContract = new $module(); - - if (!empty($modCodeContract->code_auto)) { - // Mise a jour ref + if (! empty($modCodeContract->code_auto)) { + // Force the ref to a draft value if numbering module is an automatic numbering $sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; if ($this->db->query($sql)) { @@ -919,9 +919,6 @@ class Contrat extends CommonObject $this->ref="(PROV".$this->id.")"; } } - } else { - $error++; - $this->error='Failed to get PROV number'; } } @@ -1389,7 +1386,7 @@ class Contrat extends CommonObject if (empty($remise_percent)) $remise_percent=0; $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); - + // Clean vat code $vat_src_code=''; if (preg_match('/\((.*)\)/', $txtva, $reg)) @@ -1397,7 +1394,7 @@ class Contrat extends CommonObject $vat_src_code = $reg[1]; $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - + // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker From ab781c32c7bcdf9e5028ae7d0a276a4ec5a4077d Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Mon, 11 Mar 2019 11:19:32 +0100 Subject: [PATCH 38/70] Wrong vat if deposit from propal with multiple vat --- htdocs/compta/facture/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b379bf31602..0f6820e1859 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1196,15 +1196,15 @@ if (empty($reshook)) $qualified=1; if (empty($lines[$i]->qty)) $qualified=0; // We discard qty=0, it is an option if (! empty($lines[$i]->special_code)) $qualified=0; // We discard special_code (frais port, ecotaxe, option, ...) - if ($qualified) $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? + if ($qualified){ + $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? + $tva_tx = $lines[$i]->tva_tx; + $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $valuedeposit) / 100; + } + } - if ($totalamount != 0) { - if ($numlines > 0) $numlines = $numlines-1; - $tva_tx = $lines[$numlines]->tva_tx; - if (! empty($lines[$numlines]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$numlines]->vat_src_code.')'; - $amountdeposit[$tva_tx] = ($totalamount * $valuedeposit) / 100; - } else { + if($totalamount == 0) { $amountdeposit[0] = 0; } } else { @@ -1215,7 +1215,6 @@ if (empty($reshook)) $amount_ttc_diff = $amountdeposit[0]; } - foreach ($amountdeposit as $tva => $amount) { $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); @@ -1226,6 +1225,7 @@ if (empty($reshook)) } elseif ($typeamount=='variable') { $descline.= ' ('. $valuedeposit.'%)'; } + $descline.= ' - '.$srcobject->ref; $result = $object->addline( $descline, From 17647de4ccc1d5f653b11867a5208aed53a587c0 Mon Sep 17 00:00:00 2001 From: Joan Louis Date: Tue, 12 Mar 2019 11:24:54 +0100 Subject: [PATCH 39/70] Fix extrafields calls from cards for Dolibarr 8 See #10803 --- htdocs/comm/propal/card.php | 4 ++-- htdocs/commande/card.php | 4 ++-- htdocs/compta/facture/card.php | 4 ++-- htdocs/compta/facture/fiche-rec.php | 4 ++-- htdocs/contrat/card.php | 4 ++-- htdocs/fichinter/card.php | 6 +++--- htdocs/fourn/commande/card.php | 4 ++-- htdocs/fourn/facture/card.php | 4 ++-- htdocs/supplier_proposal/card.php | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index be5494fbb75..ba68e3324bb 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -751,7 +751,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -1119,7 +1119,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0b0348ee5e0..66f01399183 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -662,7 +662,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -1023,7 +1023,7 @@ if (empty($reshook)) // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield POST Data if (is_array($extralabelsline)) { foreach ($extralabelsline as $key => $value) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6568ac03eba..414a86f4c27 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1682,7 +1682,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -2089,7 +2089,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index fb70da42665..36c1aec55b9 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -453,7 +453,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { @@ -776,7 +776,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); $objectline = new FactureLigneRec($db); if ($objectline->fetch(GETPOST('lineid'))) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5f418cb0568..b681e8147a7 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -456,7 +456,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -737,7 +737,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($objectline->table_element); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); $objectline->array_options=$array_options; // TODO verifier price_min si fk_product et multiprix diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 15b75495c38..24aca7e9dbf 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -362,7 +362,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); $result = $object->addline( $user, @@ -509,7 +509,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); $result=$object->addline( $user, @@ -622,7 +622,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); $objectline->array_options = $array_options; $result = $objectline->update($user); diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 9009364d4b1..41a6d030e16 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -308,7 +308,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -614,7 +614,7 @@ if (empty($reshook)) // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield POST Data if (is_array($extralabelsline)) { foreach ($extralabelsline as $key => $value) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c9715278074..a294cf3c6ad 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1056,7 +1056,7 @@ if (empty($reshook)) // Extrafields Lines $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield POST Data if (is_array($extralabelsline)) { foreach ($extralabelsline as $key => $value) { @@ -1132,7 +1132,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 7b1bf417b40..d7ac16e67ea 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -550,7 +550,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line, $predef); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields @@ -814,7 +814,7 @@ if (empty($reshook)) // Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line); // Unset extrafield if (is_array($extralabelsline)) { // Get extra fields From 36b44b1348f3c401ced793d01b0520ad73d9901e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 12 Mar 2019 11:28:36 +0100 Subject: [PATCH 40/70] FIX: several hooks in shipping/delivery cards --- htdocs/expedition/card.php | 1287 ++++++++++++++++---------------- htdocs/expedition/shipment.php | 276 +++---- htdocs/livraison/card.php | 142 ++-- 3 files changed, 865 insertions(+), 840 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 0f45ca61804..aa85132b243 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1141,448 +1141,455 @@ if ($action == 'create') $line = $object->lines[$indiceAsked]; - // Show product and description - $type=$line->product_type?$line->product_type:$line->fk_product_type; - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($line->date_start)) $type=1; - if (! empty($line->date_end)) $type=1; + $parameters = array('i' => $indiceAsked, 'line' => $line, 'num' => $numAsked); + $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - print ''."\n"; - print ''."\n"; - - // Product label - if ($line->fk_product > 0) // If predefined product + if(empty($reshook)) { - $product->fetch($line->fk_product); - $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch - //var_dump($product->stock_warehouse[1]); + // Show product and description + $type=$line->product_type?$line->product_type:$line->fk_product_type; + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($line->date_start)) $type=1; + if (! empty($line->date_end)) $type=1; - print ''."\n"; - // Show product and description - $product_static->type=$line->fk_product_type; - $product_static->id=$line->fk_product; - $product_static->ref=$line->ref; - $product_static->status_batch=$line->product_tobatch; - $text=$product_static->getNomUrl(1); - $text.= ' - '.(! empty($line->label)?$line->label:$line->product_label); - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc)); - print $form->textwithtooltip($text,$description,3,'','',$i); + // Product label + if ($line->fk_product > 0) // If predefined product + { + $product->fetch($line->fk_product); + $product->load_stock('warehouseopen'); // Load all $product->stock_warehouse[idwarehouse]->detail_batch + //var_dump($product->stock_warehouse[1]); - // Show range - print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); + print ''; - } - else - { - print "\n"; - } - - // Qty - print ''; - $qtyProdCom=$line->qty; - - // Qty already shipped - print ''; - - // Qty to ship - $quantityAsked = $line->qty; - if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $quantityToBeDelivered = 0; - } - else - { - $quantityToBeDelivered = $quantityAsked - $quantityDelivered; - } - $warehouse_id = GETPOST('entrepot_id','int'); - - $warehouseObject = null; - if ($warehouse_id > 0 || ! ($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection - { - print ''; - //ship from preselected location - $stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number - $deliverableQty=min($quantityToBeDelivered, $stock); - if ($deliverableQty < 0) $deliverableQty = 0; - if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) + print ''; + } + else { - // Quantity to send - print ''; + print "'; - } + if (! empty($line->label)) { + $text.= ' '.$line->label.''; + print $form->textwithtooltip($text,$line->desc,3,'','',$i); + } else { + print $text.' '.nl2br($line->desc); + } - print "\n"; + // Show range + print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); + print "\n"; + } - // Show subproducts of product - if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) - { - $product->get_sousproduits_arbo(); - $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); - if(count($prods_arbo) > 0) - { - foreach($prods_arbo as $key => $value) - { - //print $value[0]; - $img=''; - if ($value['stock'] < $value['stock_alert']) - { - $img=img_warning($langs->trans("StockTooLow")); - } - print " - "; - } - } - } + // Qty + print ''; + $qtyProdCom=$line->qty; + + // Qty already shipped + print ''; + + // Qty to ship + $quantityAsked = $line->qty; + if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $quantityToBeDelivered = 0; } else { - // Product need lot - print ''; // end line and start a new one for lot/serial - print ''; + $quantityToBeDelivered = $quantityAsked - $quantityDelivered; + } + $warehouse_id = GETPOST('entrepot_id','int'); - $staticwarehouse=new Entrepot($db); - if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id); - - $subj=0; - // Define nb of lines suggested for this order line - $nbofsuggested=0; - if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) + $warehouseObject = null; + if ($warehouse_id > 0 || ! ($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection + { + print ''; + //ship from preselected location + $stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number + $deliverableQty=min($quantityToBeDelivered, $stock); + if ($deliverableQty < 0) $deliverableQty = 0; + if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) { - foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) - { - $nbofsuggested++; - } - } - print ''; - if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) - { - foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) // $dbatch is instance of Productbatch + // Quantity to send + print ''; - print ''; + if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty=GETPOST('qtyl'.$indiceAsked, 'int'); + print ''; + print ''; + } + else print $langs->trans("NA"); + print ''; - print ''; + // Stock + if (! empty($conf->stock->enabled)) + { print ''; + } + + print "\n"; + + // Show subproducts of product + if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) + { + $product->get_sousproduits_arbo(); + $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); + if(count($prods_arbo) > 0) + { + foreach($prods_arbo as $key => $value) + { + //print $value[0]; + $img=''; + if ($value['stock'] < $value['stock_alert']) + { + $img=img_warning($langs->trans("StockTooLow")); + } + print " + "; + } } - $subj++; - print ''; } } else { - print ''; - print ''; + // Product need lot + print ''; // end line and start a new one for lot/serial + print ''; - print ''; - } - } - } - else - { - // ship from multiple locations - if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) - { - print ''; - print ''."\n"; // end line and start a new one for each warehouse + $staticwarehouse=new Entrepot($db); + if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id); - print ''; - $subj=0; - // Define nb of lines suggested for this order line - $nbofsuggested=0; - foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) - { - if ($stock_warehouse->real > 0) + $subj=0; + // Define nb of lines suggested for this order line + $nbofsuggested=0; + if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) { - $nbofsuggested++; - } - } - $tmpwarehouseObject=new Entrepot($db); - foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock - { - $tmpwarehouseObject->fetch($warehouse_id); - if ($stock_warehouse->real > 0) - { - $stock = + $stock_warehouse->real; // Convert it to number - $deliverableQty = min($quantityToBeDelivered,$stock); - $deliverableQty = max(0, $deliverableQty); - // Quantity to send - print ''; - print ''; - - // Stock - if (! empty($conf->stock->enabled)) - { - print ''; - } - $quantityToBeDelivered -= $deliverableQty; - if ($quantityToBeDelivered < 0) - { - $quantityToBeDelivered = 0; - } - $subj++; - print "\n"; + foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) + { + $nbofsuggested++; + } } - } - // Show subproducts of product (not recommanded) - if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) - { - $product->get_sousproduits_arbo(); - $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); - if (count($prods_arbo) > 0) + print ''; + if (is_object($product->stock_warehouse[$warehouse_id]) && count($product->stock_warehouse[$warehouse_id]->detail_batch)) { - foreach($prods_arbo as $key => $value) - { - //print $value[0]; - $img=''; - if ($value['stock'] < $value['stock_alert']) - { - $img=img_warning($langs->trans("StockTooLow")); - } - print ' - "; - print ""; - } - } - } - } - else - { - print ''; - print ''; // end line and start a new one for lot/serial - - $subj=0; - print ''; - - $tmpwarehouseObject=new Entrepot($db); - $productlotObject=new Productlot($db); - // Define nb of lines suggested for this order line - $nbofsuggested=0; - foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) - { - if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { - foreach ($stock_warehouse->detail_batch as $dbatch) - { - $nbofsuggested++; - } - } - } - foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) - { - $tmpwarehouseObject->fetch($warehouse_id); - if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { - foreach ($stock_warehouse->detail_batch as $dbatch) + foreach ($product->stock_warehouse[$warehouse_id]->detail_batch as $dbatch) // $dbatch is instance of Productbatch { //var_dump($dbatch); $batchStock = + $dbatch->qty; // To get a numeric $deliverableQty = min($quantityToBeDelivered,$batchStock); - if ($deliverableQty < 0) $deliverableQty = 0; - print ''; + print ''; + print ''; print ''; } } - } + else + { + print ''; + print ''; + print ''; + } + } } - if ($subj == 0) // Line not shown yet, we show it + else { - print ''; - print ''; + print ''; + print ''."\n"; // end line and start a new one for each warehouse - print ''; + print ''; + + // Stock + if (! empty($conf->stock->enabled)) + { + print ''; + } + $quantityToBeDelivered -= $deliverableQty; + if ($quantityToBeDelivered < 0) + { + $quantityToBeDelivered = 0; + } + $subj++; + print "\n"; + } + } + // Show subproducts of product (not recommanded) + if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) + { + $product->get_sousproduits_arbo(); + $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); + if (count($prods_arbo) > 0) + { + foreach($prods_arbo as $key => $value) + { + //print $value[0]; + $img=''; + if ($value['stock'] < $value['stock_alert']) + { + $img=img_warning($langs->trans("StockTooLow")); + } + print ' + "; + print ""; + } + } + } } else { - print $langs->trans("Service"); + print ''; + print ''; // end line and start a new one for lot/serial + + $subj=0; + print ''; + + $tmpwarehouseObject=new Entrepot($db); + $productlotObject=new Productlot($db); + // Define nb of lines suggested for this order line + $nbofsuggested=0; + foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) + { + if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { + foreach ($stock_warehouse->detail_batch as $dbatch) + { + $nbofsuggested++; + } + } + } + foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) + { + $tmpwarehouseObject->fetch($warehouse_id); + if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { + foreach ($stock_warehouse->detail_batch as $dbatch) + { + //var_dump($dbatch); + $batchStock = + $dbatch->qty; // To get a numeric + $deliverableQty = min($quantityToBeDelivered,$batchStock); + if ($deliverableQty < 0) $deliverableQty = 0; + print ''; + + print ''; + } + } + } + } - print ''; + if ($subj == 0) // Line not shown yet, we show it + { + print ''; + print ''; + + print ''; + print ''; + } + } + + + //Display lines extrafields + if (is_array($extralabelslines) && count($extralabelslines)>0) + { + $colspan=5; + $orderLineExtrafields = new Extrafields($db); + $orderLineExtrafieldLabels = $orderLineExtrafields->fetch_name_optionals_label($object->table_element_line); + $srcLine = new OrderLine($db); + $srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline + $line = new ExpeditionLigne($db); + //$line->fetch_optionals($line->id); + $line->array_options = array_merge($line->array_options, $srcLine->array_options); + print ''; + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); print ''; } - } - - - //Display lines extrafields - if (is_array($extralabelslines) && count($extralabelslines)>0) - { - $colspan=5; - $orderLineExtrafields = new Extrafields($db); - $orderLineExtrafieldLabels = $orderLineExtrafields->fetch_name_optionals_label($object->table_element_line); - $srcLine = new OrderLine($db); - $srcLine->fetch_optionals($line->id); // fetch extrafields also available in orderline - $line = new ExpeditionLigne($db); - //$line->fetch_optionals($line->id); - $line->array_options = array_merge($line->array_options, $srcLine->array_options); - print ''; - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); - print ''; - } + } $indiceAsked++; } @@ -1986,6 +1993,11 @@ else if ($id || $ref) print ''; } + // Other attributes + $parameters = array('colspan' => ' colspan="3"'); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print "
'.$langs->trans("Entities").'
'; - print ''; // ancre pour retourner sur la ligne + print ''."\n"; + print '
'; + print ''; // ancre pour retourner sur la ligne - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - print ($line->desc && $line->desc!=$line->product_label)?'
'.dol_htmlentitiesbr($line->desc):''; - } + // Show product and description + $product_static->type=$line->fk_product_type; + $product_static->id=$line->fk_product; + $product_static->ref=$line->ref; + $product_static->status_batch=$line->product_tobatch; + $text=$product_static->getNomUrl(1); + $text.= ' - '.(! empty($line->label)?$line->label:$line->product_label); + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc)); + print $form->textwithtooltip($text,$description,3,'','',$i); - print '
"; - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); + // Show range + print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); - if (! empty($line->label)) { - $text.= ' '.$line->label.''; - print $form->textwithtooltip($text,$line->desc,3,'','',$i); - } else { - print $text.' '.nl2br($line->desc); - } + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print ($line->desc && $line->desc!=$line->product_label)?'
'.dol_htmlentitiesbr($line->desc):''; + } - // Show range - print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); - print "
'.$line->qty; - print ''; - print ''; - $quantityDelivered = $object->expeditions[$line->id]; - print $quantityDelivered; - print ''; - print ''; - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty=GETPOST('qtyl'.$indiceAsked, 'int'); - print ''; - print ''; - } - else print $langs->trans("NA"); - print '"; + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); - // Stock - if (! empty($conf->stock->enabled)) - { - print ''; - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Type of product need stock change ? - { - // Show warehouse combo list - $ent = "entl".$indiceAsked; - $idl = "idl".$indiceAsked; - $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):$warehouse_id; - if ($line->fk_product > 0) - { - print ''; - print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1); - if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) - { - //print $stock.' '.$quantityToBeDelivered; - if ($stock < $quantityToBeDelivered) - { - print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for this $warehouse_id but you can change warehouse - } - } - } - } - else - { - print $langs->trans("Service"); - } - print '
      -> - ".$value['fullpath']." - (".$value['nb'].") ".$value['nb_total']."  ".$value['stock']." ".$img."
'.$line->qty; + print ''; + print ''; + $quantityDelivered = $object->expeditions[$line->id]; + print $quantityDelivered; + print ''; + print '
'; + if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - //var_dump($dbatch); - $batchStock = + $dbatch->qty; // To get a numeric - $deliverableQty = min($quantityToBeDelivered,$batchStock); - print '
'; - print ''; - print ''; - - print $staticwarehouse->getNomUrl(0).' / '; - - print ''; - - $detail=''; - $detail.= $langs->trans("Batch").': '.$dbatch->batch; - $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); - $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; - $detail.= '
'; - print $detail; - - $quantityToBeDelivered -= $deliverableQty; - if ($quantityToBeDelivered < 0) + if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Type of product need stock change ? { - $quantityToBeDelivered = 0; + // Show warehouse combo list + $ent = "entl".$indiceAsked; + $idl = "idl".$indiceAsked; + $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):$warehouse_id; + if ($line->fk_product > 0) + { + print ''; + print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 1, 0, $line->fk_product, '', 1); + if ($tmpentrepot_id > 0 && $tmpentrepot_id == $warehouse_id) + { + //print $stock.' '.$quantityToBeDelivered; + if ($stock < $quantityToBeDelivered) + { + print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for this $warehouse_id but you can change warehouse + } + } + } + } + else + { + print $langs->trans("Service"); + } + print '
      -> + ".$value['fullpath']." + (".$value['nb'].") ".$value['nb_total']."  ".$value['stock']." ".$img."
'; - print ' '; - print '
'; - print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle); - print '
'; - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - print ''; - print ''; - } - else print $langs->trans("NA"); - print ''; - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - print $tmpwarehouseObject->getNomUrl(0).' '; - - print ''; - print '('.$stock.')'; - - } - else - { - print $langs->trans("Service"); - } - print '
'; - print "      -> - ".$value['fullpath']." - (".$value['nb'].") ".$value['nb_total']."  ".$value['stock']." ".$img."
'; + print '
'; print ''; print ''; - print $tmpwarehouseObject->getNomUrl(0).' / '; + print $staticwarehouse->getNomUrl(0).' / '; - print ''; print ''; - //print '|'.$line->fk_product.'|'.$dbatch->batch.'|
'; - print $langs->trans("Batch").': '; - $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch); - if ($result > 0) print $productlotObject->getNomUrl(1); - else print 'TableLotIncompleteRunRepairWithParamStandardEqualConfirmed'; - print ' ('.$dbatch->qty.')'; + $detail=''; + $detail.= $langs->trans("Batch").': '.$dbatch->batch; + $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); + $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; + $detail.= '
'; + print $detail; + $quantityToBeDelivered -= $deliverableQty; if ($quantityToBeDelivered < 0) { $quantityToBeDelivered = 0; } - //dol_syslog('deliverableQty = '.$deliverableQty.' batchStock = '.$batchStock); $subj++; print '
'; + print ' '; + print ''; + print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle); + print '
'; - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + // ship from multiple locations + if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) { - $disabled=''; - if (! empty($conf->productbatch->enabled) && $product->hasbatch()) - { - $disabled='disabled="disabled"'; - } - print ' '; - } - else - { - print $langs->trans("NA"); - } - print '
'; - if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $warehouse_selected_id = GETPOST('entrepot_id','int'); - if ($warehouse_selected_id > 0) - { - $warehouseObject=new Entrepot($db); - $warehouseObject->fetch($warehouse_selected_id); - print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle); - } - else - { - if ($line->fk_product) print img_warning().' '.$langs->trans("StockTooLow"); - else print ''; - } + print ''; + $subj=0; + // Define nb of lines suggested for this order line + $nbofsuggested=0; + foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) + { + if ($stock_warehouse->real > 0) + { + $nbofsuggested++; + } + } + $tmpwarehouseObject=new Entrepot($db); + foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) // $stock_warehouse is product_stock + { + $tmpwarehouseObject->fetch($warehouse_id); + if ($stock_warehouse->real > 0) + { + $stock = + $stock_warehouse->real; // Convert it to number + $deliverableQty = min($quantityToBeDelivered,$stock); + $deliverableQty = max(0, $deliverableQty); + // Quantity to send + print '
'; + if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + print ''; + print ''; + } + else print $langs->trans("NA"); + print ''; + if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + print $tmpwarehouseObject->getNomUrl(0).' '; + + print ''; + print '('.$stock.')'; + + } + else + { + print $langs->trans("Service"); + } + print '
'; + print "      -> + ".$value['fullpath']." + (".$value['nb'].") ".$value['nb_total']."  ".$value['stock']." ".$img."
'; + print ''; + print ''; + + print $tmpwarehouseObject->getNomUrl(0).' / '; + + print ''; + print ''; + + //print '|'.$line->fk_product.'|'.$dbatch->batch.'|
'; + print $langs->trans("Batch").': '; + $result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch); + if ($result > 0) print $productlotObject->getNomUrl(1); + else print 'TableLotIncompleteRunRepairWithParamStandardEqualConfirmed'; + print ' ('.$dbatch->qty.')'; + $quantityToBeDelivered -= $deliverableQty; + if ($quantityToBeDelivered < 0) + { + $quantityToBeDelivered = 0; + } + //dol_syslog('deliverableQty = '.$deliverableQty.' batchStock = '.$batchStock); + $subj++; + print '
'; + if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $disabled=''; + if (! empty($conf->productbatch->enabled) && $product->hasbatch()) + { + $disabled='disabled="disabled"'; + } + print ' '; + } + else + { + print $langs->trans("NA"); + } + print ''; + if ($line->product_type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + $warehouse_selected_id = GETPOST('entrepot_id','int'); + if ($warehouse_selected_id > 0) + { + $warehouseObject=new Entrepot($db); + $warehouseObject->fetch($warehouse_selected_id); + print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle); + } + else + { + if ($line->fk_product) print img_warning().' '.$langs->trans("StockTooLow"); + else print ''; + } + } + else + { + print $langs->trans("Service"); + } + print '
"; print ''; @@ -2140,298 +2152,305 @@ else if ($id || $ref) // Loop on each product to send/sent for ($i = 0 ; $i < $num_prod ; $i++) { - print ''; // id of order line - print ''; + $parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => $editColspan, 'outputlangs' => $outputlangs); + $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); + if($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - // # - if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) + if(empty($reshook)) { - print ''.($i+1).''; - } + print ''; // id of order line + print ''; - // Predefined product or service - if ($lines[$i]->fk_product > 0) - { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + // # + if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { - $prod = new Product($db); - $prod->fetch($lines[$i]->fk_product); - $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; + print ''.($i+1).''; + } + + // Predefined product or service + if ($lines[$i]->fk_product > 0) + { + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $prod = new Product($db); + $prod->fetch($lines[$i]->fk_product); + $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; + } + else + $label = (! empty($lines[$i]->label)?$lines[$i]->label:$lines[$i]->product_label); + + print ''; + + // Show product and description + $product_static->type=$lines[$i]->fk_product_type; + $product_static->id=$lines[$i]->fk_product; + $product_static->ref=$lines[$i]->ref; + $product_static->status_batch=$lines[$i]->product_tobatch; + $text=$product_static->getNomUrl(1); + $text.= ' - '.$label; + $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description)); + print $form->textwithtooltip($text,$description,3,'','',$i); + print_date_range($lines[$i]->date_start,$lines[$i]->date_end); + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'
'.dol_htmlentitiesbr($lines[$i]->description):''; + } + print "\n"; } else - $label = (! empty($lines[$i]->label)?$lines[$i]->label:$lines[$i]->product_label); - - print ''; - - // Show product and description - $product_static->type=$lines[$i]->fk_product_type; - $product_static->id=$lines[$i]->fk_product; - $product_static->ref=$lines[$i]->ref; - $product_static->status_batch=$lines[$i]->product_tobatch; - $text=$product_static->getNomUrl(1); - $text.= ' - '.$label; - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->description)); - print $form->textwithtooltip($text,$description,3,'','',$i); - print_date_range($lines[$i]->date_start,$lines[$i]->date_end); - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) { - print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'
'.dol_htmlentitiesbr($lines[$i]->description):''; - } - print "\n"; - } - else - { - print ""; - if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); + print ""; + if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); - if (! empty($lines[$i]->label)) { - $text.= ' '.$lines[$i]->label.''; - print $form->textwithtooltip($text,$lines[$i]->description,3,'','',$i); - } else { - print $text.' '.nl2br($lines[$i]->description); - } - - print_date_range($lines[$i]->date_start,$lines[$i]->date_end); - print "\n"; - } - - // Qty ordered - print ''.$lines[$i]->qty_asked.''; - - // Qty in other shipments (with shipment and warehouse used) - if ($origin && $origin_id > 0) - { - print ''; - foreach ($alreadysent as $key => $val) - { - if ($lines[$i]->fk_origin_line == $key) - { - $j = 0; - foreach($val as $shipmentline_id=> $shipmentline_var) - { - if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) continue; // We want to show only "other shipments" - - $j++; - if ($j > 1) print '
'; - $shipment_static->fetch($shipmentline_var['shipment_id']); - print $shipment_static->getNomUrl(1); - print ' - '.$shipmentline_var['qty_shipped']; - $htmltext=$langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($shipmentline_var['date_valid'], 'dayhour')); - if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) - { - $warehousestatic->fetch($shipmentline_var['warehouse']); - $htmltext .= '
'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1); - } - print ' '.$form->textwithpicto('', $htmltext, 1); - } - } - } - } - print ''; - - if ($action == 'editline' && $lines[$i]->id == $line_id) - { - // edit mode - print ''; - if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) - { - print ''; - $line = new ExpeditionLigne($db); - foreach ($lines[$i]->detail_batch as $detail_batch) - { - print ''; - // Qty to ship or shipped - print ''; - // Batch number managment - if ($lines[$i]->entrepot_id == 0) - { - // only show lot numbers from src warehouse when shipping from multiple warehouses - $line->fetch($detail_batch->fk_expeditiondet); - } - print ''; - print ''; + if (! empty($lines[$i]->label)) { + $text.= ' '.$lines[$i]->label.''; + print $form->textwithtooltip($text,$lines[$i]->description,3,'','',$i); + } else { + print $text.' '.nl2br($lines[$i]->description); } - // add a 0 qty lot row to be able to add a lot - print ''; - // Qty to ship or shipped - print ''; - // Batch number managment - print ''; - print ''; + + print_date_range($lines[$i]->date_start,$lines[$i]->date_end); + print "\n"; } - else if (! empty($conf->stock->enabled)) + + // Qty ordered + print ''; + + // Qty in other shipments (with shipment and warehouse used) + if ($origin && $origin_id > 0) + { + print ''; + + if ($action == 'editline' && $lines[$i]->id == $line_id) { - if ($lines[$i]->fk_product > 0) + // edit mode + print ''; - } - else - { - // Qty to ship or shipped - print ''; - - // Warehouse source - if (! empty($conf->stock->enabled)) - { - print ''; - } - - // Batch number managment - if (! empty($conf->productbatch->enabled)) - { - if (isset($lines[$i]->detail_batch)) - { - print ''; - print ''; - } else { - print ''; - } - } - } - - // Weight - print ''; - - // Volume - print ''; - - // Size - //print ''; - - if ($action == 'editline' && $lines[$i]->id == $line_id) - { - print ''; - print ''; - - // Display lines extrafields - if (! empty($rowExtrafieldsStart)) - { - print $rowExtrafieldsStart; - print $rowExtrafieldsView; - print $rowEnd; - } - } - print ""; - - // Display lines extrafields - if (is_array($extralabelslines) && count($extralabelslines)>0) { - $colspan= empty($conf->productbatch->enabled) ? 5 : 6; - $line = new ExpeditionLigne($db); - $line->fetch_optionals($lines[$i]->id); - print ''; - if ($action == 'editline' && $lines[$i]->id == $line_id) - { - print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); + print '
' . '' . '' . $formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $line->entrepot_id). '
' . '' . '' . $formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product). '
'.$lines[$i]->qty_asked.''; + foreach ($alreadysent as $key => $val) + { + if ($lines[$i]->fk_origin_line == $key) + { + $j = 0; + foreach($val as $shipmentline_id=> $shipmentline_var) + { + if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) continue; // We want to show only "other shipments" + + $j++; + if ($j > 1) print '
'; + $shipment_static->fetch($shipmentline_var['shipment_id']); + print $shipment_static->getNomUrl(1); + print ' - '.$shipmentline_var['qty_shipped']; + $htmltext=$langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($shipmentline_var['date_valid'], 'dayhour')); + if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) + { + $warehousestatic->fetch($shipmentline_var['warehouse']); + $htmltext .= '
'.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1); + } + print ' '.$form->textwithpicto('', $htmltext, 1); + } + } + } + } + print '
'; + if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0) { - if ($lines[$i]->entrepot_id > 0) + print ''; + $line = new ExpeditionLigne($db); + foreach ($lines[$i]->detail_batch as $detail_batch) { - print ''; print ''; // Qty to ship or shipped - print ''; - // Warehouse source - print ''; + print ''; // Batch number managment - print ''; + if ($lines[$i]->entrepot_id == 0) + { + // only show lot numbers from src warehouse when shipping from multiple warehouses + $line->fetch($detail_batch->fk_expeditiondet); + } + print ''; print ''; } - else if (count($lines[$i]->details_entrepot) > 1) + // add a 0 qty lot row to be able to add a lot + print ''; + // Qty to ship or shipped + print ''; + // Batch number managment + print ''; + print ''; + } + else if (! empty($conf->stock->enabled)) + { + if ($lines[$i]->fk_product > 0) { - print ''; - foreach ($lines[$i]->details_entrepot as $detail_entrepot) + if ($lines[$i]->entrepot_id > 0) { + print ''; print ''; // Qty to ship or shipped - print ''; + print ''; // Warehouse source - print ''; + print ''; // Batch number managment print ''; print ''; } + else if (count($lines[$i]->details_entrepot) > 1) + { + print ''; + foreach ($lines[$i]->details_entrepot as $detail_entrepot) + { + print ''; + // Qty to ship or shipped + print ''; + // Warehouse source + print ''; + // Batch number managment + print ''; + print ''; + } + } + else + { + print ''; + print ''; + } } else { - print ''; - print ''; + print ''; + print ''; + // Qty to ship or shipped + print ''; + // Warehouse source + print ''; + // Batch number managment + print ''; + print ''; } } - else - { - print ''; - print ''; - // Qty to ship or shipped - print ''; - // Warehouse source - print ''; - // Batch number managment - print ''; - print ''; - } - } - print '
' . '' . '' . $formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). '' . '' . ' - ' . $langs->trans("NA") . '' . $formproduct->selectLotStock($detail_batch->fk_origin_stock, 'batchl'.$detail_batch->fk_expeditiondet.'_'.$detail_batch->fk_origin_stock, '', 1, 0, $lines[$i]->fk_product, $line->entrepot_id). '
' . '' . '' . $formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product). '
' . '' . '' . '' . '' . $formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1) . '' . $formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). ' - ' . $langs->trans("NA") . '
' . '' . '' . $formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1) . ' - ' . $langs->trans("NA") . '
'.$langs->trans("NotEnoughStock").'
'.$langs->trans("NotEnoughStock").'
' . '' . '' . '' . '
' . '' . '' . '' . '
'.$lines[$i]->qty_shipped.''; - if ($lines[$i]->entrepot_id > 0) - { - $entrepot = new Entrepot($db); - $entrepot->fetch($lines[$i]->entrepot_id); - print $entrepot->getNomUrl(1); - } - else if (count($lines[$i]->details_entrepot) > 1) - { - $detail = ''; - foreach ($lines[$i]->details_entrepot as $detail_entrepot) - { - if ($detail_entrepot->entrepot_id > 0) - { - $entrepot = new Entrepot($db); - $entrepot->fetch($detail_entrepot->entrepot_id); - $detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'
'; - } - } - print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"),$detail); - } - print '
'; - if ($lines[$i]->product_tobatch) - { - $detail = ''; - foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch - { - $detail.= $langs->trans("Batch").': '.$dbatch->batch; - $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); - $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); - $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; - $detail.= '
'; - } - print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); - } - else - { - print $langs->trans("NA"); - } - print '
'; - if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight"); - else print ' '; - print ''; - if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume"); - else print ' '; - print ''.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").''; - print '
'; - print '
'; - } - else if ($object->statut == 0) - { - // edit-delete buttons - print '
'; - print 'id . '">' . img_edit() . ''; - print ''; - print 'id . '">' . img_delete() . ''; - print '
'; } else { - print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); + // Qty to ship or shipped + print ''.$lines[$i]->qty_shipped.''; + + // Warehouse source + if (! empty($conf->stock->enabled)) + { + print ''; + if ($lines[$i]->entrepot_id > 0) + { + $entrepot = new Entrepot($db); + $entrepot->fetch($lines[$i]->entrepot_id); + print $entrepot->getNomUrl(1); + } + else if (count($lines[$i]->details_entrepot) > 1) + { + $detail = ''; + foreach ($lines[$i]->details_entrepot as $detail_entrepot) + { + if ($detail_entrepot->entrepot_id > 0) + { + $entrepot = new Entrepot($db); + $entrepot->fetch($detail_entrepot->entrepot_id); + $detail.= $langs->trans("DetailWarehouseFormat",$entrepot->libelle,$detail_entrepot->qty_shipped).'
'; + } + } + print $form->textwithtooltip(img_picto('', 'object_stock').' '.$langs->trans("DetailWarehouseNumber"),$detail); + } + print ''; + } + + // Batch number managment + if (! empty($conf->productbatch->enabled)) + { + if (isset($lines[$i]->detail_batch)) + { + print ''; + print ''; + if ($lines[$i]->product_tobatch) + { + $detail = ''; + foreach ($lines[$i]->detail_batch as $dbatch) // $dbatch is instance of ExpeditionLineBatch + { + $detail.= $langs->trans("Batch").': '.$dbatch->batch; + $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day"); + $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day"); + $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty; + $detail.= '
'; + } + print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail); + } + else + { + print $langs->trans("NA"); + } + print ''; + } else { + print ''; + } + } + } + + // Weight + print ''; + if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->weight*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->weight_units,"weight"); + else print ' '; + print ''; + + // Volume + print ''; + if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) print $lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume"); + else print ' '; + print ''; + + // Size + //print ''.$lines[$i]->volume*$lines[$i]->qty_shipped.' '.measuring_units_string($lines[$i]->volume_units,"volume").''; + + if ($action == 'editline' && $lines[$i]->id == $line_id) + { + print ''; + print '
'; + print '
'; + } + else if ($object->statut == 0) + { + // edit-delete buttons + print ''; + print 'id . '">' . img_edit() . ''; + print ''; + print ''; + print 'id . '">' . img_delete() . ''; + print ''; + + // Display lines extrafields + if (! empty($rowExtrafieldsStart)) + { + print $rowExtrafieldsStart; + print $rowExtrafieldsView; + print $rowEnd; + } + } + print ""; + + // Display lines extrafields + if (is_array($extralabelslines) && count($extralabelslines)>0) { + $colspan= empty($conf->productbatch->enabled) ? 5 : 6; + $line = new ExpeditionLigne($db); + $line->fetch_optionals($lines[$i]->id); + print ''; + if ($action == 'editline' && $lines[$i]->id == $line_id) + { + print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); + } + else + { + print $line->showOptionals($extrafieldsline, 'view', array('style'=>$bc[$var], 'colspan'=>$colspan),$indiceAsked); + } + print ''; } - print ''; } } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index cb058e44598..bbf990f2ec6 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -42,6 +42,8 @@ if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) requi // Load translation files required by the page $langs->loadLangs(array('orders',"companies","bills",'propal','deliveries','stocks',"productbatch",'incoterm')); +$hookmanager->initHooks(array('ordershipmentcard')); + $id=GETPOST('id','int'); // id of order $ref= GETPOST('ref','alpha'); $action=GETPOST('action','alpha'); @@ -613,6 +615,7 @@ if ($id > 0 || ! empty($ref)) $sql.= " cd.qty,"; $sql.= ' cd.date_start,'; $sql.= ' cd.date_end,'; + $sql.= ' cd.special_code,'; $sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; @@ -648,164 +651,169 @@ if ($id > 0 || ! empty($ref)) { $objp = $db->fetch_object($resql); + $parameters = array('i' => $i, 'line' => $objp, 'num' => $num); + $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - // Show product and description - $type=isset($objp->type)?$objp->type:$objp->product_type; - - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (! empty($objp->date_start)) $type=1; - if (! empty($objp->date_end)) $type=1; - - print ''; - - // Product label - if ($objp->fk_product > 0) + if(empty($reshook)) { - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + // Show product and description + $type=isset($objp->type)?$objp->type:$objp->product_type; + + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($objp->date_start)) $type=1; + if (! empty($objp->date_end)) $type=1; + + print ''; + + // Product label + if ($objp->fk_product > 0) { - $object->fetch_thirdparty(); - - $prod = new Product($db); - $prod->id = $objp->fk_product; - $prod->entity = $objp->entity; - $prod->getMultiLangs(); - - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; - if (! empty($newlang)) + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); + $object->fetch_thirdparty(); + + $prod = new Product($db); + $prod->id = $objp->fk_product; + $prod->entity = $objp->entity; + $prod->getMultiLangs(); + + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; + if (empty($newlang)) $newlang=$object->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; + } + else + $label = (! empty($objp->label)?$objp->label:$objp->product_label); + + print ''; + print ''; // ancre pour retourner sur la ligne + + // Show product and description + $product_static->type=$type; + $product_static->id=$objp->fk_product; + $product_static->ref=$objp->ref; + $product_static->entity = $objp->entity; + $text=$product_static->getNomUrl(1); + $text.= ' - '.$label; + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'
'; + $description.= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); + print $form->textwithtooltip($text,$description,3,'','',$i); + + // Show range + print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); + + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print ($objp->description && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; } - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; + print ''; } else - $label = (! empty($objp->label)?$objp->label:$objp->product_label); - - print ''; - print ''; // ancre pour retourner sur la ligne - - // Show product and description - $product_static->type=$type; - $product_static->id=$objp->fk_product; - $product_static->ref=$objp->ref; - $product_static->entity = $objp->entity; - $text=$product_static->getNomUrl(1); - $text.= ' - '.$label; - $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description)).'
'; - $description.= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80); - print $form->textwithtooltip($text,$description,3,'','',$i); - - // Show range - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); - - // Add description in form - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) { - print ($objp->description && $objp->description!=$objp->product_label)?'
'.dol_htmlentitiesbr($objp->description):''; + print ""; + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + + if (! empty($objp->label)) { + $text.= ' '.$objp->label.''; + print $form->textwithtooltip($text,$objp->description,3,'','',$i); + } else { + print $text.' '.nl2br($objp->description); + } + + // Show range + print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); + print "\n"; } - print ''; - } - else - { - print ""; - if ($type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); + // Qty ordered + print '' . $objp->qty . ''; - if (! empty($objp->label)) { - $text.= ' '.$objp->label.''; - print $form->textwithtooltip($text,$objp->description,3,'','',$i); - } else { - print $text.' '.nl2br($objp->description); - } - - // Show range - print_date_range($db->jdate($objp->date_start),$db->jdate($objp->date_end)); - print "\n"; - } - - // Qty ordered - print '' . $objp->qty . ''; - - // Qty already shipped - $qtyProdCom=$objp->qty; - print ''; - // Nb of sending products for this line of order - $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); - print $qtyAlreadyShipped; - print ''; - - // Qty remains to ship - print ''; - if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; - $toBeShippedTotal += $toBeShipped[$objp->fk_product]; - print $toBeShipped[$objp->fk_product]; - } - else - { - print '0 ('.$langs->trans("Service").')'; - } - print ''; - - if ($objp->fk_product > 0) - { - $product = new Product($db); - $product->fetch($objp->fk_product); - $product->load_stock('warehouseopen'); - } - - if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) && ! empty($conf->stock->enabled)) - { + // Qty already shipped + $qtyProdCom=$objp->qty; print ''; - print $product->stock_reel; - if ($product->stock_reel < $toBeShipped[$objp->fk_product]) + // Nb of sending products for this line of order + $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); + print $qtyAlreadyShipped; + print ''; + + // Qty remains to ship + print ''; + if ($type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - print ' '.img_warning($langs->trans("StockTooLow")); + $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped; + $toBeShippedTotal += $toBeShipped[$objp->fk_product]; + print $toBeShipped[$objp->fk_product]; + } + else + { + print '0 ('.$langs->trans("Service").')'; } print ''; - } - else - { - print ' '; - } - print "\n"; - // Show subproducts lines - if ($objp->fk_product > 0 && ! empty($conf->global->PRODUIT_SOUSPRODUITS)) - { - // Set tree of subproducts in product->sousprods - $product->get_sousproduits_arbo(); - //var_dump($product->sousprods);exit; - - // Define a new tree with quantiies recalculated - $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); - //var_dump($prods_arbo); - if (count($prods_arbo) > 0) + if ($objp->fk_product > 0) { - foreach($prods_arbo as $key => $value) + $product = new Product($db); + $product->fetch($objp->fk_product); + $product->load_stock('warehouseopen'); + } + + if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) && ! empty($conf->stock->enabled)) + { + print ''; + print $product->stock_reel; + if ($product->stock_reel < $toBeShipped[$objp->fk_product]) { - $img=''; - if ($value['stock'] < $value['stock_alert']) + print ' '.img_warning($langs->trans("StockTooLow")); + } + print ''; + } + else + { + print ' '; + } + print "\n"; + + // Show subproducts lines + if ($objp->fk_product > 0 && ! empty($conf->global->PRODUIT_SOUSPRODUITS)) + { + // Set tree of subproducts in product->sousprods + $product->get_sousproduits_arbo(); + //var_dump($product->sousprods);exit; + + // Define a new tree with quantiies recalculated + $prods_arbo = $product->get_arbo_each_prod($qtyProdCom); + //var_dump($prods_arbo); + if (count($prods_arbo) > 0) + { + foreach($prods_arbo as $key => $value) { - $img=img_warning($langs->trans("StockTooLow")); + $img=''; + if ($value['stock'] < $value['stock_alert']) + { + $img=img_warning($langs->trans("StockTooLow")); + } + print '      -> '.$value['fullpath'].' ('.$value['nb'].')'; + print ' '.$value['nb_total'].''; + print ' '; + print ' '; + print ''.$value['stock'].' '.$img.''."\n"; } - print '      -> '.$value['fullpath'].' ('.$value['nb'].')'; - print ' '.$value['nb_total'].''; - print ' '; - print ' '; - print ''.$value['stock'].' '.$img.''."\n"; } } } - $i++; } $db->free($resql); diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index d6cefb24d83..2e1c9cb47c1 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -346,7 +346,7 @@ else print ''; print ''; - dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending'); + dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), -1, 'sending'); /* * Confirmation de la suppression @@ -607,87 +607,85 @@ else $var=true; while ($i < $num_prod) { + $parameters = array('i' => $i, 'line' => $object->lines[$i], 'num' => $num_prod); + $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + if(empty($reshook)) { - print ''; - if ($object->lines[$i]->fk_product > 0) - { - $product = new Product($db); - $product->fetch($object->lines[$i]->fk_product); + print ''; + if ($object->lines[$i]->fk_product > 0) { + $product = new Product($db); + $product->fetch($object->lines[$i]->fk_product); - // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) - { - $outputlangs = $langs; - $newlang=''; - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); + // Define output language + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + $outputlangs = $langs; + $newlang = ''; + if (empty($newlang) && !empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + + $label = (!empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $object->lines[$i]->product_label; + } else + $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : $object->lines[$i]->product_label); + + print ''; + + // Affiche ligne produit + $text = ''; + if ($object->lines[$i]->fk_product_type == 1) $text .= img_object($langs->trans('ShowService'), 'service'); + else $text .= img_object($langs->trans('ShowProduct'), 'product'); + $text .= ' ' . $object->lines[$i]->product_ref . ''; + $text .= ' - ' . $label; + $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($object->lines[$i]->description)); + //print $description; + print $form->textwithtooltip($text, $description, 3, '', '', $i); + print_date_range($object->lines[$i]->date_start, $object->lines[$i]->date_end); + if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) { + print (!empty($object->lines[$i]->description) && $object->lines[$i]->description != $object->lines[$i]->product_label) ? '
' . dol_htmlentitiesbr($object->lines[$i]->description) : ''; + } + } else { + print ""; + if ($object->lines[$i]->fk_product_type == 1) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); + + if (!empty($object->lines[$i]->label)) { + $text .= ' ' . $object->lines[$i]->label . ''; + print $form->textwithtooltip($text, $object->lines[$i]->description, 3, '', '', $i); + } else { + print $text . ' ' . nl2br($object->lines[$i]->description); } - $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $object->lines[$i]->product_label; - } - else - $label = ( ! empty($object->lines[$i]->label)?$object->lines[$i]->label:$object->lines[$i]->product_label); - - print ''; - - // Affiche ligne produit - $text = ''; - if ($object->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service'); - else $text.= img_object($langs->trans('ShowProduct'),'product'); - $text.= ' '.$object->lines[$i]->product_ref.''; - $text.= ' - '.$label; - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($object->lines[$i]->description)); - //print $description; - print $form->textwithtooltip($text,$description,3,'','',$i); - print_date_range($object->lines[$i]->date_start,$object->lines[$i]->date_end); - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) - { - print (! empty($object->lines[$i]->description) && $object->lines[$i]->description!=$object->lines[$i]->product_label)?'
'.dol_htmlentitiesbr($object->lines[$i]->description):''; - } - } - else - { - print ""; - if ($object->lines[$i]->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); - else $text = img_object($langs->trans('Product'),'product'); - - if (! empty($object->lines[$i]->label)) { - $text.= ' '.$object->lines[$i]->label.''; - print $form->textwithtooltip($text,$object->lines[$i]->description,3,'','',$i); - } else { - print $text.' '.nl2br($object->lines[$i]->description); + print_date_range($objp->date_start, $objp->date_end); + print "\n"; } - print_date_range($objp->date_start,$objp->date_end); - print "\n"; - } + print '' . $object->lines[$i]->qty_asked . ''; + print '' . $object->lines[$i]->qty_shipped . ''; - print ''.$object->lines[$i]->qty_asked.''; - print ''.$object->lines[$i]->qty_shipped.''; + print ""; - print ""; - - //Display lines extrafields - if (is_array($extralabelslines) && count($extralabelslines)>0) { - $colspan=2; - $mode = ($object->statut == 0) ? 'edit' : 'view'; - $line = new LivraisonLigne($db); - $line->fetch_optionals($object->lines[$i]->id); - if ($action = 'create_delivery') { - $srcLine = new ExpeditionLigne($db); - $expeditionLineExtrafields = new Extrafields($db); - $expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element); - $srcLine->fetch_optionals($expedition->lines[$i]->id); - $line->array_options = array_merge($line->array_options, $srcLine->array_options); + //Display lines extrafields + if (is_array($extralabelslines) && count($extralabelslines) > 0) { + $colspan = 2; + $mode = ($object->statut == 0) ? 'edit' : 'view'; + $line = new LivraisonLigne($db); + $line->fetch_optionals($object->lines[$i]->id); + if ($action = 'create_delivery') { + $srcLine = new ExpeditionLigne($db); + $expeditionLineExtrafields = new Extrafields($db); + $expeditionLineExtrafieldLabels = $expeditionLineExtrafields->fetch_name_optionals_label($srcLine->table_element); + $srcLine->fetch_optionals($expedition->lines[$i]->id); + $line->array_options = array_merge($line->array_options, $srcLine->array_options); + } + print ''; + print $line->showOptionals($extrafieldsline, $mode, array('style' => $bc[$var], 'colspan' => $colspan), $i); + print ''; } - print ''; - print $line->showOptionals($extrafieldsline, $mode, array('style'=>$bc[$var], 'colspan'=>$colspan),$i); - print ''; } $i++; From a524bbc5c692523fe6fcfdb1ab609b21adbf5ef2 Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 13 Mar 2019 15:58:58 +0100 Subject: [PATCH 41/70] FIX : when we create deposit with multi tva, we mustn't add line if amount = 0 (example when we have a 100% reduc on one of origin invoice line) --- htdocs/compta/facture/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b379bf31602..dcf167da515 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1218,6 +1218,9 @@ if (empty($reshook)) foreach ($amountdeposit as $tva => $amount) { + + if(empty($amount)) continue; + $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); $descline = $langs->trans('Deposit'); $descline.= ' - '.$langs->trans($arraylist[$typeamount]); From 885797b748ee286e30ecf1066e69bc544034de43 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 14 Mar 2019 17:00:51 +0100 Subject: [PATCH 42/70] FIX : useless join --- htdocs/hrm/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 5b3548cc8fb..5c523640033 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -299,7 +299,7 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut, u.photo, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = x.fk_user_author"; $sql.= " AND x.entity = ".$conf->entity; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND x.fk_user_author IN ('.join(',',$childids).')'; From 3fb6978bc8c288deaabfb2f6228351d1204ec7a2 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 14 Mar 2019 17:36:49 +0100 Subject: [PATCH 43/70] FIX : no need to test anything to display documents tabs on expense report --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index c204809e9a1..9162676795c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -382,7 +382,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh $checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet','project'); // Test for project object $checktask = array('projet_task'); - $nocheck = array('barcode','stock'); // No test + $nocheck = array('barcode','stock','expensereport'); // No test $checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...). // If dbtablename not defined, we use same name for table than module name From 8375b47e743fab913332e027513f7e7d73e7aa48 Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 15 Mar 2019 10:21:50 +0100 Subject: [PATCH 44/70] FIX : in fact expensereport must be in $check array --- htdocs/core/lib/security.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 9162676795c..50f6e516a9f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -377,12 +377,12 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh if ($feature == 'project') $feature='projet'; if ($feature == 'task') $feature='projet_task'; - $check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company) + $check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie','expensereport'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object $checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkproject = array('projet','project'); // Test for project object $checktask = array('projet_task'); - $nocheck = array('barcode','stock','expensereport'); // No test + $nocheck = array('barcode','stock'); // No test $checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...). // If dbtablename not defined, we use same name for table than module name From 2da60fb885cbdfbd0f0ec3fdf4d8277b4b41225b Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 15 Mar 2019 15:15:03 +0100 Subject: [PATCH 45/70] Fix var name --- htdocs/projet/activity/perday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 89ed60a0632..164a7462e83 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -498,7 +498,7 @@ $holiday = new Holiday($db); $isavailable=array(); $statusofholidaytocheck = '3'; -$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholiday); // $daytoparse is a date with hours = 0 +$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0 $isavailable[$daytoparse]=$isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day if (count($tasksarray) > 0) From b33c366b0227f9f185a9664b4eea55fb3045c802 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 15 Mar 2019 19:16:49 +0100 Subject: [PATCH 46/70] Update card.php --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index dcf167da515..43f727a7ae8 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1218,8 +1218,7 @@ if (empty($reshook)) foreach ($amountdeposit as $tva => $amount) { - - if(empty($amount)) continue; + if (empty($amount)) continue; $arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount'); $descline = $langs->trans('Deposit'); From 68945c7d518dfe27e4cc9ca1a522b02eeca2742f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 16 Mar 2019 09:10:25 +0100 Subject: [PATCH 47/70] Fix #10177 --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 7fd461000ef..76d627249eb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -973,7 +973,7 @@ else $object->idprof6 = GETPOST('idprof6', 'alpha'); $object->typent_id = GETPOST('typent_id', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->civility_id = GETPOST('civility_id', 'int'); + $object->civility_id = GETPOST('civility_id', 'alpha'); $object->tva_assuj = GETPOST('assujtva_value', 'int'); $object->status = GETPOST('status', 'int'); From 21e2d364219b5df2faf78c018246213827fcea0f Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 16 Mar 2019 09:28:47 +0100 Subject: [PATCH 48/70] Fix #9311 --- htdocs/fourn/facture/rapport.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index c20b26b1263..b2126aae80b 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -26,6 +26,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/rapport/pdf_paiement_fourn.class.p require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +$langs->loadLangs(array('bills')); + // Security check $socid=''; if (! empty($user->societe_id)) $socid=$user->societe_id; From 46b39dd6a97bd802cb97059f4e43060efaa51cf9 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sat, 16 Mar 2019 18:13:43 +0100 Subject: [PATCH 49/70] Fix #9961 : deal with supplier credit note refund like with customers --- htdocs/fourn/facture/paiement.php | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 8a87d4903a1..57ca70dfa98 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -71,7 +71,7 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="p.rowid"; $optioncss = GETPOST('optioncss','alpha'); -$amounts = array();array(); +$amounts = array(); $amountsresttopay=array(); $addwarning=0; @@ -251,6 +251,22 @@ if (empty($reshook)) $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + // Clean parameters amount if payment is for a credit note + if (GETPOST('type') == FactureFournisseur::TYPE_CREDIT_NOTE) + { + foreach ($amounts as $key => $value) // How payment is dispatch + { + $newvalue = price2num($value,'MT'); + $amounts[$key] = -$newvalue; + } + + foreach ($multicurrency_amounts as $key => $value) // How payment is dispatch + { + $newvalue = price2num($value,'MT'); + $multicurrency_amounts[$key] = -$newvalue; + } + } + if (! $error) { $db->begin(); @@ -431,6 +447,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; + print ''; print ''; dol_fiche_head(null); @@ -600,14 +617,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; } - print ''.price($objp->total_ttc).''; + print ''.price($sign * $objp->total_ttc).''; - print ''.price($objp->am); + print ''.price($sign * $objp->am); if ($creditnotes) print '+'.price($creditnotes); if ($deposits) print '+'.price($deposits); print ''; - print ''.price($remaintopay).''; + print ''.price($sign * $remaintopay).''; // Amount print ''; From 57091f08b0da5735676ddc54445405fcabaec222 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 18 Mar 2019 10:53:43 +0100 Subject: [PATCH 50/70] FIX missing entity filter and wrong var name --- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/class/html.form.class.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a6e979cdd10..d303e6edf21 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1605,7 +1605,7 @@ class Facture extends CommonInvoice $sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").","; $sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).","; $sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).","; - $sql.= " situation_final=".(empty($this->situation_counter)?"0":$this->db->escape($this->situation_counter)); + $sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final)); $sql.= " WHERE rowid=".$this->id; $this->db->begin(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c451a83a4fb..8f0af0a5004 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3324,7 +3324,10 @@ class Form $langs->load('bills'); $opt = ''; - $sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1'; + $sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc'; + $sql.= ' FROM ' . MAIN_DB_PREFIX . 'facture'; + $sql.= ' WHERE entity IN ('.getEntity('facture').')'; + $sql.= ' AND situation_counter>=1'; $sql.= ' ORDER by situation_cycle_ref, situation_counter desc'; $resql = $this->db->query($sql); if ($resql && $this->db->num_rows($resql) > 0) { From 4c85068a85e533e333c45c814c647346cf33aa29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2019 11:53:04 +0100 Subject: [PATCH 51/70] FIX Can't insert if there is extrafields mandatory on another entity. --- htdocs/core/class/commonobject.class.php | 17 +++++++++++++++-- htdocs/core/class/extrafields.class.php | 16 +++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d8d27a0378a..77e0a557c5d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4979,8 +4979,9 @@ abstract class CommonObject $table_element = $this->table_element; if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility + dol_syslog(get_class($this)."::insertExtraFields delete then insert", LOG_DEBUG); + $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$table_element."_extrafields WHERE fk_object = ".$this->id; - dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); $this->db->query($sql_del); $sql = "INSERT INTO ".MAIN_DB_PREFIX.$table_element."_extrafields (fk_object"; @@ -4991,6 +4992,11 @@ abstract class CommonObject if ($extrafields->attributes[$this->table_element]['type'][$attributeKey] != 'separate') // Only for other type than separator $sql.=",".$attributeKey; } + // We must insert a default value for fields for other entities that are mandatory to avoid not null error + foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + { + $sql.=",".$tmpkey; + } $sql .= ") VALUES (".$this->id; foreach($new_array_options as $key => $value) @@ -5009,10 +5015,17 @@ abstract class CommonObject } } } + // We must insert a default value for fields for other entities that are mandatory to avoid not null error + foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + { + if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; + else $sql.=", ''"; + } + $sql.=")"; - dol_syslog(get_class($this)."::insertExtraFields insert", LOG_DEBUG); $resql = $this->db->query($sql); + if (! $resql) { $this->error=$this->db->lasterror(); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 48eabbefe9e..679352dde06 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -747,7 +747,7 @@ class ExtraFields * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required. * @return array Array of attributes keys+label for all extra fields. */ - function fetch_name_optionals_label($elementtype,$forceload=false) + function fetch_name_optionals_label($elementtype, $forceload=false) { global $conf; @@ -783,8 +783,8 @@ class ExtraFields $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity,enabled"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; - $sql.= " WHERE entity IN (0,".$conf->entity.")"; - if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element + //$sql.= " WHERE entity IN (0,".$conf->entity.")"; // Filter is done later + if ($elementtype) $sql.= " WHERE elementtype = '".$elementtype."'"; // Filed with object->table_element $sql.= " ORDER BY pos"; $resql=$this->db->query($sql); @@ -794,6 +794,16 @@ class ExtraFields { while ($tab = $this->db->fetch_object($resql)) { + if ($tab->entity != 0 && $tab->entity != $conf->entity) + { + // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field + if ($tab->fieldrequired) + { + $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type; + } + continue; + } + // We can add this attribute to object. TODO Remove this and return $this->attributes[$elementtype]['label'] if ($tab->type != 'separate') { From 032aa869e4124a4bee4752303690ba4090f0f82d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2019 11:54:14 +0100 Subject: [PATCH 52/70] FIX Can't insert if there is extrafields mandatory on another entity. FIX Can't set default value of extrafield of type varchar --- htdocs/core/class/commonobject.class.php | 16 +++++++++++----- htdocs/core/class/extrafields.class.php | 2 +- htdocs/core/db/mysqli.class.php | 2 +- htdocs/core/db/pgsql.class.php | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 77e0a557c5d..90bd03513fe 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4993,9 +4993,12 @@ abstract class CommonObject $sql.=",".$attributeKey; } // We must insert a default value for fields for other entities that are mandatory to avoid not null error - foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + if (is_array($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'])) { - $sql.=",".$tmpkey; + foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + { + $sql.=",".$tmpkey; + } } $sql .= ") VALUES (".$this->id; @@ -5016,10 +5019,13 @@ abstract class CommonObject } } // We must insert a default value for fields for other entities that are mandatory to avoid not null error - foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + if (is_array($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'])) { - if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; - else $sql.=", ''"; + foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) + { + if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; + else $sql.=", ''"; + } } $sql.=")"; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 679352dde06..6e92509756f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -797,7 +797,7 @@ class ExtraFields if ($tab->entity != 0 && $tab->entity != $conf->entity) { // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field - if ($tab->fieldrequired) + if ($tab->fieldrequired && is_null($tab->fielddefault)) { $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 23c19542ae6..738be0b2d86 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -835,7 +835,7 @@ class DoliDBMysqli extends DoliDB if ($field_desc['default'] != '') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']); - elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields + elseif ($field_desc['type'] != 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } dol_syslog(get_class($this)."::DDLUpdateField ".$sql,LOG_DEBUG); diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 3d365142a0a..ffbabc24d79 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -1138,7 +1138,7 @@ class DoliDBPgsql extends DoliDB if ($field_desc['default'] != '') { if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') $sql.=" DEFAULT ".$this->escape($field_desc['default']); - elseif ($field_desc['type'] == 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields + elseif ($field_desc['type'] != 'text') $sql.=" DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields } dol_syslog($sql,LOG_DEBUG); From a1fe1bb58c60ea1ff545c7e9362d9dbd8b87d11d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Mar 2019 12:33:39 +0100 Subject: [PATCH 53/70] FIX when 2 extra fields are mandatory in 2 different entities --- htdocs/core/class/commonobject.class.php | 12 +++++++++--- htdocs/core/class/extrafields.class.php | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 90bd03513fe..f0fe7bf437c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4997,7 +4997,10 @@ abstract class CommonObject { foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) { - $sql.=",".$tmpkey; + if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously + { + $sql.=",".$tmpkey; + } } } $sql .= ") VALUES (".$this->id; @@ -5023,8 +5026,11 @@ abstract class CommonObject { foreach($extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] as $tmpkey => $tmpval) { - if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; - else $sql.=", ''"; + if (! isset($extrafields->attributes[$this->table_element]['type'][$tmpkey])) // If field not already added previously + { + if (in_array($tmpval, array('int', 'double'))) $sql.=", 0"; + else $sql.=", ''"; + } } } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6e92509756f..6babf6709d8 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -796,7 +796,7 @@ class ExtraFields { if ($tab->entity != 0 && $tab->entity != $conf->entity) { - // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field + // This field is not in current entity. We discard but before we save it into the array of mandatory fields if it is a mandatory field without default value if ($tab->fieldrequired && is_null($tab->fielddefault)) { $this->attributes[$tab->elementtype]['mandatoryfieldsofotherentities'][$tab->name]=$tab->type; From d10b94e72be2a1b58a901bb98dd26b7fc2eb4af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Mar 2019 14:08:49 +0100 Subject: [PATCH 54/70] Update extrafields.class.php --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 6babf6709d8..f8ae333935e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1525,7 +1525,7 @@ class ExtraFields } elseif ($type == 'phone') { - $value=dol_print_phone($value, '', 0, 0, '', ' ', 1); + $value=dol_print_phone($value, '', 0, 0, '', ' ', 'phone'); } elseif ($type == 'price') { From f37c1b928795cc78cd91d88ab166a818fcae35bb Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 22 Mar 2019 09:28:50 +0100 Subject: [PATCH 55/70] FIX: The minimum amount filter does not work in the VAT report per customer --- htdocs/compta/tva/clients.php | 535 +++++++++++++++++----------------- 1 file changed, 261 insertions(+), 274 deletions(-) diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index ae95d71ca9c..f09ee172a40 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -372,161 +372,156 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $subtot_coll_total_ht = 0; $subtot_coll_vat = 0; - if (is_array($x_both[$thirdparty_id]['coll']['detail'])) - { + if ($min == 0 || ($min > 0 && $x_both[$thirdparty_id]['coll']['totalht'] > $min)) { - // VAT Rate - print ""; - print ''; - if (is_numeric($thirdparty_id)) - { - $company_static->fetch($thirdparty_id); - print $langs->trans("ThirdParty").': '.$company_static->getNomUrl(1); - } - else - { - $tmpid = preg_replace('/userid_/','',$thirdparty_id); - $user_static->fetch($tmpid); - print $langs->trans("User").': '.$user_static->getNomUrl(1); - } - print ''; - print ''."\n"; + if (is_array($x_both[$thirdparty_id]['coll']['detail'])) { - foreach ($x_both[$thirdparty_id]['coll']['detail'] as $index => $fields) { - // Define type - // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. - $type=(isset($fields['dtype'])?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (!empty($fields['ddate_start'])) { - $type=1; - } - if (!empty($fields['ddate_end'])) { - $type=1; + // VAT Rate + print ""; + print ''; + if (is_numeric($thirdparty_id)) { + $company_static->fetch($thirdparty_id); + print $langs->trans("ThirdParty") . ': ' . $company_static->getNomUrl(1); + } else { + $tmpid = preg_replace('/userid_/', '', $thirdparty_id); + $user_static->fetch($tmpid); + print $langs->trans("User") . ': ' . $user_static->getNomUrl(1); } + print ''; + print '' . "\n"; - - print ''; - - // Ref - print ''.$fields['link'].''; - - // Invoice date - print '' . dol_print_date($fields['datef'], 'day') . ''; - - // Payment date - if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '' . dol_print_date($fields['datep'], 'day') . ''; - else print ''; - - // Rate - print '' . $fields['drate'] . ''; - - // Description - print ''; - if ($fields['pid']) - { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['dtype']; // We force with the type of line to have type how line is registered - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) { - print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),24); + foreach ($x_both[$thirdparty_id]['coll']['detail'] as $index => $fields) { + // Define type + // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. + $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (!empty($fields['ddate_start'])) { + $type = 1; } - } - else - { - if ($type) { - $text = img_object($langs->trans('Service'),'service'); + if (!empty($fields['ddate_end'])) { + $type = 1; + } + + + print ''; + + // Ref + print '' . $fields['link'] . ''; + + // Invoice date + print '' . dol_print_date($fields['datef'], 'day') . ''; + + // Payment date + if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') { + print '' . dol_print_date($fields['datep'], 'day') . ''; } else { - $text = img_object($langs->trans('Product'),'product'); + print ''; } - if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) { - if ($reg[1]=='DEPOSIT') { - $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); - } elseif ($reg[1]=='CREDIT_NOTE') { - $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); + + // Rate + print '' . $fields['drate'] . ''; + + // Description + print ''; + if ($fields['pid']) { + $product_static->id = $fields['pid']; + $product_static->ref = $fields['pref']; + $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) { + print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); + } + } else { + if ($type) { + $text = img_object($langs->trans('Service'), 'service'); } else { - $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); + $text = img_object($langs->trans('Product'), 'product'); } - } - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),24); + if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { + if ($reg[1] == 'DEPOSIT') { + $fields['descr'] = $langs->transnoentitiesnoconv('Deposit'); + } elseif ($reg[1] == 'CREDIT_NOTE') { + $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote'); + } else { + $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]); + } + } + print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); - // Show range - print_date_range($fields['ddate_start'],$fields['ddate_end']); - } - print ''; - - // Total HT - if ($modetax != 1) - { - print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; + // Show range + print_date_range($fields['ddate_start'], $fields['ddate_end']); } print ''; - } - // Payment - $ratiopaymentinvoice=1; - if ($modetax != 1) - { + // Total HT + if ($modetax != 1) { + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + } + + // Payment + $ratiopaymentinvoice = 1; + if ($modetax != 1) { + print ''; + //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) { + $payment_static->id = $fields['payment_id']; + print $payment_static->getNomUrl(2); + } + if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') + || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) { + print $langs->trans("NA"); + } else { + if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { + $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + } + print price(price2num($fields['payment_amount'], 'MT')); + if (isset($fields['payment_amount'])) { + print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)'; + } + } + print ''; + } + + // Total collected print ''; - //print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc']; - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $payment_static->id=$fields['payment_id']; - print $payment_static->getNomUrl(2); - } - if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') - || ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')) - { - print $langs->trans("NA"); - } else { - if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) { - $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - } - print price(price2num($fields['payment_amount'],'MT')); - if (isset($fields['payment_amount'])) { - print ' ('.round($ratiopaymentinvoice*100,2).'%)'; - } - } + $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + print price(price2num($temp_ht, 'MT'), 1); print ''; + + // VAT + print ''; + $temp_vat = $fields['vat'] * $ratiopaymentinvoice; + print price(price2num($temp_vat, 'MT'), 1); + //print price($fields['vat']); + print ''; + print ''; + + $subtot_coll_total_ht += $temp_ht; + $subtot_coll_vat += $temp_vat; + $x_coll_sum += $temp_vat; } - // Total collected - print ''; - $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht,'MT'),1); - print ''; - - // VAT - print ''; - $temp_vat=$fields['vat']*$ratiopaymentinvoice; - print price(price2num($temp_vat,'MT'),1); - //print price($fields['vat']); - print ''; - print ''; - - $subtot_coll_total_ht += $temp_ht; - $subtot_coll_vat += $temp_vat; - $x_coll_sum += $temp_vat; } + // Total customers for this vat rate + print ''; + print ''; + print '' . $langs->trans("Total") . ':'; + if ($modetax != 1) { + print ' '; + print ' '; + } + print '' . price(price2num($subtot_coll_total_ht, 'MT')) . ''; + print '' . price(price2num($subtot_coll_vat, 'MT')) . ''; + print ''; } - // Total customers for this vat rate - print ''; - print ''; - print ''.$langs->trans("Total").':'; - if ($modetax != 1) { - print ' '; - print ' '; - } - print ''.price(price2num($subtot_coll_total_ht,'MT')).''; - print ''.price(price2num($subtot_coll_vat,'MT')).''; - print ''; } if (count($x_coll) == 0) // Show a total ine if nothing shown @@ -567,161 +562,153 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $subtot_paye_total_ht = 0; $subtot_paye_vat = 0; - if (is_array($x_both[$thirdparty_id]['paye']['detail'])) - { - print ""; - print ''; - if (is_numeric($thirdparty_id)) - { - $company_static->fetch($thirdparty_id); - print $langs->trans("ThirdParty").': '.$company_static->getNomUrl(1); - } - else - { - $tmpid = preg_replace('/userid_/','',$thirdparty_id); - $user_static->fetch($tmpid); - print $langs->trans("User").': '.$user_static->getNomUrl(1); - } - print ''; - print ''."\n"; + if ($min == 0 || ($min > 0 && $x_both[$thirdparty_id]['paye']['totalht'] > $min)) { - foreach ($x_both[$thirdparty_id]['paye']['detail'] as $index=>$fields) { - // Define type - // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. - $type=(isset($fields['dtype'])?$fields['dtype']:$fields['ptype']); - // Try to enhance type detection using date_start and date_end for free lines where type - // was not saved. - if (!empty($fields['ddate_start'])) { - $type=1; - } - if (!empty($fields['ddate_end'])) { - $type=1; + if (is_array($x_both[$thirdparty_id]['paye']['detail'])) { + print ""; + print ''; + if (is_numeric($thirdparty_id)) { + $company_static->fetch($thirdparty_id); + print $langs->trans("ThirdParty") . ': ' . $company_static->getNomUrl(1); + } else { + $tmpid = preg_replace('/userid_/', '', $thirdparty_id); + $user_static->fetch($tmpid); + print $langs->trans("User") . ': ' . $user_static->getNomUrl(1); } + print ''; + print '' . "\n"; - - print ''; - - // Ref - print ''.$fields['link'].''; - - // Invoice date - print '' . dol_print_date($fields['datef'], 'day') . ''; - - // Payment date - if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '' . dol_print_date($fields['datep'], 'day') . ''; - else print ''; - - // Company name - print '' . $fields['company_link'] . ''; - - // Description - print ''; - if ($fields['pid']) - { - $product_static->id=$fields['pid']; - $product_static->ref=$fields['pref']; - $product_static->type=$fields['dtype']; // We force with the type of line to have type how line is registered - print $product_static->getNomUrl(1); - if (dol_string_nohtmltag($fields['descr'])) { - print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),24); + foreach ($x_both[$thirdparty_id]['paye']['detail'] as $index => $fields) { + // Define type + // We MUST use dtype (type in line). We can use something else, only if dtype is really unknown. + $type = (isset($fields['dtype']) ? $fields['dtype'] : $fields['ptype']); + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (!empty($fields['ddate_start'])) { + $type = 1; } - } - else - { - if ($type) { - $text = img_object($langs->trans('Service'),'service'); + if (!empty($fields['ddate_end'])) { + $type = 1; + } + + + print ''; + + // Ref + print '' . $fields['link'] . ''; + + // Invoice date + print '' . dol_print_date($fields['datef'], 'day') . ''; + + // Payment date + if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') { + print '' . dol_print_date($fields['datep'], 'day') . ''; } else { - $text = img_object($langs->trans('Product'),'product'); + print ''; } - if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) { - if ($reg[1]=='DEPOSIT') { - $fields['descr']=$langs->transnoentitiesnoconv('Deposit'); - } elseif ($reg[1]=='CREDIT_NOTE') { - $fields['descr']=$langs->transnoentitiesnoconv('CreditNote'); + + // Company name + print '' . $fields['company_link'] . ''; + + // Description + print ''; + if ($fields['pid']) { + $product_static->id = $fields['pid']; + $product_static->ref = $fields['pref']; + $product_static->type = $fields['dtype']; // We force with the type of line to have type how line is registered + print $product_static->getNomUrl(1); + if (dol_string_nohtmltag($fields['descr'])) { + print ' - ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); + } + } else { + if ($type) { + $text = img_object($langs->trans('Service'), 'service'); } else { - $fields['descr']=$langs->transnoentitiesnoconv($reg[1]); + $text = img_object($langs->trans('Product'), 'product'); } - } - print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),24); + if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) { + if ($reg[1] == 'DEPOSIT') { + $fields['descr'] = $langs->transnoentitiesnoconv('Deposit'); + } elseif ($reg[1] == 'CREDIT_NOTE') { + $fields['descr'] = $langs->transnoentitiesnoconv('CreditNote'); + } else { + $fields['descr'] = $langs->transnoentitiesnoconv($reg[1]); + } + } + print $text . ' ' . dol_trunc(dol_string_nohtmltag($fields['descr']), 24); - // Show range - print_date_range($fields['ddate_start'],$fields['ddate_end']); - } - print ''; - - // Total HT - if ($modetax != 1) - { - print ''; - print price($fields['totalht']); - if (price2num($fields['ftotal_ttc'])) - { - //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; - $ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']); - //print ' ('.round($ratiolineinvoice*100,2).'%)'; + // Show range + print_date_range($fields['ddate_start'], $fields['ddate_end']); } print ''; - } - // Payment - $ratiopaymentinvoice=1; - if ($modetax != 1) - { + // Total HT + if ($modetax != 1) { + print ''; + print price($fields['totalht']); + if (price2num($fields['ftotal_ttc'])) { + //print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - "; + $ratiolineinvoice = ($fields['dtotal_ttc'] / $fields['ftotal_ttc']); + //print ' ('.round($ratiolineinvoice*100,2).'%)'; + } + print ''; + } + + // Payment + $ratiopaymentinvoice = 1; + if ($modetax != 1) { + print ''; + if ($fields['payment_amount'] && $fields['ftotal_ttc']) { + $paymentfourn_static->id = $fields['payment_id']; + print $paymentfourn_static->getNomUrl(2); + } + + if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice') + || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { + print $langs->trans("NA"); + } else { + if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { + $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); + } + print price(price2num($fields['payment_amount'], 'MT')); + if (isset($fields['payment_amount'])) { + print ' (' . round($ratiopaymentinvoice * 100, 2) . '%)'; + } + } + print ''; + } + + // VAT paid print ''; - if ($fields['payment_amount'] && $fields['ftotal_ttc']) - { - $paymentfourn_static->id=$fields['payment_id']; - print $paymentfourn_static->getNomUrl(2); - } - - if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice') - || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) - { - print $langs->trans("NA"); - } - else - { - if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { - $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']); - } - print price(price2num($fields['payment_amount'],'MT')); - if (isset($fields['payment_amount'])) { - print ' ('.round($ratiopaymentinvoice*100,2).'%)'; - } - } + $temp_ht = $fields['totalht'] * $ratiopaymentinvoice; + print price(price2num($temp_ht, 'MT'), 1); print ''; + + // VAT + print ''; + $temp_vat = $fields['vat'] * $ratiopaymentinvoice; + print price(price2num($temp_vat, 'MT'), 1); + //print price($fields['vat']); + print ''; + print ''; + + $subtot_paye_total_ht += $temp_ht; + $subtot_paye_vat += $temp_vat; + $x_paye_sum += $temp_vat; } - - // VAT paid - print ''; - $temp_ht=$fields['totalht']*$ratiopaymentinvoice; - print price(price2num($temp_ht,'MT'),1); - print ''; - - // VAT - print ''; - $temp_vat=$fields['vat']*$ratiopaymentinvoice; - print price(price2num($temp_vat,'MT'),1); - //print price($fields['vat']); - print ''; - print ''; - - $subtot_paye_total_ht += $temp_ht; - $subtot_paye_vat += $temp_vat; - $x_paye_sum += $temp_vat; } + // Total suppliers for this vat rate + print ''; + print ''; + print '' . $langs->trans("Total") . ':'; + if ($modetax != 1) { + print ' '; + print ' '; + } + print '' . price(price2num($subtot_paye_total_ht, 'MT')) . ''; + print '' . price(price2num($subtot_paye_vat, 'MT')) . ''; + print ''; } - // Total suppliers for this vat rate - print ''; - print ''; - print ''.$langs->trans("Total").':'; - if ($modetax != 1) { - print ' '; - print ' '; - } - print ''.price(price2num($subtot_paye_total_ht,'MT')).''; - print ''.price(price2num($subtot_paye_vat,'MT')).''; - print ''; } if (count($x_paye) == 0) { // Show a total line if nothing shown From 3ede626932bcce9e7500cbf832e5aa3a6d0e0fcf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Mar 2019 22:30:52 +0100 Subject: [PATCH 56/70] FIX If we build one invoice for several orders, we must put the ref of order on the line to not lose information. Conflicts: htdocs/commande/list.php htdocs/core/actions_massactions.inc.php --- htdocs/core/actions_massactions.inc.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 33eeda9f4b2..f7208111d7a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -519,7 +519,7 @@ if ($massaction == 'confirm_createbills') else { // Load extrafields of order $cmd->fetch_optionals(); - + $objecttmp->socid = $cmd->socid; $objecttmp->type = Facture::TYPE_STANDARD; $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; @@ -577,6 +577,12 @@ if ($massaction == 'confirm_createbills') for ($i=0;$i<$num;$i++) { $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + // If we build one invoice for several order, we must put the invoice of order on the line + if (! empty($createbills_onebythird)) + { + $desc=dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs)); + } + if ($lines[$i]->subprice < 0) { // Negative line, we create a discount line From e5f54bd14c003a3c33ff6711c3a420b273d0dd22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Mar 2019 12:35:44 +0100 Subject: [PATCH 57/70] FIX Remane of project --- htdocs/projet/class/project.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index a704c7d641e..e63cbe80fee 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -338,7 +338,7 @@ class Project extends CommonObject if (file_exists($olddir)) { include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $res=dol_move($olddir, $newdir); + $res=@rename($olddir, $newdir); if (! $res) { $langs->load("errors"); @@ -723,10 +723,10 @@ class Project extends CommonObject return -1; } } - + /** * Delete tasks with no children first, then task with children recursively - * + * * @param User $user User * @return int <0 if KO, 1 if OK */ @@ -754,7 +754,7 @@ class Project extends CommonObject { if (count($this->lines)) $this->deleteTasks($this->lines); } - + return 1; } From 83d7750274ffbb01e0421dc2b416f36a61ab3b7e Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 27 Mar 2019 09:33:51 +0100 Subject: [PATCH 58/70] FIX missing hook completeTabsHead in margins module --- htdocs/margin/lib/margins.lib.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index e1c2d59b7b8..e6089c00d01 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -96,6 +96,9 @@ function marges_prepare_head() $head[$h][2] = 'checkMargins'; } + complete_head_from_modules($conf,$langs,null,$head,$h,'margins','remove'); + complete_head_from_modules($conf,$langs,null,$head,$h,'margins'); + return $head; } From 11343e986c94832f96ef305493d0718a5c15adbf Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 28 Mar 2019 10:47:32 +0100 Subject: [PATCH 59/70] add all missing hooks on replenish --- htdocs/product/stock/replenish.php | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index dfb875b6483..c9908ca9502 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -299,6 +299,12 @@ if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrep $sql.= ' ,'.$sqldesiredtock.' as desiredstock, '.$sqlalertstock.' as alertstock,'; $sql.= ' SUM('.$db->ifsql("s.reel IS NULL", "0", "s.reel").') as stock_physique'; + +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= ' FROM ' . MAIN_DB_PREFIX . 'product as p'; $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s'; $sql.= ' ON (p.rowid = s.fk_product AND s.fk_entrepot IN (SELECT ent.rowid FROM '.MAIN_DB_PREFIX.'entrepot AS ent WHERE ent.entity IN('.getEntity('stock').')))'; @@ -308,6 +314,12 @@ if($fk_supplier > 0) { if(!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) { $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_warehouse_properties AS pse ON (p.rowid = pse.fk_product AND pse.fk_entrepot = '.$fk_entrepot.')'; } + +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListJoin',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= ' WHERE p.entity IN (' . getEntity('product') . ')'; if ($sall) $sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) @@ -388,6 +400,11 @@ if ($usevirtualstock) } } +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); @@ -452,9 +469,15 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) print '
'; print $langs->trans('Supplier').' '.$form->select_company($fk_supplier, 'fk_supplier', 'fournisseur=1', 1); print '
'; + +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) print $hookmanager->resPrint; + print '
'; print ''; print '
'; + print ''; if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { @@ -533,6 +556,12 @@ print '' . $langs->trans('AlertOnly') . '& print '' . $langs->trans('Draft') . ' '; print ' '; print ''; + +// Fields from hook +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -550,6 +579,12 @@ print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], 'stock_physique', $pa print_liste_field_titre('Ordered', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); + +// Hook fields +$parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + print "\n"; while ($i < ($limit ? min($num, $limit) : $num)) @@ -673,6 +708,11 @@ while ($i < ($limit ? min($num, $limit) : $num)) // Supplier print ''. $form->select_product_fourn_price($prod->id, 'fourn'.$i, $fk_supplier).''; + // Fields from hook + $parameters=array( 'objp'=>$objp); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; } $i++; From 957fae1081bc658865bc933a8b5d1a400b3ffbdd Mon Sep 17 00:00:00 2001 From: atm-greg Date: Thu, 28 Mar 2019 11:07:27 +0100 Subject: [PATCH 60/70] missing params --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index c9908ca9502..1da387aeec4 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -558,7 +558,7 @@ print ' '; print ''; // Fields from hook -$parameters=array(); +$parameters=array('param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; From 5588fe5b81e1a5f6b8cb744481418316558d527c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 30 Mar 2019 09:42:13 +0100 Subject: [PATCH 61/70] FIX: Don't show journal:getNomUrl without data ErrorBadValueForParamNotAString --- htdocs/compta/bank/card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 38add1141f7..35357788f1b 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -637,11 +637,12 @@ else print ''.$langs->trans("AccountancyJournal").''; print ''; - $accountingjournal = new AccountingJournal($db); - $accountingjournal->fetch($object->fk_accountancy_journal); - - print $accountingjournal->getNomUrl(0,1,1,'',1); + if (! empty($object->fk_accountancy_journal)) { + $accountingjournal = new AccountingJournal($db); + $accountingjournal->fetch($object->fk_accountancy_journal); + print $accountingjournal->getNomUrl(0, 1, 1, '', 1); + } print ''; } From 143cbba09b336a0e7c072aadc78c98f8e9a155aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 31 Mar 2019 18:49:38 +0200 Subject: [PATCH 62/70] Update card.php --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 35357788f1b..32f946d7d98 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -637,7 +637,7 @@ else print ''.$langs->trans("AccountancyJournal").''; print ''; - if (! empty($object->fk_accountancy_journal)) { + if ($object->fk_accountancy_journal > 0) { $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($object->fk_accountancy_journal); From 0b6c7d2d63892a6568a95aa941d817712e64422b Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Thu, 4 Apr 2019 11:17:44 +0200 Subject: [PATCH 63/70] FIX shipping default warehouse if only one warehouse --- htdocs/expedition/shipment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index bbf990f2ec6..c92962357b2 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -894,7 +894,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans("WarehouseSource"); //print ''; //print ''; - print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); + print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:'ifone', 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); if (count($formproduct->cache_warehouses) <= 0) { print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; From 4489db2a70ac00ca06c887960d40246821d73862 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Apr 2019 17:06:26 +0200 Subject: [PATCH 64/70] Fix field surface/weight not loaded --- htdocs/product/list.php | 74 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 69 insertions(+), 5 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7c7619fe0d5..b729ecb6877 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -159,9 +159,13 @@ $arrayfields=array( //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->service->enabled))), - 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>($contextpage != 'servicelist'), 'enabled'=>(! empty($conf->barcode->enabled))), + 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), - 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), + 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), + 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), + 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), + 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), + 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.pmp'=>array('label'=>$langs->trans("PMPValueShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), @@ -261,7 +265,7 @@ else } $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; -$sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; +$sql.= ' p.fk_product_type, p.duration, p.weight, p.length, p.surface, p.volume, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp,'; $sql.= ' MIN(pfp.unitprice) as minsellprice'; @@ -316,7 +320,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; -$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; +$sql.= " p.fk_product_type, p.duration, p.weight, p.length, p.surface, p.volume, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp'; if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= ', pac.rowid'; // Add fields from extrafields @@ -552,9 +556,32 @@ if ($resql) if (! empty($arrayfields['p.duration']['checked'])) { print ''; - print ' '; print ''; } + // Weight + if (! empty($arrayfields['p.weight']['checked'])) + { + print ''; + print ''; + } + // Length + if (! empty($arrayfields['p.length']['checked'])) + { + print ''; + print ''; + } + // Surface + if (! empty($arrayfields['p.surface']['checked'])) + { + print ''; + print ''; + } + // Volume + if (! empty($arrayfields['p.volume']['checked'])) + { + print ''; + print ''; + } // Sell price if (! empty($arrayfields['p.sellprice']['checked'])) { @@ -650,6 +677,10 @@ if ($resql) if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, 'align="center"', $sortfield, $sortorder); + if (! empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); @@ -781,6 +812,39 @@ if ($resql) if (! $i) $totalarray['nbfield']++; } + // Weight + if (! empty($arrayfields['p.weight']['checked'])) + { + print ''; + print $obj->weight; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Length + if (! empty($arrayfields['p.length']['checked'])) + { + print ''; + print $obj->length; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Surface + if (! empty($arrayfields['p.surface']['checked'])) + { + print ''; + print $obj->surface; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Volume + if (! empty($arrayfields['p.volume']['checked'])) + { + print ''; + print $obj->volume; + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Sell price if (! empty($arrayfields['p.sellprice']['checked'])) { From eaf9a2402a5fd3f60fb8e9277fb88f2d64a54494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Apr 2019 17:37:03 +0200 Subject: [PATCH 65/70] Fix length of label --- htdocs/product/list.php | 2 +- htdocs/projet/list.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index b729ecb6877..f2d869c9a45 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -777,7 +777,7 @@ if ($resql) // Label if (! empty($arrayfields['p.label']['checked'])) { - print ''.dol_trunc($obj->label,40).''; + print ''.dol_trunc($obj->label, 40).''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 37caf6f4e69..78d21d36424 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -709,8 +709,8 @@ while ($i < min($num,$limit)) // Title if (! empty($arrayfields['p.title']['checked'])) { - print ''; - print dol_trunc($obj->title,80); + print ''; + print dol_trunc($obj->title, 80); print ''; if (! $i) $totalarray['nbfield']++; } From ea87b2ddb682378d19cb4d2892690080482a19f5 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Fri, 5 Apr 2019 11:26:11 +0200 Subject: [PATCH 66/70] Fix no init hook on timesheet --- htdocs/projet/activity/perday.php | 2 ++ htdocs/projet/activity/perweek.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 164a7462e83..79a52bcd87f 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -36,6 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $langs->loadLangs(array('projects','users','companies')); +$hookmanager->initHooks(array('perdaycard')); + $action=GETPOST('action','aZ09'); $mode=GETPOST("mode",'alpha'); $id=GETPOST('id','int'); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 97574fa555f..ff5b1ad0d6c 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -36,6 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $langs->loadLangs(array('projects','users','companies')); +$hookmanager->initHooks(array('perweekcard')); + $action=GETPOST('action','aZ09'); $mode=GETPOST("mode",'alpha'); $id=GETPOST('id','int'); From 153e563c9f9ef38aa82b46c529a763aefac28f38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Apr 2019 13:49:05 +0200 Subject: [PATCH 67/70] Update perday.php --- htdocs/projet/activity/perday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 79a52bcd87f..d894512a951 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $langs->loadLangs(array('projects','users','companies')); -$hookmanager->initHooks(array('perdaycard')); +$hookmanager->initHooks(array('timesheetperdaycard')); $action=GETPOST('action','aZ09'); $mode=GETPOST("mode",'alpha'); From c1f08260056a79db8deab4d2c6c3d4c1304845b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 8 Apr 2019 13:49:16 +0200 Subject: [PATCH 68/70] Update perweek.php --- htdocs/projet/activity/perweek.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index ff5b1ad0d6c..c3405d1ef5f 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $langs->loadLangs(array('projects','users','companies')); -$hookmanager->initHooks(array('perweekcard')); +$hookmanager->initHooks(array('timesheetperweekcard')); $action=GETPOST('action','aZ09'); $mode=GETPOST("mode",'alpha'); From 524b1869599db819de8b702499dd349e5c968abf Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 11 Apr 2019 15:19:40 +0200 Subject: [PATCH 69/70] FIX : Product accountancey sell intra code must be visible if main feature level 1 --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 66f7e288efa..e7f6e0f8af3 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3580,7 +3580,7 @@ class Product extends CommonObject { // } - if (! empty($conf->accounting->enabled) && $this->status) + if (! empty($conf->accounting->enabled) && $this->status && !empty($conf->global->MAIN_FEATURES_LEVEL)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; $label.= '
' . $langs->trans('ProductAccountancySellCode') . ': '. length_accountg($this->accountancy_code_sell); From 9a24007c0a7c7d1de0eb37f38d05e84cdef14719 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 11 Apr 2019 15:32:50 +0200 Subject: [PATCH 70/70] FIX : better test --- htdocs/product/class/product.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e7f6e0f8af3..fce619094dc 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3580,12 +3580,14 @@ class Product extends CommonObject { // } - if (! empty($conf->accounting->enabled) && $this->status && !empty($conf->global->MAIN_FEATURES_LEVEL)) + if (! empty($conf->accounting->enabled) && $this->status) { include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; $label.= '
' . $langs->trans('ProductAccountancySellCode') . ': '. length_accountg($this->accountancy_code_sell); - $label.= '
' . $langs->trans('ProductAccountancySellIntraCode') . ': '. length_accountg($this->accountancy_code_sell_export); - $label.= '
' . $langs->trans('ProductAccountancySellExportCode') . ': '. length_accountg($this->accountancy_code_sell_intra); + if(!empty($conf->global->MAIN_FEATURES_LEVEL)) { + $label.= '
' . $langs->trans('ProductAccountancySellIntraCode') . ': '. length_accountg($this->accountancy_code_sell_export); + $label.= '
' . $langs->trans('ProductAccountancySellExportCode') . ': '. length_accountg($this->accountancy_code_sell_intra); + } } if (! empty($conf->accounting->enabled) && $this->status_buy) {