From 5690b7d59543cabe129887b1681827df23334a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 20 Sep 2022 10:14:11 +0200 Subject: [PATCH 01/15] add badges --- htdocs/core/lib/member.lib.php | 18 +++++++++++++++--- htdocs/core/lib/order.lib.php | 32 ++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 677d8cfdaef..64c0d429048 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -20,8 +20,8 @@ */ /** - * \file htdocs/core/lib/member.lib.php - * \brief Functions for module members + * \file htdocs/core/lib/member.lib.php + * \brief Functions for module members */ /** @@ -182,7 +182,11 @@ function member_type_prepare_head(AdherentType $object) */ function member_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('adherent'); + $extrafields->fetch_name_optionals_label('adherent_type'); $h = 0; $head = array(); @@ -205,11 +209,19 @@ function member_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/member_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsMember"); + $nbExtrafields = $extrafields->attributes['adherent']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/member_type_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsMemberType"); + $nbExtrafields = $extrafields->attributes['adherent_type']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes_type'; $h++; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 9128be56ea1..174ec36834b 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -42,7 +42,7 @@ function commande_prepare_head(Commande $object) $h = 0; $head = array(); - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $head[$h][0] = DOL_URL_ROOT.'/commande/card.php?id='.$object->id; $head[$h][1] = $langs->trans("CustomerOrder"); $head[$h][2] = 'order'; @@ -61,27 +61,27 @@ function commande_prepare_head(Commande $object) } if ((isModEnabled('expedition_bon') && $user->hasRight('expedition', 'lire')) - || ($conf->delivery_note->enabled && $user->hasRight('expedition', 'delivery', 'lire'))) { + || (isModEnabled('delivery_note') && $user->hasRight('expedition', 'delivery', 'lire'))) { $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; - if ($conf->expedition_bon->enabled) { + if (isModEnabled('expedition_bon')) { $text .= $langs->trans("Shipments"); } - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled) { + if (isModEnabled('expedition_bon') && isModEnabled('delivery_note')) { $text .= ' - '; } - if ($conf->delivery_note->enabled) { + if (isModEnabled('delivery_note')) { $text .= $langs->trans("Receivings"); } if ($nbShipments > 0 || $nbReceiption > 0) { $text .= ''.($nbShipments ? $nbShipments : 0); } - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) { + if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ' - '; } - if ($conf->expedition_bon->enabled && $conf->delivery_note->enabled && ($nbShipments > 0 || $nbReceiption > 0)) { + if (isModEnabled('expedition_bon') && isModEnabled('delivery_note') && ($nbShipments > 0 || $nbReceiption > 0)) { $text .= ($nbReceiption ? $nbReceiption : 0); } if ($nbShipments > 0 || $nbReceiption > 0) { @@ -145,7 +145,11 @@ function commande_prepare_head(Commande $object) */ function order_admin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('commande'); + $extrafields->fetch_name_optionals_label('commandedet'); $h = 0; $head = array(); @@ -159,11 +163,19 @@ function order_admin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/admin/order_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); + $nbExtrafields = $extrafields->attributes['commande']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes'; $h++; $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); + $nbExtrafields = $extrafields->attributes['commandedet']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributeslines'; $h++; @@ -186,7 +198,7 @@ function getCustomerOrderPieChart($socid = 0) $result = ''; - if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) { + if (!isModEnabled('commande') || !$user->hasRight('commande', 'lire')) { return ''; } @@ -276,7 +288,7 @@ function getCustomerOrderPieChart($socid = 0) $result .= "\n"; } } - if ($conf->use_javascript_ajax) { + if (!empty($conf->use_javascript_ajax)) { $result .= ''; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; From 9d1a4ede6e2609003a75f0588f268b645c3785e6 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 21 Sep 2022 11:06:54 +0200 Subject: [PATCH 02/15] Close #22245 : new increase holiday massaction --- htdocs/core/actions_massactions.inc.php | 51 ++++++++++++++++++++++++ htdocs/core/tpl/massactions_pre.tpl.php | 23 +++++++++++ htdocs/holiday/define_holiday.php | 53 ++++++++++++++++++++----- htdocs/langs/en_US/holiday.lang | 6 +++ 4 files changed, 124 insertions(+), 9 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2854a631e42..aa73c9cdc8a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1507,6 +1507,57 @@ if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $ } } +if (!$error && ($massaction == 'increaseholiday' || ($action == 'increaseholiday' && $confirm == 'yes')) && $permissiontoapprove) { + $db->begin(); + $objecttmp = new $objectclass($db); + $nbok = 0; + $typeholiday = GETPOST('typeholiday', 'alpha'); + $nbdaysholidays = GETPOST('nbdaysholidays', 'double'); + + if ($nbdaysholidays <= 0) { + setEventMessages($langs->trans("WrongAmount"), "", 'errors'); + $error++; + } + + if (!$error) { + foreach ($toselect as $toselectid) { + $balancecpuser = $objecttmp->getCPforUser($toselectid, $typeholiday); + if (!empty($balancecpuser)) { + $newnbdaysholidays = $nbdaysholidays + $balancecpuser; + } else { + $newnbdaysholidays = $nbdaysholidays; + } + $result = $holiday->addLogCP($user->id, $toselectid, $langs->transnoentitiesnoconv('ManualUpdate'), $newnbdaysholidays, $typeholiday); + if ($result <= 0) { + setEventMessages($holiday->error, $holiday->errors, 'errors'); + $error++; + break; + } + + $objecttmp->updateSoldeCP($toselectid, $newnbdaysholidays, $typeholiday); + if ($result > 0) { + $nbok++; + } else { + setEventMessages("", $langs->trans("ErrorUpdatingUsersCP"), 'errors'); + $error++; + break; + } + } + } + + if (!$error) { + if ($nbok > 1) { + setEventMessages($langs->trans("HolidayRecordsIncreased", $nbok), null, 'mesgs'); + } elseif ($nbok == 1) { + setEventMessages($langs->trans("HolidayRecordIncreased"), null, 'mesgs'); + } + $db->commit(); + $toselect=array(); + } else { + $db->rollback(); + } +} + $parameters['toselect'] = $toselect; $parameters['uploaddir'] = $uploaddir; $parameters['massaction'] = $massaction; diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 678bf219bef..d86f8074efd 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -283,6 +283,29 @@ if ($massaction == 'preapproveleave') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, 'yes', 0, 200, 500, 1); } +if ($massaction == 'preincreaseholiday') { + $langs->load("holiday", "hrm"); + require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; + $staticholiday = new Holiday($db); + $arraytypeholidays = $staticholiday->getTypes(1, 1); + $formquestion[] = array(); + $labeltypes = array(); + foreach ($typeleaves as $key => $val) { + $labeltypes[$val['id']] = ($langs->trans($val['code']) != $val['code']) ? $langs->trans($val['code']) : $langs->trans($val['label']); + } + $formquestion [] = array( 'type' => 'other', + 'name' => 'typeofholiday', + 'label' => $langs->trans("Type"), + 'value' => $form->selectarray('typeholiday', $labeltypes, GETPOST('typeholiday', 'alpha'), 1) + ); + $formquestion [] = array( 'type' => 'other', + 'name' => 'nbdaysholydays', + 'label' => $langs->trans("NumberDayAddMass"), + 'value' => '' + ); + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassIncreaseHoliday"), $langs->trans("ConfirmMassIncreaseHolidayQuestion", count($toselect)), "increaseholiday", $formquestion, 1, 0, 200, 500, 1); +} + // Allow Pre-Mass-Action hook (eg for confirmation dialog) $parameters = array( 'toselect' => $toselect, diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 486315f36ac..f47a4128c65 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -46,6 +46,9 @@ $search_supervisor = GETPOST('search_supervisor', 'int'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$confirm = GETPOST('confirm', 'alpha'); + $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; @@ -113,14 +116,13 @@ if (empty($reshook)) { } // Mass actions - /* - $objectclass='Skeleton'; - $objectlabel='Skeleton'; - $permissiontoread = $user->rights->skeleton->read; - $permissiontodelete = $user->rights->skeleton->delete; - $uploaddir = $conf->skeleton->dir_output; + $objectclass = 'Holiday'; + $objectlabel = 'Holiday'; + $permissiontoread = $user->hasRight('holiday', 'read'); + $permissiontodelete = $user->hasRight('holiday', 'delete'); + $permissiontoapprove = $user->hasRight('holiday', 'approve'); + $uploaddir = $conf->holiday->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - */ // Si il y a une action de mise à jour if ($action == 'update' && GETPOSTISSET('update_cp')) { @@ -213,6 +215,17 @@ if ($result < 0) { setEventMessages($holiday->error, $holiday->errors, 'errors'); } +// List of mass actions available +$arrayofmassactions = array( + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +if ($user->hasRight("holiday", "approve")) { + $arrayofmassactions['preincreaseholiday'] = img_picto('', 'add', 'class="pictofixedwidth"').$langs->trans("IncreaseHolidays"); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); + print '
'; if ($optioncss != '') { @@ -226,7 +239,10 @@ print ''; print ''; print ''; -print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png'); +$title = $langs->trans("MenuConfCP"); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $massactionbutton, '', '', 'title_hrm', 0, '', '', $limit, 0, 0, 1); + +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; print '
'.$langs->trans('LastUpdateCP').': '."\n"; $lastUpdate = $holiday->getConfCP('lastUpdate'); @@ -298,6 +314,7 @@ if (count($typeleaves) == 0) { print ''; } print ''; + print ''; // Action column print ''; @@ -320,11 +337,19 @@ if (count($typeleaves) == 0) { } print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : 'Note'), $_SERVER["PHP_SELF"]); print_liste_field_titre(''); + + if ($massactionbutton) { + $selectedfields = $form->showCheckAddButtons('checkforselect', 1); + } + + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print ''; $usersupervisor = new User($db); foreach ($listUsers as $users) { + $arrayofselected = is_array($toselect) ? $toselect : array(); + // If user has not permission to edit/read all, we must see only subordinates if (empty($user->rights->holiday->readall)) { if (($users['rowid'] != $user->id) && (!in_array($users['rowid'], $userchilds))) { @@ -389,11 +414,21 @@ if (count($typeleaves) == 0) { print ''; // Button modify - print ''; + print ''; if (!empty($user->rights->holiday->define_holiday)) { // Allowed to set the balance of any user print ''; } print ''."\n"; + print ''; + + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($userstatic->id, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print ''; print ''; $i++; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 95c8f54d211..1921b9ed794 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -149,4 +149,10 @@ XIsAUsualNonWorkingDay=%s is usualy a NON working day BlockHolidayIfNegative=Block if balance negative LeaveRequestCreationBlockedBecauseBalanceIsNegative=The creation of this leave request is blocked because your balance is negative ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted +IncreaseHolidays=Increase holiday +HolidayRecordsIncreased= %s holiday records increased +HolidayRecordIncreased=Holiday record increased +ConfirmMassIncreaseHoliday=Bulk holiday increase +NumberDayAddMass=Number of day to add to the selection +ConfirmMassIncreaseHolidayQuestion=Are you sure you want to increase holiday of the %s selected record(s)? HolidayQtyNotModified=Balance of remaining days for %s has not been changed From ffddce4656100523a26f56220734ef3f3b598d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 13:49:36 +0200 Subject: [PATCH 03/15] add badges --- htdocs/core/lib/categories.lib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index 8ff1dbb97ae..7d77b345d61 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -80,7 +80,10 @@ function categories_prepare_head(Categorie $object, $type) */ function categoriesadmin_prepare_head() { - global $langs, $conf, $user; + global $langs, $conf, $user, $db; + + $extrafields = new ExtraFields($db); + $extrafields->fetch_name_optionals_label('categorie'); $langs->load("categories"); @@ -94,6 +97,10 @@ function categoriesadmin_prepare_head() $head[$h][0] = DOL_URL_ROOT.'/categories/admin/categorie_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsCategories"); + $nbExtrafields = $extrafields->attributes['categorie']['count']; + if ($nbExtrafields > 0) { + $head[$h][1] .= ' '.$nbExtrafields.''; + } $head[$h][2] = 'attributes_categories'; $h++; From 9ddf65de637372856a03fedbdf4b351ff0e324e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 14:59:46 +0200 Subject: [PATCH 04/15] NEW extrafield price with currency --- htdocs/core/class/extrafields.class.php | 34 +++++++++++++++++-- htdocs/core/tpl/admin_extrafields_add.tpl.php | 1 + .../core/tpl/admin_extrafields_edit.tpl.php | 1 + htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 0efee8461dc..2b42b89c51d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -80,6 +80,7 @@ class ExtraFields 'datetime'=>'DateAndTime', 'boolean'=>'Boolean', 'price'=>'ExtrafieldPrice', + 'pricecy'=>'ExtrafieldPriceWithCurrency', 'phone'=>'ExtrafieldPhone', 'mail'=>'ExtrafieldMail', 'url'=>'ExtrafieldUrl', @@ -113,7 +114,7 @@ class ExtraFields * * @param string $attrname Code of attribute * @param string $label label of attribute - * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...) + * @param string $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price', 'pricecy', 'phone','mail','password','url','select','checkbox','separate',...) * @param int $pos Position of attribute * @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. * @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) @@ -182,7 +183,7 @@ class ExtraFields * This is a private method. For public method, use addExtraField. * * @param string $attrname code of attribute - * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) + * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not @@ -217,6 +218,9 @@ class ExtraFields } elseif ($type == 'price') { $typedb = 'double'; $lengthdb = '24,8'; + } elseif ($type == 'pricecy') { + $typedb = 'varchar'; + $lengthdb = '64'; } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; @@ -567,6 +571,9 @@ class ExtraFields } elseif ($type == 'price') { $typedb = 'double'; $lengthdb = '24,8'; + } elseif ($type == 'pricecy') { + $typedb = 'varchar'; + $lengthdb = '64'; } elseif ($type == 'phone') { $typedb = 'varchar'; $lengthdb = '20'; @@ -1089,6 +1096,16 @@ class ExtraFields $value = price($value); } $out = ' '.$langs->getCurrencySymbol($conf->currency); + } elseif ($type == 'pricecy') { + $currency = $conf->currency; + if (!empty($value)) { + // $value in memory is a php numeric, we format it into user number format. + $pricetmp = explode(':', $value); + $currency = !empty($pricetmp[1]) ? $pricetmp[1] : $conf->currency; + $value = price($pricetmp[0]); + } + $out = ' '; + $out .= $form->selectCurrency($currency, $keyprefix.$key.$keysuffix.'currency_id'); } elseif ($type == 'double') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value = price($value); @@ -1624,6 +1641,17 @@ class ExtraFields if ($value || $value == '0') { $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1).' '.$langs->getCurrencySymbol($conf->currency); } + } elseif ($type == 'pricecy') { + $currency = $conf->currency; + if (!empty($value)) { + // $value in memory is a php numeric, we format it into user number format. + $pricetmp = explode(':', $value); + $currency = !empty($pricetmp[1]) ? $pricetmp[1] : $conf->currency; + $value = $pricetmp[0]; + } + if ($value || $value == '0') { + $value = price($value, 0, $langs, 0, $conf->global->MAIN_MAX_DECIMALS_TOT, -1, $currency); + } } elseif ($type == 'select') { $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); if (($pos = strpos($valstr, "|")) !== false) { @@ -2095,6 +2123,8 @@ class ExtraFields } elseif (in_array($key_type, array('price', 'double'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); + } elseif (in_array($key_type, array('pricecy', 'double'))) { + $value_key = price2num(GETPOST("options_".$key, 'alpha')).':'.GETPOST("options_".$key."currency_id", 'alpha'); } elseif (in_array($key_type, array('html'))) { $value_key = GETPOST("options_".$key, 'restricthtml'); } elseif (in_array($key_type, array('text'))) { diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 97748290bd7..ed337b04e6a 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -97,6 +97,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helppassword").show();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'pricecurrency') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();} else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 7814560be9b..139a4bc4404 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -96,6 +96,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helppassword").show();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'pricecy') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();} else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6a1146a2f9d..96861717642 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -439,6 +439,7 @@ Unique=Unique Boolean=Boolean (one checkbox) ExtrafieldPhone = Phone ExtrafieldPrice = Price +ExtrafieldPriceWithCurrency=Price with currency ExtrafieldMail = Email ExtrafieldUrl = Url ExtrafieldIP = IP From 4bcfbe5d3d4424a8a97a708b15489b750e3403e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 20:05:53 +0200 Subject: [PATCH 05/15] fix tpl --- htdocs/core/tpl/admin_extrafields_add.tpl.php | 2 +- htdocs/core/tpl/admin_extrafields_edit.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index ed337b04e6a..a20c7cfa0b5 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -97,7 +97,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helppassword").show();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} - else if (type == 'pricecurrency') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} + else if (type == 'pricecy') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpchkbxlst").hide();} else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();} else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 139a4bc4404..0f6e0ec7d5f 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -96,7 +96,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con else if (type == 'password') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helppassword").show();} else if (type == 'boolean') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'price') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} - else if (type == 'pricecy') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} + else if (type == 'pricecy') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").hide(); jQuery("#helpchkbxlst").hide();} else if (type == 'select') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} else if (type == 'sellist') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpsellist").show();} else if (type == 'radio') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show(); jQuery(".spanforparamtooltip").hide(); jQuery("#helpselect").show();} From 138ab462378e9fa728b848519b19194676572a0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 20:09:52 +0200 Subject: [PATCH 06/15] fix doc --- htdocs/core/class/extrafields.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 2b42b89c51d..3e7a3cc291a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1099,7 +1099,7 @@ class ExtraFields } elseif ($type == 'pricecy') { $currency = $conf->currency; if (!empty($value)) { - // $value in memory is a php numeric, we format it into user number format. + // $value in memory is a php string like '10.01:USD' $pricetmp = explode(':', $value); $currency = !empty($pricetmp[1]) ? $pricetmp[1] : $conf->currency; $value = price($pricetmp[0]); @@ -1644,7 +1644,7 @@ class ExtraFields } elseif ($type == 'pricecy') { $currency = $conf->currency; if (!empty($value)) { - // $value in memory is a php numeric, we format it into user number format. + // $value in memory is a php string like '0.01:EUR' $pricetmp = explode(':', $value); $currency = !empty($pricetmp[1]) ? $pricetmp[1] : $conf->currency; $value = $pricetmp[0]; From 8dfd24b5cb57123471cec90011fbf5ed0a5a6087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 20:19:00 +0200 Subject: [PATCH 07/15] update doc --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index d68a320482e..71cce2859f6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5315,7 +5315,7 @@ class Product extends CommonObject * @param string $origin_element Origin element type * @param int $origin_id Origin id of element * @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (usefull only if product is a subproduct) - * @param array $extrafields Array of extrafields + * @param Extrafields $extrafields Array of extrafields * @return int <0 if KO, >0 if OK */ public function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null) From e7afc7ac757141dd1a10381055868aea846ef985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 20:22:54 +0200 Subject: [PATCH 08/15] Update product.class.php --- htdocs/product/class/product.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 71cce2859f6..5dc2f69b529 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5255,7 +5255,7 @@ class Product extends CommonObject * @param string $origin_element Origin element type * @param int $origin_id Origin id of element * @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (usefull only if product is a subproduct) - * @param array $extrafields Array of extrafields + * @param Extrafields $extrafields Array of extrafields * @return int <0 if KO, >0 if OK */ public function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null) @@ -5924,7 +5924,8 @@ class Product extends CommonObject $this->tosell = 1; $this->tobuy = 1; $this->tobatch = 0; - $this->note = 'This is a comment (private)'; + $this->note_private = 'This is a comment (private)'; + $this->note_public = 'This is a comment (public)'; $this->date_creation = $now; $this->date_modification = $now; From caa54f7f110159e061160b80b7d469ca153e1293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 21 Sep 2022 20:27:54 +0200 Subject: [PATCH 09/15] Update product.class.php --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5dc2f69b529..f68b8249220 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -14,7 +14,7 @@ * Copyright (C) 2014 Ion agorria * Copyright (C) 2016-2018 Ferran Marcet * Copyright (C) 2017 Gustavo Novaro - * Copyright (C) 2019-2021 Frédéric France + * Copyright (C) 2019-2022 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 @@ -5921,8 +5921,8 @@ class Product extends CommonObject $this->description = 'This is description of this product specimen that was created the '.dol_print_date($now, 'dayhourlog').'.'; $this->specimen = 1; $this->country_id = 1; - $this->tosell = 1; - $this->tobuy = 1; + $this->status = 1; + $this->status_buy = 1; $this->tobatch = 0; $this->note_private = 'This is a comment (private)'; $this->note_public = 'This is a comment (public)'; From 2247bc2ae4f226690430a391e4988115ff1c5626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 21 Sep 2022 21:01:18 +0200 Subject: [PATCH 10/15] clean code --- htdocs/product/class/product.class.php | 152 ++++++++++++++----------- 1 file changed, 84 insertions(+), 68 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f68b8249220..ccc3a05c51f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -255,6 +255,14 @@ class Product extends CommonObject */ public $status = 0; + /** + * Status indicates whether the product is on sale '1' or not '0' + * @var int + * @deprecated + * @see $status + */ + public $tosell; + /** * Status indicate whether the product is available for purchase '1' or not '0' * @@ -262,6 +270,14 @@ class Product extends CommonObject */ public $status_buy = 0; + /** + * Status indicate whether the product is available for purchase '1' or not '0' + * @var int + * @deprecated + * @see $status_buy + */ + public $tobuy; + /** * Status indicates whether the product is a finished product '1' or a raw material '0' * @@ -1977,11 +1993,11 @@ class Product extends CommonObject $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $this->default_vat_code = $obj->default_vat_code; // Vat code supplier - $this->fourn_multicurrency_price = $obj->multicurrency_price; - $this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice; - $this->fourn_multicurrency_tx = $obj->multicurrency_tx; - $this->fourn_multicurrency_id = $obj->fk_multicurrency; - $this->fourn_multicurrency_code = $obj->multicurrency_code; + $this->fourn_multicurrency_price = $obj->multicurrency_price; + $this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice; + $this->fourn_multicurrency_tx = $obj->multicurrency_tx; + $this->fourn_multicurrency_id = $obj->fk_multicurrency; + $this->fourn_multicurrency_code = $obj->multicurrency_code; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $this->packaging = $obj->packaging; } @@ -2042,11 +2058,11 @@ class Product extends CommonObject $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $this->default_vat_code = $obj->default_vat_code; // Vat code supplier - $this->fourn_multicurrency_price = $obj->multicurrency_price; - $this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice; - $this->fourn_multicurrency_tx = $obj->multicurrency_tx; - $this->fourn_multicurrency_id = $obj->fk_multicurrency; - $this->fourn_multicurrency_code = $obj->multicurrency_code; + $this->fourn_multicurrency_price = $obj->multicurrency_price; + $this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice; + $this->fourn_multicurrency_tx = $obj->multicurrency_tx; + $this->fourn_multicurrency_id = $obj->fk_multicurrency; + $this->fourn_multicurrency_code = $obj->multicurrency_code; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $this->packaging = $obj->packaging; } @@ -2383,57 +2399,57 @@ class Product extends CommonObject $obj = $this->db->fetch_object($resql); $this->id = $obj->rowid; - $this->ref = $obj->ref; - $this->ref_ext = $obj->ref_ext; - $this->label = $obj->label; - $this->description = $obj->description; - $this->url = $obj->url; - $this->note_public = $obj->note_public; - $this->note_private = $obj->note_private; - $this->note = $obj->note_private; // deprecated + $this->ref = $obj->ref; + $this->ref_ext = $obj->ref_ext; + $this->label = $obj->label; + $this->description = $obj->description; + $this->url = $obj->url; + $this->note_public = $obj->note_public; + $this->note_private = $obj->note_private; + $this->note = $obj->note_private; // deprecated - $this->type = $obj->fk_product_type; - $this->status = $obj->tosell; - $this->status_buy = $obj->tobuy; - $this->status_batch = $obj->tobatch; - $this->batch_mask = $obj->batch_mask; + $this->type = $obj->fk_product_type; + $this->status = $obj->tosell; + $this->status_buy = $obj->tobuy; + $this->status_batch = $obj->tobatch; + $this->batch_mask = $obj->batch_mask; - $this->customcode = $obj->customcode; - $this->country_id = $obj->fk_country; + $this->customcode = $obj->customcode; + $this->country_id = $obj->fk_country; $this->country_code = getCountry($this->country_id, 2, $this->db); $this->state_id = $obj->fk_state; - $this->lifetime = $obj->lifetime; - $this->qc_frequency = $obj->qc_frequency; - $this->price = $obj->price; - $this->price_ttc = $obj->price_ttc; - $this->price_min = $obj->price_min; - $this->price_min_ttc = $obj->price_min_ttc; + $this->lifetime = $obj->lifetime; + $this->qc_frequency = $obj->qc_frequency; + $this->price = $obj->price; + $this->price_ttc = $obj->price_ttc; + $this->price_min = $obj->price_min; + $this->price_min_ttc = $obj->price_min_ttc; $this->price_base_type = $obj->price_base_type; - $this->cost_price = $obj->cost_price; + $this->cost_price = $obj->cost_price; $this->default_vat_code = $obj->default_vat_code; - $this->tva_tx = $obj->tva_tx; + $this->tva_tx = $obj->tva_tx; //! French VAT NPR - $this->tva_npr = $obj->tva_npr; - $this->recuperableonly = $obj->tva_npr; // For backward compatibility + $this->tva_npr = $obj->tva_npr; + $this->recuperableonly = $obj->tva_npr; // For backward compatibility //! Local taxes - $this->localtax1_tx = $obj->localtax1_tx; - $this->localtax2_tx = $obj->localtax2_tx; - $this->localtax1_type = $obj->localtax1_type; - $this->localtax2_type = $obj->localtax2_type; + $this->localtax1_tx = $obj->localtax1_tx; + $this->localtax2_tx = $obj->localtax2_tx; + $this->localtax1_type = $obj->localtax1_type; + $this->localtax2_type = $obj->localtax2_type; - $this->finished = $obj->finished; - $this->fk_default_bom = $obj->fk_default_bom; + $this->finished = $obj->finished; + $this->fk_default_bom = $obj->fk_default_bom; - $this->duration = $obj->duration; - $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1); + $this->duration = $obj->duration; + $this->duration_value = substr($obj->duration, 0, dol_strlen($obj->duration) - 1); $this->duration_unit = substr($obj->duration, -1); - $this->canvas = $obj->canvas; + $this->canvas = $obj->canvas; $this->net_measure = $obj->net_measure; $this->net_measure_units = $obj->net_measure_units; - $this->weight = $obj->weight; - $this->weight_units = $obj->weight_units; - $this->length = $obj->length; - $this->length_units = $obj->length_units; + $this->weight = $obj->weight; + $this->weight_units = $obj->weight_units; + $this->length = $obj->length; + $this->length_units = $obj->length_units; $this->width = $obj->width; $this->width_units = $obj->width_units; $this->height = $obj->height; @@ -2442,32 +2458,32 @@ class Product extends CommonObject $this->surface = $obj->surface; $this->surface_units = $obj->surface_units; $this->volume = $obj->volume; - $this->volume_units = $obj->volume_units; + $this->volume_units = $obj->volume_units; $this->barcode = $obj->barcode; - $this->barcode_type = $obj->fk_barcode_type; + $this->barcode_type = $obj->fk_barcode_type; - $this->accountancy_code_buy = $obj->accountancy_code_buy; - $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; - $this->accountancy_code_buy_export = $obj->accountancy_code_buy_export; - $this->accountancy_code_sell = $obj->accountancy_code_sell; - $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; - $this->accountancy_code_sell_export = $obj->accountancy_code_sell_export; + $this->accountancy_code_buy = $obj->accountancy_code_buy; + $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; + $this->accountancy_code_buy_export = $obj->accountancy_code_buy_export; + $this->accountancy_code_sell = $obj->accountancy_code_sell; + $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; + $this->accountancy_code_sell_export = $obj->accountancy_code_sell_export; - $this->fk_default_warehouse = $obj->fk_default_warehouse; - $this->fk_default_workstation = $obj->fk_default_workstation; - $this->seuil_stock_alerte = $obj->seuil_stock_alerte; - $this->desiredstock = $obj->desiredstock; - $this->stock_reel = $obj->stock; + $this->fk_default_warehouse = $obj->fk_default_warehouse; + $this->fk_default_workstation = $obj->fk_default_workstation; + $this->seuil_stock_alerte = $obj->seuil_stock_alerte; + $this->desiredstock = $obj->desiredstock; + $this->stock_reel = $obj->stock; $this->pmp = $obj->pmp; - $this->date_creation = $obj->datec; - $this->date_modification = $obj->tms; - $this->import_key = $obj->import_key; - $this->entity = $obj->entity; + $this->date_creation = $obj->datec; + $this->date_modification = $obj->tms; + $this->import_key = $obj->import_key; + $this->entity = $obj->entity; - $this->ref_ext = $obj->ref_ext; - $this->fk_price_expression = $obj->fk_price_expression; - $this->fk_unit = $obj->fk_unit; + $this->ref_ext = $obj->ref_ext; + $this->fk_price_expression = $obj->fk_price_expression; + $this->fk_unit = $obj->fk_unit; $this->price_autogen = $obj->price_autogen; $this->model_pdf = $obj->model_pdf; From 2fb678523074128231bf4327542265be2b661d59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 18:39:40 +0200 Subject: [PATCH 11/15] Update member.lib.php --- htdocs/core/lib/member.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 64c0d429048..ca307db05ed 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -211,7 +211,7 @@ function member_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsMember"); $nbExtrafields = $extrafields->attributes['adherent']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ' '.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes'; $h++; @@ -220,7 +220,7 @@ function member_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsMemberType"); $nbExtrafields = $extrafields->attributes['adherent_type']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ' '.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes_type'; $h++; From 84e0ab07e9f942d395e66454247ac4f57e65c02a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 18:40:16 +0200 Subject: [PATCH 12/15] Update order.lib.php --- htdocs/core/lib/order.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 174ec36834b..c0f852ebf59 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -165,7 +165,7 @@ function order_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFields"); $nbExtrafields = $extrafields->attributes['commande']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ' '.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes'; $h++; @@ -174,7 +174,7 @@ function order_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsLines"); $nbExtrafields = $extrafields->attributes['commandedet']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ' '.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributeslines'; $h++; From 21413344230dbb61bf2aab42a1928492516c6935 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 18:40:34 +0200 Subject: [PATCH 13/15] Update order.lib.php --- htdocs/core/lib/order.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index c0f852ebf59..18c3d7580a2 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -165,7 +165,7 @@ function order_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFields"); $nbExtrafields = $extrafields->attributes['commande']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes'; $h++; @@ -174,7 +174,7 @@ function order_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsLines"); $nbExtrafields = $extrafields->attributes['commandedet']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributeslines'; $h++; From ce48118bbb22011b0815ed212a579aa2ff59b617 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 18:41:07 +0200 Subject: [PATCH 14/15] Update member.lib.php --- htdocs/core/lib/member.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index ca307db05ed..baf1012dfea 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -211,7 +211,7 @@ function member_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsMember"); $nbExtrafields = $extrafields->attributes['adherent']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes'; $h++; @@ -220,7 +220,7 @@ function member_admin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsMemberType"); $nbExtrafields = $extrafields->attributes['adherent_type']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ''.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes_type'; $h++; From 0c76fe83578f59ede87de3b0fa143571d3b3ccef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 23 Sep 2022 18:41:47 +0200 Subject: [PATCH 15/15] Update categories.lib.php --- htdocs/core/lib/categories.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/categories.lib.php b/htdocs/core/lib/categories.lib.php index 7d77b345d61..ee69ccf4a87 100644 --- a/htdocs/core/lib/categories.lib.php +++ b/htdocs/core/lib/categories.lib.php @@ -99,7 +99,7 @@ function categoriesadmin_prepare_head() $head[$h][1] = $langs->trans("ExtraFieldsCategories"); $nbExtrafields = $extrafields->attributes['categorie']['count']; if ($nbExtrafields > 0) { - $head[$h][1] .= ' '.$nbExtrafields.''; + $head[$h][1] .= ''.$nbExtrafields.''; } $head[$h][2] = 'attributes_categories'; $h++;