From 4f13a4f45bc38c14d8e2b7ed4a7a917fc8c80669 Mon Sep 17 00:00:00 2001 From: atm-greg Date: Tue, 10 Apr 2018 14:16:01 +0200 Subject: [PATCH 01/22] fix #8521 --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index a75c9176893..008a07ab718 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5833,7 +5833,7 @@ function dolGetFirstLastname($firstname,$lastname,$nameorder=-1) $ret=''; // If order not defined, we use the setup - if ($nameorder < 0) $nameorder=(empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)); + if ($nameorder < 0) $nameorder=$conf->global->MAIN_FIRSTNAME_NAME_POSITION; if ($nameorder && ((string) $nameorder != '2')) { $ret.=$firstname; From 84f80795c363033e740011b656c157028206b940 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Tue, 10 Apr 2018 14:38:41 +0200 Subject: [PATCH 02/22] fix #8474 --- htdocs/expensereport/class/expensereport.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index c2eacf4aa76..c50b4ce2cb3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1695,6 +1695,13 @@ class ExpenseReport extends CommonObject $this->line = new ExpenseReportLine($this->db); + if (preg_match('/\((.*)\)/', $vatrate, $reg)) + { + $vat_src_code = $reg[1]; + $vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate. + } + $vatrate = preg_replace('/\*/','',$vatrate); + $seller = ''; // seller is unknown $tmp = calcul_price_total($qty, $up, 0, $vatrate, 0, 0, 0, 'TTC', 0, $type, $seller); @@ -1929,7 +1936,6 @@ class ExpenseReport extends CommonObject // Clean vat code $vat_src_code=''; - if (preg_match('/\((.*)\)/', $vatrate, $reg)) { $vat_src_code = $reg[1]; From 848d76ee78632fc1a642a2293457e99d83433713 Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Tue, 10 Apr 2018 14:43:32 +0200 Subject: [PATCH 03/22] FIX #8023 --- htdocs/compta/bank/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 308c98f0cab..617abbce5f2 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -845,11 +845,11 @@ else // Ref print ''.$langs->trans("Ref").''; - print 'ref).'">'; + print 'ref)).'">'; // Label print ''.$langs->trans("Label").''; - print 'label).'">'; + print 'label)).'">'; // Type print ''.$langs->trans("AccountType").''; From 26e9f108334e8cb359cca5bcc9e751c73846ec1a Mon Sep 17 00:00:00 2001 From: atm-arnaud Date: Tue, 10 Apr 2018 14:52:16 +0200 Subject: [PATCH 04/22] FIX #8389 --- htdocs/langs/de_DE/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/de_DE/admin.lang b/htdocs/langs/de_DE/admin.lang index c6b101c0a32..46ac31edc0d 100644 --- a/htdocs/langs/de_DE/admin.lang +++ b/htdocs/langs/de_DE/admin.lang @@ -1062,7 +1062,7 @@ TriggerAlwaysActive=Trigger in dieser Datei sind unabhängig der Modulkonfigurat TriggerActiveAsModuleActive=Trigger in dieser Datei sind durch das übergeordnete Modul %s aktiviert. GeneratedPasswordDesc=Definieren Sie hier das Schema nach dem automatisch generierte Passwörter erstellt werden sollen. DictionaryDesc=Alle Standardwerte einfügen. Sie können eigene Werte zu den Standartwerten hinzufügen. -ConstDesc=Diese Seite erlaubt es alle anderen Parameter einzustellen, die auf den vorherigen Seiten nicht verfügbar sind. Dies sind meist reservierte Parameter für Entwickler oder für die erweiterte Fehlersuche. Für eine Liste von Optionen hier überprüfen . +ConstDesc=Diese Seite erlaubt es alle anderen Parameter einzustellen, die auf den vorherigen Seiten nicht verfügbar sind. Dies sind meist reservierte Parameter für Entwickler oder für die erweiterte Fehlersuche. Für eine Liste von Optionen hier überprüfen . MiscellaneousDesc=Alle anderen sicherheitsrelevanten Parameter werden hier eingestellt. LimitsSetup=Limits und Genauigkeit Einstellungen LimitsDesc=Hier können Sie Grenzwerte, Genauigkeitseinstellungen und das Rundungsverhalten einstellen. From 5621d1f8ea3bba85e842ee7aa10f872855f3616a Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 10 Apr 2018 15:03:15 +0200 Subject: [PATCH 05/22] FIX #8478 !empty instead of count to avoid warning --- htdocs/core/tpl/admin_extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 6d3bb43f3b2..c5618b07297 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -60,7 +60,7 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print ' '; print "\n"; -if (count($extrafields->attribute_type)) +if (!empty($extrafields->attribute_type)) { foreach($extrafields->attribute_type as $key => $value) { From 1fd5dba118c42875cc84efd00515aa8dde11dc5e Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 10 Apr 2018 15:24:57 +0200 Subject: [PATCH 06/22] FIX: payment term doc-specific label was not used --- htdocs/core/class/commondocgenerator.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 535200ab95a..c32819bdb3a 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -367,7 +367,7 @@ abstract class CommonDocGenerator $array_key.'_payment_mode_code'=>$object->mode_reglement_code, $array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), $array_key.'_payment_term_code'=>$object->cond_reglement_code, - $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement), + $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):($object->cond_reglement_doc?$object->cond_reglement_doc:$object->cond_reglement)), $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs), $array_key.'_total_vat_locale'=>(! empty($object->total_vat)?price($object->total_vat, 0, $outputlangs):price($object->total_tva, 0, $outputlangs)), From cc832bd9724273959161c79c713c63f617470b46 Mon Sep 17 00:00:00 2001 From: atm-quentin Date: Tue, 10 Apr 2018 15:47:06 +0200 Subject: [PATCH 07/22] FIX Issue #8455 --- htdocs/install/mysql/migration/6.0.0-7.0.0.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 2240cb3cdf8..df1b40dffd8 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -528,6 +528,9 @@ CREATE TABLE llx_comment ( DELETE FROM llx_const where name = __ENCRYPT('MAIN_SHOW_WORKBOARD')__; +-- Adherent - Update old constants +UPDATE llx_const SET value = REPLACE(value, '%', '__') WHERE name LIKE 'ADHERENT%'; + -- Accountancy - Remove old constants DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_SELL_JOURNAL')__; DELETE FROM llx_const WHERE name = __ENCRYPT('ACCOUNTING_PURCHASE_JOURNAL')__; From 47d5b1f6fdb16c7ea6a50c5f7b0e937b08765c3c Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 10 Apr 2018 16:39:28 +0200 Subject: [PATCH 08/22] FIX : update wrong datetime extrafield --- htdocs/core/class/commonobject.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3d4720147d9..5057b21a74e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4609,6 +4609,10 @@ abstract class CommonObject $new_array_options[$key] = $this->db->idate($this->array_options[$key]); break; case 'datetime': + // This will convert date to timestamp + if(!is_int($this->array_options[$key])) { + $this->array_options[$key] = strtotime($this->array_options[$key]); + } $new_array_options[$key] = $this->db->idate($this->array_options[$key]); break; case 'link': From cffe1e977166bb2ab831a24c6668973fd0256bc5 Mon Sep 17 00:00:00 2001 From: ATM-Nicolas Date: Tue, 10 Apr 2018 17:10:48 +0200 Subject: [PATCH 09/22] FIX : Multiple creation of same event --- htdocs/fourn/commande/card.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ad27a496672..ee6026ae4d3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -837,6 +837,8 @@ if (empty($reshook)) $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } $action = ''; + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); + exit; } else { From 96e26100f03bf91ed2338b66b0c456251754256b Mon Sep 17 00:00:00 2001 From: John Date: Wed, 11 Apr 2018 11:06:40 +0200 Subject: [PATCH 10/22] Add extrafield entity query filter --- htdocs/core/class/extrafields.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9758bb4466b..f5acd43e9d9 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -944,6 +944,10 @@ class ExtraFields $sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[0]; if (!empty($InfoFieldList[4])) { + // can use curent entity filter + if (strpos($InfoFieldList[4], '$ENTITY$')!==false) { + $InfoFieldList[4]=str_replace('$ENTITY$',$conf->entity,$InfoFieldList[4]); + } // can use SELECT request if (strpos($InfoFieldList[4], '$SEL$')!==false) { $InfoFieldList[4]=str_replace('$SEL$','SELECT',$InfoFieldList[4]); From c966cdbd476cfc4ed29a158d52431a1180d5e5cc Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Wed, 11 Apr 2018 11:43:51 +0200 Subject: [PATCH 11/22] FIX: selectForFormsList: entity checked even is object not multi-entity managed --- htdocs/core/class/html.form.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 4daf78ad52e..bd5a32dc9a4 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5293,7 +5293,8 @@ class Form $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t"; if ($objecttmp->ismultientitymanaged == 2) if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE t.entity IN (".getEntity($objecttmp->table_element).")"; + $sql.= " WHERE 1"; + if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id)) { if ($objecttmp->element == 'societe') $sql.= " AND t.rowid = ".$user->societe_id; From 2f75bfcd83c4f93480f0611142b8b8c16de2c34a Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Wed, 11 Apr 2018 11:46:47 +0200 Subject: [PATCH 12/22] FIX: modulebuilder: could not create html fields --- htdocs/core/lib/modulebuilder.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 8e2cba43097..496a3dbbf54 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -63,7 +63,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir=' setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors'); return -2; } - if (! preg_match('/^(integer|date|timestamp|varchar|double)/', $addfieldentry['type'])) + if (! preg_match('/^(integer|date|timestamp|varchar|double|html)/', $addfieldentry['type'])) { setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors'); return -2; From bbc12cf06b8f2cfc58b89462b69c6686a434b0d9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Wed, 11 Apr 2018 11:49:29 +0200 Subject: [PATCH 13/22] FIX: default addupdatedelete actions: uniformize add/update value checks --- htdocs/core/actions_addupdatedelete.inc.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index b8ede4d7d14..f24e0264bd4 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -47,8 +47,15 @@ if ($action == 'add' && ! empty($permissiontoadd)) if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields // Set value to insert - if (in_array($object->fields[$key]['type'], array('text', 'html'))) $value = GETPOST($key,'none'); - else $value = GETPOST($key,'alpha'); + if (in_array($object->fields[$key]['type'], array('text', 'html'))) { + $value = GETPOST($key,'none'); + } elseif ($object->fields[$key]['type']=='date') { + $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); + } elseif ($object->fields[$key]['type']=='datetime') { + $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); + } else { + $value = GETPOST($key,'alpha'); + } if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field @@ -95,8 +102,7 @@ if ($action == 'update' && ! empty($permissiontoadd)) // Set value to update if (in_array($object->fields[$key]['type'], array('text', 'html'))) { $value = GETPOST($key,'none'); - } - elseif ($object->fields[$key]['type']=='date') { + } elseif ($object->fields[$key]['type']=='date') { $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); } elseif ($object->fields[$key]['type']=='datetime') { $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); From fa8cf982492f6096c853b620d65a11b854c5b0f6 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Wed, 11 Apr 2018 12:18:54 +0200 Subject: [PATCH 14/22] FIX: modulebuilder: handle 'price' fieldtype --- htdocs/core/actions_addupdatedelete.inc.php | 4 ++++ htdocs/core/lib/modulebuilder.lib.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index f24e0264bd4..6e1ddf8a796 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -53,6 +53,8 @@ if ($action == 'add' && ! empty($permissiontoadd)) $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); } elseif ($object->fields[$key]['type']=='datetime') { $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); + } elseif ($object->fields[$key]['type']=='price') { + $value = price2num(GETPOST($key)); } else { $value = GETPOST($key,'alpha'); } @@ -106,6 +108,8 @@ if ($action == 'update' && ! empty($permissiontoadd)) $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); } elseif ($object->fields[$key]['type']=='datetime') { $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); + } elseif ($object->fields[$key]['type']=='price') { + $value = price2num(GETPOST($key)); } else { $value = GETPOST($key,'alpha'); } diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 496a3dbbf54..185e3a3b4a1 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -63,7 +63,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir=' setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors'); return -2; } - if (! preg_match('/^(integer|date|timestamp|varchar|double|html)/', $addfieldentry['type'])) + if (! preg_match('/^(integer|date|timestamp|varchar|double|html|price)/', $addfieldentry['type'])) { setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors'); return -2; @@ -257,6 +257,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $type = $val['type']; $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database + if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database $texttoinsert.= "\t".$key." ".$type; if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; From 75bc3d17e6aaa0960acee60afce9283ca0830a8a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2018 14:55:29 +0200 Subject: [PATCH 15/22] Update admin_extrafields_view.tpl.php --- htdocs/core/tpl/admin_extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index c5618b07297..a3292773d4d 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -60,7 +60,7 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print ' '; print "\n"; -if (!empty($extrafields->attribute_type)) +if (is_array($extrafields->attribute_type)) && count($extrafields->attribute_type)) { foreach($extrafields->attribute_type as $key => $value) { From 628b437e28750d46ea9454f4be375537229bd2bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2018 16:25:05 +0200 Subject: [PATCH 16/22] Update card.php --- htdocs/compta/bank/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 617abbce5f2..032ac6fc5ef 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -845,11 +845,11 @@ else // Ref print ''.$langs->trans("Ref").''; - print 'ref)).'">'; + print 'ref).'">'; // Label print ''.$langs->trans("Label").''; - print 'label)).'">'; + print 'label).'">'; // Type print ''.$langs->trans("AccountType").''; From ca6b7205efe3e5fad2e9a127f25b7dbd6ba0d42c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2018 16:27:56 +0200 Subject: [PATCH 17/22] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5057b21a74e..11170a362f5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4609,8 +4609,8 @@ abstract class CommonObject $new_array_options[$key] = $this->db->idate($this->array_options[$key]); break; case 'datetime': - // This will convert date to timestamp - if(!is_int($this->array_options[$key])) { + // If data is a string instead of a timestamp, we convert it + if (! is_int($this->array_options[$key])) { $this->array_options[$key] = strtotime($this->array_options[$key]); } $new_array_options[$key] = $this->db->idate($this->array_options[$key]); From 6f526eb78087b02ef3617b249e3e4a6b5072b1a1 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Wed, 11 Apr 2018 16:40:59 +0200 Subject: [PATCH 18/22] Fix wrong amount for situation invoice in sellsjournal --- htdocs/accountancy/journal/sellsjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 2d5d65607e2..1186123b194 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -164,7 +164,7 @@ if ($result) { // Situation invoices handling $line = new FactureLigne($db); $line->fetch($obj->fdid); - $prev_progress = $line->get_prev_progress($obj->fdid); + $prev_progress = $line->get_prev_progress($obj->rowid); if ($obj->type == Facture::TYPE_SITUATION) { // Avoid divide by 0 if ($obj->situation_percent == 0) { From 0518218aed63fbe6fdbbc584a97ec5ba1d53d48a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2018 17:17:03 +0200 Subject: [PATCH 19/22] Fix regression --- htdocs/core/tpl/admin_extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index a3292773d4d..096d7e0bbff 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -60,7 +60,7 @@ if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print ' '; print "\n"; -if (is_array($extrafields->attribute_type)) && count($extrafields->attribute_type)) +if (is_array($extrafields->attribute_type) && count($extrafields->attribute_type)) { foreach($extrafields->attribute_type as $key => $value) { From ae34fa6fbdd574338fe9eea8e3c2af585265b57f Mon Sep 17 00:00:00 2001 From: atm-greg Date: Wed, 11 Apr 2018 17:42:26 +0200 Subject: [PATCH 20/22] add supplier contact name on supplier documents --- .../supplier_invoice/pdf/pdf_canelle.modules.php | 11 ++++++++++- .../supplier_order/pdf/pdf_muscadet.modules.php | 13 +++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 85b3f7bd045..a5120574b7f 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -1084,7 +1084,16 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if ($showaddress) { // Sender properties - $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); + $carac_emetteur=''; + // Add internal contact of proposal if defined + $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); + if (count($arrayidcontact) > 0) + { + $object->fetch_user($arrayidcontact[0]); + $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + } + + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=42; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 9d0a76eb2b6..f5d9971639b 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -1133,8 +1133,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($showaddress) { - // Sender properties - $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); + // Sender properties + $carac_emetteur=''; + // Add internal contact of proposal if defined + $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); + if (count($arrayidcontact) > 0) + { + $object->fetch_user($arrayidcontact[0]); + $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n"; + } + + $carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); // Show sender $posy=42; From 9ccba03a1720565d80d52b25a4624859dcb7a854 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2018 18:00:34 +0200 Subject: [PATCH 21/22] Update html.form.class.php --- 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 bd5a32dc9a4..c1602066ee6 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5293,7 +5293,7 @@ class Form $sql = "SELECT t.rowid, ".$fieldstoshow." FROM ".MAIN_DB_PREFIX .$objecttmp->table_element." as t"; if ($objecttmp->ismultientitymanaged == 2) if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE 1"; + $sql.= " WHERE 1=1"; if(! empty($objecttmp->ismultientitymanaged)) $sql.= " AND t.entity IN (".getEntity($objecttmp->table_element).")"; if ($objecttmp->ismultientitymanaged == 1 && ! empty($user->societe_id)) { From 8aa41c09c013e122f26a4154a69ab9a6b0a4fb2a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 11 Apr 2018 19:31:28 +0200 Subject: [PATCH 22/22] Fix phpunit --- test/phpunit/AdherentTest.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index 4c92f507f66..a2f4f64aba5 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -317,6 +317,8 @@ class AdherentTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; + $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 1; // Force setup for firstname then lastname + $template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'. '__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__';