From 4d8aba69636df4603a93fbbed2d4b605cc664f50 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 11:48:31 +0200 Subject: [PATCH 01/27] Fix CSS --- htdocs/theme/eldy/global.inc.php | 3 +++ htdocs/theme/md/style.css.php | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index a0687454ab9..95eb542d2a1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1172,6 +1172,9 @@ div.secondcolumn div.box { width: auto; padding-bottom: 6px; } + div.fichetwothirdright div.ficheaddleft { + padding-left: 0; + } div.fichehalfleft { float: none; width: auto; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index a8efdc3f3f3..754bc6bd159 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1361,6 +1361,9 @@ div.fichetwothirdright { browser->layout != 'phone') { print "width: 50%;\n"; } ?> browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?> } +div.fichetwothirdright div.ficheaddleft { + padding-left: 20px; +} div.fichehalfleft { browser->layout != 'phone') { print "float: ".$left.";\n"; } ?> browser->layout != 'phone') { print "width: calc(50% - 10px);\n"; } ?> @@ -1404,6 +1407,9 @@ div.secondcolumn div.box { width: auto; padding-bottom: 6px; } + div.fichetwothirdright div.ficheaddleft { + padding-left: 0; + } div.fichehalfleft { float: none; width: auto; From 3a65c2c158ccd5b4141c30ddb5c87d2a7dd4bcc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 12:16:41 +0200 Subject: [PATCH 02/27] Update doc --- ChangeLog | 3 ++- htdocs/conf/conf.php.example | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06f749cbc34..54244427b81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -176,7 +176,8 @@ Following changes may create regressions for some external modules, but were nec * Deprecated property ->fk_departement is now ->state_id everywhere. * Removed the method 4 of GETPOST (to get $_COOKIE). It was not used and not recommanded to use in Dolibarr. * Column llx_facture.facnumber change to llx_facture.ref - +* Variable $dolibarr_main_cookie_cryptkey is no more created at install (it was not used by Dolibarr). A new variable + called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features. ***** ChangeLog for 9.0.3 compared to 9.0.2 ***** FIX: #11013 diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 886a6171818..72581f1c096 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -146,11 +146,20 @@ $dolibarr_main_db_character_set='utf8'; // Database character set used to sort data (forced during database creation. value of database is then used). // Default value: depends on database driver // Examples: -// dolibarr_main_db_collation='utf8_unicode_ci'; +// $dolibarr_main_db_collation='utf8_unicode_ci'; // $dolibarr_main_db_collation='utf8_unicode_ci'; +// dolibarr_main_instance_unique_id +// An ID that is unique for each installation. +// Default value: randomly defined during installation +// Examples: +// $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; +// +$dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; + + //################## // Login From c5b288641adfba476b4fa87e7b07daef39546e79 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 12:38:08 +0200 Subject: [PATCH 03/27] Update doc --- htdocs/conf/conf.php.example | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 72581f1c096..eb5bffab2f7 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -168,18 +168,18 @@ $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; // dolibarr_main_authentication // This parameter contains the way authentication is done. // If value "ldap" is used, you must also set parameters dolibarr_main_auth_ldap_* -// Default value: dolibarr +// Default value: 'dolibarr' // Possible values: Any values found in files in htdocs/core/login directory after // the "function_" string and before the ".php" string. You can also separate several // values using a ",". In this case, Dolibarr will check login/pass for each value in // order defined into value. However, note that this can't work with all values. // Examples: -// $dolibarr_main_authentication='http'; -// $dolibarr_main_authentication='dolibarr'; -// $dolibarr_main_authentication='ldap'; -// $dolibarr_main_authentication='openid,dolibarr'; -// $dolibarr_main_authentication='forceuser'; // Add also $dolibarr_auto_user='loginforuser'; - +// $dolibarr_main_authentication='dolibarr'; // Use the password defined into application on user record. +// $dolibarr_main_authentication='http'; // Use the HTTP Basic authentication +// $dolibarr_main_authentication='ldap'; // Check the password into a LDAP server +// $dolibarr_main_authentication='openid,dolibarr'; // You can set several mode using a comma as a separator. +// $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser'; +// $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com // $dolibarr_main_authentication='dolibarr'; From e3d50c533c453a593092af8739d872edcf84beba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 13:06:13 +0200 Subject: [PATCH 04/27] Update example --- htdocs/conf/conf.php.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index eb5bffab2f7..4d26fef7965 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -177,7 +177,7 @@ $dolibarr_main_instance_unique_id='84b5bc91f83b56e458db71e0adac2b62'; // $dolibarr_main_authentication='dolibarr'; // Use the password defined into application on user record. // $dolibarr_main_authentication='http'; // Use the HTTP Basic authentication // $dolibarr_main_authentication='ldap'; // Check the password into a LDAP server -// $dolibarr_main_authentication='openid,dolibarr'; // You can set several mode using a comma as a separator. +// $dolibarr_main_authentication='ldap,dolibarr'; // You can set several mode using a comma as a separator. // $dolibarr_main_authentication='forceuser'; // This need to add also $dolibarr_auto_user='loginforuser'; // $dolibarr_main_authentication='twofactor'; // To use Google Authenticator. This need the non official external module "Two Factor" available on www.dolistore.com // From e60131e3eedaf6a0b2eae97e8f878bf0879f7acf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 13:42:27 +0200 Subject: [PATCH 05/27] Fix look and feel v10 --- htdocs/product/composition/card.php | 383 ++++++++++++++-------------- 1 file changed, 185 insertions(+), 198 deletions(-) diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index f27aac68eb4..a3b444db6b7 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -214,7 +214,7 @@ if ($id > 0 || ! empty($ref)) print '
'; print '
'; - print ''; + print '
'; // Nature if ($object->type!=Product::TYPE_SERVICE) @@ -268,236 +268,223 @@ if ($id > 0 || ! empty($ref)) $nbofsubproducts=count($prodschild); // This include only first level of childs - // Number of parent virtual products - //print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct')); + print '
'; - //if (count($prodsfather) > 0) - //{ - print load_fiche_titre($langs->trans("ProductParentList"), '', ''); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (count($prodsfather) > 0) + print load_fiche_titre($langs->trans("ProductParentList"), '', ''); + + print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + if (count($prodsfather) > 0) + { + foreach($prodsfather as $value) { - $class='pair'; + $idprod= $value["id"]; + $productstatic->id=$idprod;// $value["id"]; + $productstatic->type=$value["fk_product_type"]; + $productstatic->ref=$value['ref']; + $productstatic->label=$value['label']; + $productstatic->entity=$value['entity']; - foreach($prodsfather as $value) - { - $idprod= $value["id"]; - $productstatic->id=$idprod;// $value["id"]; - $productstatic->type=$value["fk_product_type"]; - $productstatic->ref=$value['ref']; - $productstatic->label=$value['label']; - $productstatic->entity=$value['entity']; - - $class=($class=='impair')?'pair':'impair'; - print ''; - - print ''; - print ''; - print ''; - print ''; - } - } - else - { - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } - print '
'.$langs->trans('ParentProducts').''.$langs->trans('Label').''.$langs->trans('Qty').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'.$langs->trans("None").'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''.$value['qty'].'
'; - //} - + } + else + { + print ''; + print ''.$langs->trans("None").''; + print ''; + } + print ''; + print '
'; print '
'."\n"; - // Number of subproducts - //print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct')); + print '
'; - // List of subproducts - //if (count($prods_arbo) > 0) - //{ - $atleastonenotdefined=0; - print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); + $atleastonenotdefined=0; + print load_fiche_titre($langs->trans("ProductAssociationList"), '', ''); - print '
'; - print ''; - print ''; + print ''; + print ''; + print ''; - print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - if (! empty($conf->stock->enabled)) print ''; - print ''; - print ''; - print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + if (! empty($conf->stock->enabled)) print ''; + print ''; + print ''; + print ''."\n"; - $class='pair'; - - $totalsell=0; - if (count($prods_arbo)) + $totalsell=0; + if (count($prods_arbo)) + { + foreach($prods_arbo as $value) { - foreach($prods_arbo as $value) + $productstatic->fetch($value['id']); + + if ($value['level'] <= 1) { - $productstatic->fetch($value['id']); + print ''; - if ($value['level'] <= 1) + $notdefined=0; + $nb_of_subproduct = $value['nb']; + + print ''; + print ''; + + // Best buying price + print ''; + print $langs->trans("BuyingPriceMinShort").': '; + if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0); + else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; } + } + print ''; - $notdefined=0; - $nb_of_subproduct = $value['nb']; + // For avoid a non-numeric value + $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); + $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); + $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - print ''; - print ''; + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); + $total+=$totalline; - // Best buying price - print ''; + print ''; - // For avoid a non-numeric value - $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); - $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); - $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); - - $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); - $total+=$totalline; - - print ''; - - // Best selling price - $pricesell=$productstatic->price; - if (! empty($conf->global->PRODUIT_MULTIPRICES)) - { - $pricesell='Variable'; - } - else - { - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; - } - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; // Real stock - - // Qty + IncDec - if ($user->rights->produit->creer || $user->rights->service->creer) - { - print ''; - print ''; - } - else{ - print ''; - print ''; - } - - print ''."\n"; + // Best selling price + $pricesell=$productstatic->price; + if (! empty($conf->global->PRODUIT_MULTIPRICES)) + { + $pricesell='Variable'; } else { - $hide=''; - if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand - - $class=($class=='impair')?'pair':'impair'; - print ''; - - //$productstatic->ref=$value['label']; - $productstatic->ref=$value['ref']; - print ''; - print ''; - - // Best buying price - print ''; - print ''; - // Best selling price - print ''; - print ''; - - if (! empty($conf->stock->enabled)) print ''; // Real stock - print ''; - print ''; - - print ''."\n"; + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; } + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; // Real stock + + // Qty + IncDec + if ($user->rights->produit->creer || $user->rights->service->creer) + { + print ''; + print ''; + } + else{ + print ''; + print ''; + } + + print ''."\n"; } - - print ''; - print ''; - print ''; - - // Minimum buying price - print ''; - - print ''; - - // Minimum selling price - print ''; - - print ''; - - // Stock - if (! empty($conf->stock->enabled)) print ''; - - print ''; + + //$productstatic->ref=$value['label']; + $productstatic->ref=$value['ref']; + print ''; + print ''; + + // Best buying price + print ''; + print ''; + // Best selling price + print ''; + print ''; + + if (! empty($conf->stock->enabled)) print ''; // Real stock + print ''; + print ''; + + print ''."\n"; } - print ''; - print ''."\n"; } - else + + print ''; + print ''; + print ''; + + // Minimum buying price + print ''; + + print ''; + + // Minimum selling price + print ''; + + print ''; + + // Stock + if (! empty($conf->stock->enabled)) print ''; + + print ''; - print ''; - print ''; - } - - print '
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$langs->trans('ComposedProduct').''.$langs->trans('Label').''.$langs->trans('MinSupplierPrice').''.$langs->trans('MinCustomerPrice').''.$langs->trans('Stock').''.$langs->trans('Qty').''.$langs->trans('ComposedProductIncDecStock').'
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; + if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) { - $class=($class=='impair')?'pair':'impair'; - print '
'.$productstatic->getNomUrl(1, 'composition').''.$productstatic->label.''; - if ($product_fourn->find_min_price_product_fournisseur($productstatic->id) > 0) - { - print $langs->trans("BuyingPriceMinShort").': '; - if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0, 0); - else { print $langs->trans("NotDefined"); $notdefined++; $atleastonenotdefined++; } - } - print ''; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); + print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice, '', '', 0, 0, -1, $conf->currency)); - print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); - if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency); - else print $langs->trans($pricesell); - print ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation - print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); + if (is_numeric($pricesell)) print price($pricesell, '', '', 0, 0, -1, $conf->currency); + else print $langs->trans($pricesell); + print ''.$value['stock'].''.$nb_of_subproduct.''.($value['incdec']==1?'x':'' ).'
'; - print $langs->trans("TotalBuyingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); - print ''; - print $langs->trans("TotalSellingPriceMinShort"); - print ''; - if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; - print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); - print ' '; - if ($user->rights->produit->creer || $user->rights->service->creer) + else { - print ''; + $hide=''; + if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide=' hideobject'; // By default, we do not show this. It makes screen very difficult to understand + + print '
'; + for ($i=0; $i < $value['level']; $i++) print '     '; // Add indentation + print $productstatic->getNomUrl(1, 'composition').''.$productstatic->label.'    '.$value['nb'].' 
'; + print $langs->trans("TotalBuyingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($total, '', '', 0, 0, -1, $conf->currency)); + print ''; + print $langs->trans("TotalSellingPriceMinShort"); + print ''; + if ($atleastonenotdefined) print $langs->trans("Unknown").' ('.$langs->trans("SomeSubProductHaveNoPrices").')'; + print ($atleastonenotdefined?'':price($totalsell, '', '', 0, 0, -1, $conf->currency)); + print ' '; + if ($user->rights->produit->creer || $user->rights->service->creer) { - $colspan=8; - if (! empty($conf->stock->enabled)) $colspan++; - - print '
'.$langs->trans("None").'
'; - - /*if($user->rights->produit->creer || $user->rights->service->creer) { print ''; - }*/ + } + print ''; + print ''."\n"; + } + else + { + $colspan=8; + if (! empty($conf->stock->enabled)) $colspan++; + + print ''; + print ''.$langs->trans("None").''; + print ''; + } + + print ''; + + /*if($user->rights->produit->creer || $user->rights->service->creer) { + print ''; + }*/ + + print '
'; + print '
'; + - print ''; - //} // Form with product to add if ((empty($action) || $action == 'view' || $action == 'edit' || $action == 'search' || $action == 're-edit') && ($user->rights->produit->creer || $user->rights->service->creer)) From 18f1952e2d90048ac4e24beb20f43bacf5c34d49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 14:49:18 +0200 Subject: [PATCH 06/27] Fix set of properties --- htdocs/admin/emailcollector_list.php | 2 +- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/asset/list.php | 2 +- htdocs/bom/bom_list.php | 2 +- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/societe/website.php | 2 +- htdocs/ticket/list.php | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index a7e6a1aff67..14cb63cd923 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -439,7 +439,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index f6a526600d7..931d1168238 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -406,7 +406,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index c0c67c52331..7ca92570aa4 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -421,7 +421,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 62e6a21ac22..1adbf08143d 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -444,7 +444,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 816d1486970..d18a8c38cfe 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -458,7 +458,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 8fee6ca6664..f1b52911a0d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -485,7 +485,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index b102e6ebad4..7d097b6ecac 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -430,7 +430,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index ef19f266597..fa868de6e42 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -441,7 +441,7 @@ while ($i < min($num, $limit)) $objectwebsiteaccount->id = $obj->rowid; foreach($objectwebsiteaccount->fields as $key => $val) { - if (isset($obj->$key)) $objectwebsiteaccount->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } // Show here line of result diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 78fca5c7212..d6128037a5c 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -608,7 +608,7 @@ while ($i < min($num, $limit)) $object->id = $obj->rowid; foreach($object->fields as $key => $val) { - if (isset($obj->$key)) $object->$key = $obj->$key; + if (property_exists($obj, $key)) $object->$key = $obj->$key; } $langs->load("ticket"); From 11bcfb4f5ea28ad86a06c34d4756ebf5864de4df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 15:37:59 +0200 Subject: [PATCH 07/27] Fix check on VAT syntax not visible on list --- htdocs/core/lib/functions.lib.php | 5 +++-- htdocs/core/lib/functions2.lib.php | 4 ++-- htdocs/societe/list.php | 11 ++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bcd1b555906..bce137d1e11 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3441,16 +3441,17 @@ function img_info($titlealt = 'default') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1, add float: right. Can't be "class" attribute. + * @param string $morecss Add more CSS * @return string Return img tag */ -function img_warning($titlealt = 'default', $moreatt = '') +function img_warning($titlealt = 'default', $moreatt = '', $morecss = 'pictowarning') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); //return '
'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'
'; - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); + return img_picto($titlealt, 'warning.png', 'class="valignmiddle'.($morecss?' '.$morecss:'').'"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); } /** diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index fac25451ece..83e3d87f919 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -568,7 +568,7 @@ function isValidUrl($url, $http = 0, $pass = 0, $port = 0, $path = 0, $query = 0 * Check if VAT numero is valid (check done on syntax only, no database or remote access) * * @param Societe $company VAT number - * @return int 1=Check is OK, 0=Check is KO + * @return int 1=Check is OK, 0=Check is KO */ function isValidVATID($company) { @@ -577,7 +577,7 @@ function isValidVATID($company) $vatprefix = $company->country_code; if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; else $vatprefix = preg_quote($vatprefix, '/'); - if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', $company->tva_intra)) + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.\s]{5,12}$/', $company->tva_intra)) { return 0; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 13f179b99cc..68d61e627e1 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -35,6 +35,7 @@ require_once '../main.inc.php'; include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; @@ -989,6 +990,8 @@ while ($i < min($num, $limit)) $companystatic->fournisseur=$obj->fournisseur; $companystatic->code_client=$obj->code_client; $companystatic->code_fournisseur=$obj->code_fournisseur; + $companystatic->tva_intra=$obj->tva_intra; + $companystatic->country_code=$obj->country_code; $companystatic->code_compta_client=$obj->code_compta; $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; @@ -1166,7 +1169,13 @@ while ($i < min($num, $limit)) } if (! empty($arrayfields['s.tva_intra']['checked'])) { - print "".$obj->tva_intra."\n"; + print ""; + print $obj->tva_intra; + if ($obj->tva_intra && ! isValidVATID($companystatic)) + { + print img_warning("BadVATNumber", '', ''); + } + print "\n"; if (! $i) $totalarray['nbfield']++; } // Type From 5e690ddd414ab60ea7fa33d577cde475f5f91623 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 15:41:22 +0200 Subject: [PATCH 08/27] Fix avoid subquery into query --- htdocs/societe/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 68d61e627e1..117a3d30eed 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -374,7 +374,7 @@ $sql.= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,"; $sql.= " s2.nom as name2,"; $sql.= " typent.code as typent_code,"; $sql.= " staff.code as staff_code,"; -$sql.= " country.code as country_code,"; +$sql.= " country.code as country_code, country.label as country_label,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " region.code_region as region_code, region.nom as region_name"; // We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) @@ -1094,8 +1094,8 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['country.code_iso']['checked'])) { print ''; - $tmparray=getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + $labelcountry=($obj->code && ($langs->trans("Country".$obj->code)!="Country".$obj->code))?$langs->trans("Country".$obj->code):$obj->country_label; + print $labelcountry; print ''; if (! $i) $totalarray['nbfield']++; } From 65acd6ef6079f70073f59a237a7b4dd3eec8bd11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 15:48:07 +0200 Subject: [PATCH 09/27] Fix function to check vat syntax --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 83e3d87f919..9e66d2fdfd0 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -577,7 +577,7 @@ function isValidVATID($company) $vatprefix = $company->country_code; if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; else $vatprefix = preg_quote($vatprefix, '/'); - if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.\s]{5,12}$/', $company->tva_intra)) + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', str_replace(' ', '', $company->tva_intra))) { return 0; } From 70aa77ac7edebdfd0d4d46ece584c3a32d65b6bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 15:54:15 +0200 Subject: [PATCH 10/27] Remove spaces into VAT validation --- htdocs/societe/checkvat/checkVatPopup.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index f5202d87b96..7fa4e8b2016 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -54,6 +54,7 @@ if (! $vatNumber) else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); + $vatNumber = str_replace(' ', '', $vatNumber); $countryCode=substr($vatNumber, 0, 2); $vatNumber=substr($vatNumber, 2); From 0bd47a3f5054a50537499a8a6d96357ba65334db Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 15:58:44 +0200 Subject: [PATCH 11/27] Fix responsive --- htdocs/societe/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index af134dcd354..be9ff83cb45 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1367,10 +1367,13 @@ else if (! empty($conf->use_javascript_ajax)) { + $widthpopup = 600; + if ( empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; From 2b90df6f80d8b417b528a3c0f95fc80a7dcf4c96 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 16:08:21 +0200 Subject: [PATCH 12/27] Fix responsive --- htdocs/core/js/lib_head.js.php | 3 ++- htdocs/societe/card.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index db86d5e8b58..cf8557de961 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -841,10 +841,11 @@ function copyToClipboard(text,text2) * @return boolean False * @see document_preview */ -function newpopup(url,title) { +function newpopup(url, title) { var argv = newpopup.arguments; var argc = newpopup.arguments.length; tmp=url; + console.log("newpopup "+argv[2]+" "+argv[3]); var l = (argc > 2) ? argv[2] : 600; var h = (argc > 3) ? argv[3] : 400; var left = (screen.width - l)/2; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index be9ff83cb45..9c688c19c99 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1368,12 +1368,12 @@ else if (! empty($conf->use_javascript_ajax)) { $widthpopup = 600; - if ( empty($conf->dol_use_jmobile)) $widthpopup = 350; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; $heightpopup = 400; print "\n"; print ''; print "\n"; @@ -2031,10 +2031,13 @@ else if ($conf->use_javascript_ajax) { - print "\n"; + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; + print "\n"; print ''; print "\n"; @@ -2440,10 +2443,13 @@ else if ($conf->use_javascript_ajax) { + $widthpopup = 600; + if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + $heightpopup = 400; print "\n"; print ''; print "\n"; From 20caf641bfb906eddb00caf1239a02a2ab4b36f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 16:12:29 +0200 Subject: [PATCH 13/27] Fix translation of country --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 117a3d30eed..b0653c83962 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1094,7 +1094,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['country.code_iso']['checked'])) { print ''; - $labelcountry=($obj->code && ($langs->trans("Country".$obj->code)!="Country".$obj->code))?$langs->trans("Country".$obj->code):$obj->country_label; + $labelcountry=($obj->country_code && ($langs->trans("Country".$obj->country_code)!="Country".$obj->country_code))?$langs->trans("Country".$obj->country_code):$obj->country_label; print $labelcountry; print ''; if (! $i) $totalarray['nbfield']++; From fb95fe0606a2cb53ac7237e8ef2f503f2b61c43d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 16:15:26 +0200 Subject: [PATCH 14/27] Check vat is not case sensitive --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 9e66d2fdfd0..79659e57750 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -577,7 +577,7 @@ function isValidVATID($company) $vatprefix = $company->country_code; if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; else $vatprefix = preg_quote($vatprefix, '/'); - if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/', str_replace(' ', '', $company->tva_intra))) + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/i', str_replace(' ', '', $company->tva_intra))) { return 0; } From e90bef1cd89bbaa1f08c1780a66a8509251c5c4a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 16:41:19 +0200 Subject: [PATCH 15/27] Fix Clean vat number for vies --- htdocs/societe/checkvat/checkVatPopup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 7fa4e8b2016..021a932f388 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -54,7 +54,7 @@ if (! $vatNumber) else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); - $vatNumber = str_replace(' ', '', $vatNumber); + $vatNumber = str_replace(array(' ', '.'), '', $vatNumber); $countryCode=substr($vatNumber, 0, 2); $vatNumber=substr($vatNumber, 2); From c8970c0283ed275c001214e0fc2628064920ba49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 16:50:53 +0200 Subject: [PATCH 16/27] Fix vat validator --- htdocs/core/lib/functions2.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 79659e57750..a315747b8f6 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -577,7 +577,7 @@ function isValidVATID($company) $vatprefix = $company->country_code; if ($vatprefix == 'GR') $vatprefix = '(EL|GR)'; else $vatprefix = preg_quote($vatprefix, '/'); - if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,12}$/i', str_replace(' ', '', $company->tva_intra))) + if (! preg_match('/^'.$vatprefix.'[a-zA-Z0-9\-\.]{5,14}$/i', str_replace(' ', '', $company->tva_intra))) { return 0; } From 1e90a06ecbcbb6c208a1254d9a0fe697bba3cd66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 19:21:55 +0200 Subject: [PATCH 17/27] Fix module builder --- htdocs/bom/bom_list.php | 46 +++++++++---------- .../modulebuilder/template/myobject_list.php | 34 +++++++------- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 1adbf08143d..bbb51211137 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -372,12 +372,18 @@ print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; - if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield='center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -399,11 +405,11 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; @@ -451,24 +457,16 @@ while ($i < min($num, $limit)) print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + $cssforfield=(empty($val['css'])?'':$val['css']); + if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; - - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if ($key == 'status') print $object->getLibStatut(5); elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); else print $object->showOutputField($val, $key, $obj->$key, ''); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index f1b52911a0d..d1e69a18cc4 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -413,12 +413,18 @@ print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + else print ''; + print '
'; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) print ''; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -440,11 +446,11 @@ print ''."\n"; print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; + $cssforfield=(empty($val['css'])?'':$val['css']); if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; + elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; + elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price'))) $cssforfield.=($cssforfield?' ':'').'right'; if (! empty($arrayfields['t.'.$key]['checked'])) { print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; @@ -492,7 +498,7 @@ while ($i < min($num, $limit)) print ''; foreach($object->fields as $key => $val) { - $cssforfield=''; + $cssforfield=(empty($val['css'])?'':$val['css']); if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; @@ -503,13 +509,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print ''; if ($key == 'status') print $object->getLibStatut(5); elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), ''); else print $object->showOutputField($val, $key, $obj->$key, ''); From 7eeb0283759157ab362982e9b6490e7b2e862167 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 19:34:08 +0200 Subject: [PATCH 18/27] Debug modulebuilder --- htdocs/bom/class/bom.class.php | 24 ++++++++----------- .../template/class/myobject.class.php | 24 ++++++++----------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 6ada9b167f9..9f6a2a7a6a6 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -62,7 +62,7 @@ class BOM extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; - const STATUS_DISABLED = -1; + const STATUS_CANCELED = 9; /** @@ -105,7 +105,7 @@ class BOM extends CommonObject 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), - 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')), + 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Enabled', 9=>'Disabled')), ); public $rowid; public $ref; @@ -758,8 +758,9 @@ class BOM extends CommonObject { global $langs; //$langs->load("mrp"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); } if ($mode == 0) @@ -772,28 +773,23 @@ class BOM extends CommonObject } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 06658b71576..c36debb9a12 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -60,7 +60,7 @@ class MyObject extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; - const STATUS_DISABLED = -1; + const STATUS_DISABLED = 9; /** @@ -105,7 +105,7 @@ class MyObject extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Canceled')), + 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', 9=>'Canceled')), ); /** @@ -541,8 +541,9 @@ class MyObject extends CommonObject { global $langs; //$langs->load("mymodule"); - $this->labelstatus[1] = $langs->trans('Enabled'); - $this->labelstatus[0] = $langs->trans('Disabled'); + $this->labelstatus[self::STATUS_DRAFT] = $langs->trans('Draft'); + $this->labelstatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); + $this->labelstatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); } if ($mode == 0) @@ -555,28 +556,23 @@ class MyObject extends CommonObject } elseif ($mode == 2) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 3) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 4) { - if ($status == 1) return img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; - elseif ($status == 0) return img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; + return img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle').' '.$this->labelstatus[$status]; } elseif ($mode == 5) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } elseif ($mode == 6) { - if ($status == 1) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut4', '', false, 0, 0, '', 'valignmiddle'); - elseif ($status == 0) return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut5', '', false, 0, 0, '', 'valignmiddle'); + return $this->labelstatus[$status].' '.img_picto($this->labelstatus[$status], 'statut'.$status, '', false, 0, 0, '', 'valignmiddle'); } } From c131363dd146856891dec86804cf9f516b57f66a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 19:40:48 +0200 Subject: [PATCH 19/27] Debug modulebuilder --- htdocs/bom/bom_card.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index fddba91eeeb..b90cd509352 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -320,7 +320,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print '

'; + print '
'; dol_fiche_end(); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e24c6b6d32d..3543722670d 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -356,7 +356,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print '

'; + print '
'; dol_fiche_end(); From 815a467eb7ab5202318fd3931362a08e2244436f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 19:54:03 +0200 Subject: [PATCH 20/27] Debug clone of products --- htdocs/product/card.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 2c8b70efbd1..847c6325b50 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -497,7 +497,7 @@ if (empty($reshook)) $originalId = $id; if ($object->id > 0) { - $object->ref = GETPOST('clone_ref'); + $object->ref = GETPOST('clone_ref', 'alphanohtml'); $object->status = 0; $object->status_buy = 0; $object->id = null; @@ -505,7 +505,8 @@ if (empty($reshook)) if ($object->check()) { - $id = $object->create($user); + $object->context['createfromclone'] = 'createfromclone'; + $id = $object->create($user); if ($id > 0) { if (GETPOST('clone_composition')) @@ -546,7 +547,7 @@ if (empty($reshook)) $object->fetch($id); } else - { + { $db->rollback(); if (count($object->errors)) { @@ -560,6 +561,8 @@ if (empty($reshook)) } } } + + unset($object->context['createfromclone']); } } else @@ -1966,7 +1969,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 260, 600); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneProduct', $object->ref), 'confirm_clone', $formquestionclone, 'yes', 'action-clone', 350, 600); } From 111239094ab4c65b2b3d44ef876fb437dce4b7aa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 22 May 2019 20:28:24 +0200 Subject: [PATCH 21/27] Work to finish module BOM for v10 --- htdocs/bom/bom_card.php | 6 +- htdocs/bom/tpl/objectline_create.tpl.php | 216 +++++++++++++++ htdocs/bom/tpl/objectline_edit.tpl.php | 325 ++++++++++++++++++++++ htdocs/bom/tpl/objectline_view.tpl.php | 330 +++++++++++++++++++++++ htdocs/core/class/commonobject.class.php | 4 +- 5 files changed, 876 insertions(+), 5 deletions(-) create mode 100644 htdocs/bom/tpl/objectline_create.tpl.php create mode 100644 htdocs/bom/tpl/objectline_edit.tpl.php create mode 100644 htdocs/bom/tpl/objectline_view.tpl.php diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index b90cd509352..e81d86f5eea 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -347,7 +347,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
'; - if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; + if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 0, 0, 0, '', 'maxwidth75'); + else print ''; + print '
'; } @@ -363,14 +363,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action != 'editline') { // Add products/services form -// $object->formAddObjectLine(1, $mysoc, $soc); + $object->formAddObjectLine(1, $mysoc, $soc, '/bom/tpl'); $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook } } - if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + if (! empty($object->lines) || ($object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php new file mode 100644 index 00000000000..2937f5af45e --- /dev/null +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -0,0 +1,216 @@ + + * Copyright (C) 2010-2014 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2014 Florian Henry + * Copyright (C) 2014 Raphaël Doursenaud + * Copyright (C) 2015-2016 Marcos García + * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Ferran Marcet + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 or 2 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) { + print "Error: this template page cannot be called directly as an URL"; + exit; +} + + +if (! isset($dateSelector)) global $dateSelector; // Take global var only if not already defined into function calling (for example formAddObjectLine) +global $forceall, $forcetoshowtitlelines, $senderissupplier, $inputalsopricewithtax; + +if (! isset($dateSelector)) $dateSelector=1; // For backward compatibility +elseif (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; + + +// Define colspan for the button 'Add' +$colspan = 3; // Columns: total ht + col edit + col delete +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan++;//Add column for Total (currency) if required +if (in_array($object->element, array('propal','commande','order','facture','facturerec','invoice','supplier_proposal','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +//print $object->element; + +// Lines for extrafield +$objectline = new BOMLine($this->db); +?> + + +lines) == 0 || $forcetoshowtitlelines); +if ($nolinesbefore) { +?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + +
trans('AddNewLine'); ?>trans("FreeZone"); ?> + + trans('Qty'); ?> + global->PRODUCT_USE_UNITS) + { + print ''; + print ''; + print $langs->trans('Unit'); + print ''; + } + ?> + trans('Lost'); ?> +   + + + +global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay++; + echo ''; + } + + $coldisplay++; + ?> + + + product->enabled) || ! empty($conf->service->enabled)) + { + if ($forceall >= 0 && $freelines) echo '
'; + echo ''; + + $filtertype=''; + if (! empty($object->element) && $object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS)) $filtertype='1'; + + if (! empty($conf->global->ENTREPOT_EXTRA_STATUS)) + { + // hide products in closed warehouse, but show products for internal transfer + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + } + else + { + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + } + + echo ''; + } + + $coldisplay++; + ?> + "> + + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; + } + $remise_percent = $buyer->remise_percent; + if($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') + { + $remise_percent = $seller->remise_supplier_percent; + } + + $coldisplay++; + ?> + ">% + + + + + + +showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + + + + diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php new file mode 100644 index 00000000000..3763b771854 --- /dev/null +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -0,0 +1,325 @@ + + * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2018 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $seller, $buyer + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax; +if (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; + + +// Define colspan for the button 'Add' +$colspan = 3; // Col total ht + col edit + col delete +if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc +if (in_array($object->element, array('propal','supplier_proposal','facture','facturerec','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button +if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) $colspan+=2; +?> + + + + + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + +
+ + + + + + + + fk_product > 0) { ?> + + fk_parent_line > 0) echo img_picto('', 'rightarrow'); + ?> + + product_type==1) echo img_object($langs->trans('ShowService'), 'service'); + else print img_object($langs->trans('ShowProduct'), 'product'); + echo ' '.$line->ref; + ?> + + product_label); + ?> + +

+ + + + fk_parent_line); + $parameters=array('line'=>$line,'fk_parent_line'=>$fk_parent_line,'var'=>$var,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer); + $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); + } + + ?> + + + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + $coldisplay++; + ?> + + fk_prev_id == null) { + print '' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . ''; + } else { + print '%'; + } + + $coldisplay++; + print 'fk_prev_id != null) print ' readonly'; + print '>'; + + if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + $coldisplay++; + print ''; + } + + if ($inputalsopricewithtax) + { + $coldisplay++; + print 'fk_prev_id != null) print ' readonly'; + print '>'; + } + ?> + + info_bits & 2) != 2) { + // I comment this because it shows info even when not required + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated + // must also not be output for most entities (proposal, intervention, ...) + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; + print 'fk_prev_id != null ) print ' readonly'; + print '>'; + } else { ?> +   + + + + global->PRODUCT_USE_UNITS) + { + $coldisplay++; + print ''; + print $form->selectUnits($line->fk_unit, "units"); + print ''; + } + ?> + + + info_bits & 2) != 2) { + print 'fk_prev_id != null ) print ' readonly'; + print '>%'; + } else { ?> +   + + + + + + ">
+ "> + + + +showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var],'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + +service->enabled) && $line->product_type == 1 && $dateSelector) { ?> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> + global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); + print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); + print ' '.$langs->trans('to').' '; + print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); + print '' + ?> + + + + + + + diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php new file mode 100644 index 00000000000..46c25e3674c --- /dev/null +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -0,0 +1,330 @@ + + * Copyright (C) 2010-2011 Laurent Destailleur + * Copyright (C) 2012-2013 Christophe Battarel + * Copyright (C) 2012 Cédric Salvador + * Copyright (C) 2012-2014 Raphaël Doursenaud + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2017 Juanjo Menent + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * Need to have following variables defined: + * $object (invoice, order, ...) + * $conf + * $langs + * $dateSelector + * $forceall (0 by default, 1 for supplier invoices/orders) + * $element (used to test $user->rights->$element->creer) + * $permtoedit (used to replace test $user->rights->$element->creer) + * $senderissupplier (0 by default, 1 for supplier invoices/orders) + * $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax) + * $object_rights->creer initialized from = $object->getRights() + * $disableedit, $disablemove, $disableremove + * + * $type, $text, $description, $line + */ + +// Protection to avoid direct call of template +if (empty($object) || ! is_object($object)) +{ + print "Error, template page can't be called as URL"; + exit; +} + + +global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax; + +if (empty($dateSelector)) $dateSelector=0; +if (empty($forceall)) $forceall=0; +if (empty($senderissupplier)) $senderissupplier=0; +if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; +if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; + +// add html5 elements +$domData = ' data-element="'.$line->element.'"'; +$domData .= ' data-id="'.$line->id.'"'; +$domData .= ' data-qty="'.$line->qty.'"'; +$domData .= ' data-product_type="'.$line->product_type.'"'; + + +?> + + + > + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + +
+ info_bits & 2) == 2) { + ?> + + trans("ShowReduc"), 'reduc').' '; + if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit"); + elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived"); + elseif ($line->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid"); + //else $txt=$langs->trans("Discount"); + print $txt; + ?> + + description) + { + if ($line->description == '(CREDIT_NOTE)' && $line->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote", $discount->getNomUrl(0)); + } + elseif ($line->description == '(DEPOSIT)' && $line->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); + // Add date of deposit + if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) + echo ' ('.dol_print_date($discount->datec).')'; + } + elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); + } + elseif ($line->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + { + $discount=new DiscountAbsolute($this->db); + $discount->fetch($line->fk_remise_except); + echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); + } + else + { + echo ($txt?' - ':'').dol_htmlentitiesbr($line->description); + } + } + } + else + { + $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE?'dayhour':'day'; + + if ($line->fk_product > 0) + { + echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } + else + { + if ($type==1) $text = img_object($langs->trans('Service'), 'service'); + else $text = img_object($langs->trans('Product'), 'product'); + + if (! empty($line->label)) { + $text.= ' '.$line->label.''; + echo $form->textwithtooltip($text, dol_htmlentitiesbr($line->description), 3, '', '', $i, 0, (!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } else { + if (! empty($line->fk_parent_line)) echo img_picto('', 'rightarrow'); + echo $text.' '.dol_htmlentitiesbr($line->description); + } + } + + // Show date range + if ($line->element == 'facturedetrec') { + if ($line->date_start_fill || $line->date_end_fill) echo '
'; + if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); + if ($line->date_start_fill && $line->date_end_fill) echo ' - '; + if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill); + if ($line->date_start_fill || $line->date_end_fill) echo '
'; + } + else { + if ($line->date_start || $line->date_end) echo '
'.get_date_range($line->date_start, $line->date_end, $format).'
'; + //echo get_date_range($line->date_start, $line->date_end, $format); + } + + // Add description in form + if ($line->fk_product > 0 && ! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + print (! empty($line->description) && $line->description!=$line->product_label)?'
'.dol_htmlentitiesbr($line->description):''; + } + } + + if (! empty($conf->accounting->enabled) && $line->fk_accounting_account > 0) + { + $accountingaccount=new AccountingAccount($this->db); + $accountingaccount->fetch($line->fk_accounting_account); + echo '

' . $langs->trans('AccountingAffectation') . ' : ' . $accountingaccount->getNomUrl(0, 1, 1); + } + + ?> + + element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines + { + ?> + ref_fourn?$line->ref_fourn:$line->ref_supplier); + ?> + + tva_tx)) $positiverates.=($positiverates?'/':'').price2num($line->tva_tx); + if (price2num($line->total_localtax1)) $positiverates.=($positiverates?'/':'').price2num($line->localtax1_tx); + if (price2num($line->total_localtax2)) $positiverates.=($positiverates?'/':'').price2num($line->localtax2_tx); + if (empty($positiverates)) $positiverates='0'; + echo vatrate($positiverates.($line->vat_src_code?' ('.$line->vat_src_code.')':''), '%', $line->info_bits); + //echo vatrate($line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), '%', $line->info_bits); + ?> + + subprice); ?> + + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + multicurrency_subprice); ?> + + + + pu_ttc)?price($line->pu_ttc):price($line->subprice)); ?> + + + + info_bits & 2) != 2) && $line->special_code != 3) { + // I comment this because it shows info even when not required + // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated + // must also not be output for most entities (proposal, intervention, ...) + //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; + echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price + } else echo ' '; + ?> + + + global->PRODUCT_USE_UNITS) + { + print ''; + $label = $line->getLabelOfUnit('short'); + if ($label !== '') { + print $langs->trans($label); + } + print ''; + } + ?> + + remise_percent) && $line->special_code != 3) { ?> + remise_percent, $langs); + ?> + +   + global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); + + ?> + + special_code == 3) { ?> + trans('Option'); ?> + + global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print 'country_code).'='.price($line->total_ht); + print '
'.$langs->transcountry("TotalVAT", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_tva); + if (price2num($line->total_localtax1)) print '
'.$langs->transcountry("TotalLT1", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax1); + if (price2num($line->total_localtax2)) print '
'.$langs->transcountry("TotalLT2", ($senderissupplier?$object->thirdparty->country_code:$mysoc->country_code)).'='.price($line->total_localtax2); + print '
'.$langs->transcountry("TotalTTC", $mysoc->country_code).'='.price($line->total_ttc); + print '">'; + } + print price($line->total_ht); + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print '
'; + } + ?> + + multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + multicurrency_total_ht); ?> + + + + total_ttc); ?> + + + + statut == 0 && ($object_rights->creer) && $action != 'selectlines' ) { ?> + + info_bits & 2) == 2 || ! empty($disableedit)) { ?> + + id.'#line_'.$line->id; ?>"> + + + + + + + fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation + print 'id . '">'; + print img_delete(); + print ''; + } + ?> + + + 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> + + 0) { ?> + id; ?>"> + + + + + id; ?>"> + + + + + + browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>> + + + + + + + + + +showOptionals($extrafieldsline, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); +} +?> + + diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ab29a100894..8444ee962fa 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3862,7 +3862,7 @@ abstract class CommonObject * @param Societe $buyer Object thirdparty who buy * @return void */ - public function formAddObjectLine($dateSelector, $seller, $buyer) + public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl') { global $conf,$user,$langs,$object,$hookmanager; global $form,$bcnd,$var; @@ -3874,7 +3874,7 @@ abstract class CommonObject // Output template part (modules that overwrite templates must declare this into descriptor) // Use global variables + $dateSelector + $seller and $buyer - $dirtpls=array_merge($conf->modules_parts['tpl'], array('/core/tpl')); + $dirtpls=array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); foreach($dirtpls as $reldir) { $tpl = dol_buildpath($reldir.'/objectline_create.tpl.php'); From 43e098caae0cc177e41c898fb41092c61ab69b47 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2019 12:35:53 +0200 Subject: [PATCH 22/27] Fix phpcs --- htdocs/core/class/commonobject.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8444ee962fa..ede8070405a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3860,6 +3860,7 @@ abstract class CommonObject * @param int $dateSelector 1=Show also date range input fields * @param Societe $seller Object thirdparty who sell * @param Societe $buyer Object thirdparty who buy + * @param string $defaulttpldir Directory where to find the template * @return void */ public function formAddObjectLine($dateSelector, $seller, $buyer, $defaulttpldir = '/core/tpl') From 5f639f611a43ebb7f39f352c7f06ac4f2104ec0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2019 13:12:04 +0200 Subject: [PATCH 23/27] Try to introduce rules on tab --- dev/setup/codesniffer/ruleset.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 30099b40be4..2c82435e401 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -169,6 +169,13 @@ + + + + + + + From e8ba312d2a7a74721169cb41b2f2bdbf56860209 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2019 14:25:16 +0200 Subject: [PATCH 24/27] Fix phpcs --- dev/setup/codesniffer/ruleset.xml | 37 ++++++++++++++++--- htdocs/adherents/class/adherent.class.php | 2 +- .../adherents/class/adherent_type.class.php | 2 +- htdocs/adherents/htpasswd.php | 6 +-- htdocs/adherents/stats/geo.php | 2 +- htdocs/adherents/subscription/list.php | 2 +- .../adherents/tpl/linkedobjectblock.tpl.php | 8 ++-- htdocs/adherents/type.php | 6 +-- 8 files changed, 45 insertions(+), 20 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 2c82435e401..00ee3e5fb8c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -75,10 +75,13 @@ + @@ -97,8 +100,11 @@ - - + + + + 0 + + + + + 0 @@ -152,7 +162,10 @@ - + + + 0 + @@ -169,6 +182,7 @@ + @@ -177,6 +191,7 @@ + @@ -317,22 +332,29 @@ - + + + + 0 + 0 0 + 0 @@ -341,12 +363,15 @@ + 0 + 0 + 0 diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index fc61e56115c..3119e044be0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -596,7 +596,7 @@ class Adherent extends CommonObject { while ($obj=$this->db->fetch_object($resql2)) { - $this->type=$obj->label; + $this->type=$obj->label; } } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 5e7847efa82..3a39632d783 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -411,7 +411,7 @@ class AdherentType extends CommonObject } } - /** + /** * Return translated label by the nature of a adherent (physical or moral) * * @param string $morphy Nature of the adherent (physical or moral) diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index 4d860abcc68..885e453c6f1 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -43,13 +43,13 @@ if (empty($sortorder)) { $sortorder="ASC"; } if (empty($sortfield)) { $sortfield="d.login"; } if (! isset($statut)) { - $statut = 1 ; + $statut = 1 ; } if (! isset($cotis)) { - // by default, members must be up to date of subscription - $cotis=1; + // by default, members must be up to date of subscription + $cotis=1; } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 2ae7e2d0001..bffb3418dba 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -235,7 +235,7 @@ else print '
'; print ''.$langs->trans("MembersStatisticsByTown").'
'; print '
';//+ - print ''.$langs->trans("MembersStatisticsByRegion").'
';//+ + print ''.$langs->trans("MembersStatisticsByRegion").'
';//+ } print '
'; } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 574f061b25d..8e8482d4398 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -306,7 +306,7 @@ if (! empty($arrayfields['d.fk_type']['checked'])) { print ''; print ''; - print''; + print''; } if (! empty($arrayfields['d.lastname']['checked'])) diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index e85eed336fb..99e3cc5f526 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -47,10 +47,10 @@ foreach($linkedObjectBlock as $key => $objectlink) dateh, 'day'); ?> rights->adherent->lire) { - $total = $total + $objectlink->amount; - echo price($objectlink->amount); - } ?> + if ($user->rights->adherent->lire) { + $total = $total + $objectlink->amount; + echo price($objectlink->amount); + } ?> ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 1a5c368f177..650a466140c 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -281,9 +281,9 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''.dol_escape_htmltag($objp->label).''; print ''; - if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } - elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } - else print $langs->trans("Physical & Morale"); + if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } + elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } + else print $langs->trans("Physical & Morale"); print ''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; From ba7b60138769a2285ecbf41cefda740839935a36 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2019 14:29:37 +0200 Subject: [PATCH 25/27] Fix phpcs --- dev/setup/codesniffer/ruleset.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 00ee3e5fb8c..daf73e5b2a7 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -182,7 +182,7 @@ - + From cc971f420425bca96ffdb40eaa40ec6b626bc833 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2019 14:30:34 +0200 Subject: [PATCH 26/27] Fix ident --- htdocs/webservices/server_actioncomm.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index ddeaba0e955..a3e09006b87 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -274,7 +274,6 @@ function getActionComm($authentication, $id) $result=$actioncomm->fetch($id); if ($result > 0) { - $actioncomm_result_fields=array( 'id' => $actioncomm->id, 'ref'=> $actioncomm->ref, @@ -299,19 +298,20 @@ function getActionComm($authentication, $id) 'contactid'=> $actioncomm->contactid, 'projectid'=> $actioncomm->fk_project, 'fk_element'=> $actioncomm->fk_element, - 'elementtype'=> $actioncomm->elementtype); + 'elementtype'=> $actioncomm->elementtype + ); - //Retreive all extrafield for actioncomm - // fetch optionals attributes and labels - $extrafields=new ExtraFields($db); - $extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true); - //Get extrafield values - $actioncomm->fetch_optionals(); + // Retreive all extrafield for actioncomm + // fetch optionals attributes and labels + $extrafields=new ExtraFields($db); + $extralabels=$extrafields->fetch_name_optionals_label('actioncomm', true); + //Get extrafield values + $actioncomm->fetch_optionals(); - foreach($extrafields->attribute_label as $key=>$label) - { - $actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); - } + foreach($extrafields->attribute_label as $key=>$label) + { + $actioncomm_result_fields=array_merge($actioncomm_result_fields, array('options_'.$key => $actioncomm->array_options['options_'.$key])); + } // Create $objectresp = array( From ceba186de8391990b0aa3e320d9672c0ae32ab49 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 May 2019 22:42:26 +0200 Subject: [PATCH 27/27] Trans --- htdocs/langs/en_US/admin.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e0c2afd7e34..5fc1994247c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1889,4 +1889,5 @@ IFTTT_SERVICE_KEY=IFTTT Service key IFTTT_DOLIBARR_ENDPOINT_SECUREKEY=Security key to secure the endpoint URL used by IFTTT to send messages to your Dolibarr. IFTTTDesc=This module is designed to trigger events on IFTTT and/or to execute some action on external IFTTT triggers. UrlForIFTTT=URL endpoint for IFTTT -YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account \ No newline at end of file +YouWillFindItOnYourIFTTTAccount=You will find it on your IFTTT account +EndPointFor=End point for %s : %s \ No newline at end of file