Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0

This commit is contained in:
Laurent Destailleur
2023-02-07 00:19:54 +01:00
10 changed files with 93 additions and 59 deletions

View File

@@ -220,25 +220,38 @@ Following changes may create regressions for some external modules, but were nec
* Rename the substitution for "project label" instead of "project title" in substitution variables * Rename the substitution for "project label" instead of "project title" in substitution variables
***** ChangeLog for 16.0.4 compared to 16.0.2 ***** ***** ChangeLog for 16.0.4 compared to 16.0.3 *****
FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead) FIX: Amount of localtax1 and 2 not correctly save on purchase order (the rate was saved instead)
FIX: #20415 FIX: #20415
FIX: #21280 FIX: #21280
FIX: #23008 FIX: #23008
FIX: #22271 FIX: #22271
FIX: #22524
FIX: #22837 FIX: #22837
FIX: #22964
FIX: #23012
FIX: #23019 Impossible to add task times to an existing draft invoice FIX: #23019 Impossible to add task times to an existing draft invoice
FIX: #23072 FIX: #23072
FIX: #23087 FIX: #23087
FIX: #23115 FIX: #23115
FIX: #23116 FIX: #23116
FIX: #23281 FIX: #23281
FIX: #23420 : wrong check on $search_categ value causing FATAL ERROR
FIX: Accountancy - Quadra export
FIX: add border left on image product when conf activated
FIX: Add missing token when deleting template inn order_supplier admin menu
FIX: Amount of localtax1 and 2 not correctly save on purchase order (the
FIX: API access for deactivated users
FIX: bad selection of barcode numbering module FIX: bad selection of barcode numbering module
FIX: Can't see all time spent by all user FIX: Can't see all time spent by all user
FIX: CI FIX: CI
FIX: CommonObject - showOptionals - Display blank td when MAIN_VIEW_LINE_NUMBER is enabled and action is confirm_valid FIX: CommonObject - showOptionals - Display blank td when MAIN_VIEW_LINE_NUMBER is enabled and action is confirm_valid
FIX: Documents API inconsistency FIX: Documents API inconsistency
FIX: Empty FormSetup emailTemplate type IF empty fieldvalue
FIX: Errors Handling for CreateFrom Hooks
FIX: error with dol_banner_tab, ref is needed
FIX: ExpenseReport card was not reloaded after addline
FIX: #23075 FIX: #23075
FIX: #23117 FIX: #23117
FIX: get multicurrency infos of propal when create order from propal with "WORKFLOW_PROPAL_AUTOCREATE_ORDER" conf FIX: get multicurrency infos of propal when create order from propal with "WORKFLOW_PROPAL_AUTOCREATE_ORDER" conf
@@ -246,12 +259,16 @@ FIX: Give predictable order to inventory lines
FIX: include class multicurrency FIX: include class multicurrency
FIX: methods declaration (backport fix 67b9a7dc07d708231d12b5e58800334d4a01ef98) FIX: methods declaration (backport fix 67b9a7dc07d708231d12b5e58800334d4a01ef98)
FIX: multicurrency_tx and not currency_tx FIX: multicurrency_tx and not currency_tx
FIX: PGSQL Integer type does not have a free length FIX: on public ticket list, only the page 1 was accessible. Other pages were 404 error.
FIX: PGSQL Integer type does not have a free lenght
FIX: PGSQL Int type does not have a free lenght
FIX: Product list in setup.php in new Module FIX: Product list in setup.php in new Module
FIX: propal and order stats broken on Tag+User(retricted customer list) FIX: propal and order stats broken on Tag+User(retricted customer list)
FIX: saving of numbering module for jobs FIX: saving of numbering module for jobs
FIX: Stickler FIX: Stickler
FIX: travis FIX: travis
FIX: wrong check on $search_categ value causing fatal error
FIX: wrong stock list with multicompany and without stock sharing
***** ChangeLog for 16.0.3 compared to 16.0.2 ***** ***** ChangeLog for 16.0.3 compared to 16.0.2 *****

View File

@@ -922,6 +922,10 @@ while ($currentdaytoshow < $lastdaytoshow) {
if ($usergroup > 0) { if ($usergroup > 0) {
$sql .= " AND ug.fk_usergroup = ".((int) $usergroup); $sql .= " AND ug.fk_usergroup = ".((int) $usergroup);
} }
if ($user->socid > 0) {
// External users should see only contacts of their company
$sql .= " AND u.fk_soc = ".((int) $user->socid);
}
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@@ -61,25 +61,17 @@ if (isset($user->socid) && $user->socid > 0) {
$socid = $user->socid; $socid = $user->socid;
} }
$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
$now = dol_now(); $now = dol_now();
// Security check //restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0);
$socid = GETPOST("socid", 'int');
if ($user->socid > 0) {
$action = '';
$id = $user->socid;
} else {
$id = 0;
}
//restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
if (!$user->hasRight('propal', 'read') && !$user->hasRight('supplier_proposal', 'read') && !$user->hasRight('commande', 'read') && !$user->hasRight('fournisseur', 'commande', 'read') if (!$user->hasRight('propal', 'read') && !$user->hasRight('supplier_proposal', 'read') && !$user->hasRight('commande', 'read') && !$user->hasRight('fournisseur', 'commande', 'read')
&& !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read')) { && !$user->hasRight('supplier_order', 'read') && !$user->hasRight('fichinter', 'read')) {
accessforbidden(); accessforbidden();
} }
$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD);
/* /*

View File

@@ -14,6 +14,7 @@
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2022 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2023 Benjamin Falière <benjamin.faliere@altairis.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -1843,25 +1844,25 @@ if ($action == 'create' && $usercancreate) {
// Delivery delay // Delivery delay
print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>'; print '<tr class="fielddeliverydelay"><td>'.$langs->trans('AvailabilityPeriod').'</td><td>';
print img_picto('', 'clock', 'class="pictofixedwidth"'); print img_picto('', 'clock', 'class="pictofixedwidth"');
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); $form->selectAvailabilityDelay((GETPOSTISSET('availability_id')?GETPOST('availability_id'):$availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>'; print '</td></tr>';
// Terms of payment // Terms of payment
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
print img_picto('', 'payment', 'class="pictofixedwidth"'); print img_picto('', 'payment', 'class="pictofixedwidth"');
print $form->getSelectConditionsPaiements($cond_reglement_id, 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print $form->getSelectConditionsPaiements((GETPOSTISSET('cond_reglement_id')?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent);
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'; print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>';
print img_picto('', 'bank', 'class="pictofixedwidth"'); print img_picto('', 'bank', 'class="pictofixedwidth"');
print $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print $form->select_types_paiements((GETPOSTISSET('mode_reglement_id')?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) { if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) {
print '<tr><td>'.$langs->trans('BankAccount').'</td><td>'; print '<tr><td>'.$langs->trans('BankAccount').'</td><td>';
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($fk_account, 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((GETPOSTISSET('fk_account')?GETPOST('fk_account'):$fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1);
print '</td></tr>'; print '</td></tr>';
} }
@@ -1869,7 +1870,7 @@ if ($action == 'create' && $usercancreate) {
if (isModEnabled('expedition')) { if (isModEnabled('expedition')) {
print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>'; print '<tr><td>'.$langs->trans('SendingMethod').'</td><td>';
print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); print img_picto('', 'object_dolly', 'class="pictofixedwidth"');
$form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); $form->selectShippingMethod((GETPOSTISSET('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>'; print '</td></tr>';
} }
@@ -1878,14 +1879,14 @@ if ($action == 'create' && $usercancreate) {
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct = new FormProduct($db); $formproduct = new FormProduct($db);
print '<tr><td>'.$langs->trans('Warehouse').'</td><td>'; print '<tr><td>'.$langs->trans('Warehouse').'</td><td>';
print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses((GETPOSTISSET('warehouse_id')?GETPOST('warehouse_id'):$warehouse_id), 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx');
print '</td></tr>'; print '</td></tr>';
} }
// Source / Channel - What trigger creation // Source / Channel - What trigger creation
print '<tr><td>'.$langs->trans('Channel').'</td><td>'; print '<tr><td>'.$langs->trans('Channel').'</td><td>';
print img_picto('', 'question', 'class="pictofixedwidth"'); print img_picto('', 'question', 'class="pictofixedwidth"');
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx'); $form->selectInputReason((GETPOSTISSET('demand_reason_id')?GETPOST('demand_reason_id'):$demand_reason_id), 'demand_reason_id', '', 1, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>'; print '</td></tr>';
// TODO How record was recorded OrderMode (llx_c_input_method) // TODO How record was recorded OrderMode (llx_c_input_method)
@@ -1895,7 +1896,7 @@ if ($action == 'create' && $usercancreate) {
$langs->load("projects"); $langs->load("projects");
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Project").'</td><td>'; print '<td>'.$langs->trans("Project").'</td><td>';
print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), (GETPOSTISSET('projectid')?GETPOST('projectid'):$projectid), 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx');
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>'; print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'"><span class="fa fa-plus-circle valignmiddle" title="'.$langs->trans("AddProject").'"></span></a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@@ -1954,7 +1955,7 @@ if ($action == 'create' && $usercancreate) {
print '<tr>'; print '<tr>';
print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>'; print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx'); print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency((GETPOSTISSET('multicurrency_code')?GETPOST('multicurrency_code'):$currency_code), 'multicurrency_code', 0, '', false, 'maxwidth200 widthcentpercentminusx');
print '</td></tr>'; print '</td></tr>';
} }

View File

@@ -249,9 +249,9 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc"; $sql .= " sum(f.total_ht) as amount, sum(f.total_ttc) as amount_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) { // Without any category if ($selected_cat === -2) { // Without any category
$sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
} elseif ($selected_cat) { // Into a specific category } elseif ($selected_cat) { // Into a specific category
$sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
} }
$sql .= " WHERE f.fk_statut in (1,2)"; $sql .= " WHERE f.fk_statut in (1,2)";
$sql .= " AND f.type IN (0,2)"; $sql .= " AND f.type IN (0,2)";
@@ -276,9 +276,9 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p"; $sql .= ", ".MAIN_DB_PREFIX."paiementfourn as p";
$sql .= ", ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) { // Without any category if ($selected_cat === -2) { // Without any category
$sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc";
} elseif ($selected_cat) { // Into a specific category } elseif ($selected_cat) { // Into a specific category
$sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
} }
$sql .= " WHERE p.rowid = pf.fk_paiementfourn"; $sql .= " WHERE p.rowid = pf.fk_paiementfourn";
$sql .= " AND pf.fk_facturefourn = f.rowid"; $sql .= " AND pf.fk_facturefourn = f.rowid";

View File

@@ -82,6 +82,8 @@ class CGenericDic
$fieldlabel = 'label'; $fieldlabel = 'label';
if ($this->table_element == 'c_stcomm') { if ($this->table_element == 'c_stcomm') {
$fieldlabel = 'libelle'; $fieldlabel = 'libelle';
} elseif ($this->table_element == 'c_type_fees') {
$fieldrowid = 'id';
} }
$error = 0; $error = 0;
@@ -162,6 +164,8 @@ class CGenericDic
if ($this->table_element == 'c_stcomm') { if ($this->table_element == 'c_stcomm') {
$fieldrowid = 'id'; $fieldrowid = 'id';
$fieldlabel = 'libelle'; $fieldlabel = 'libelle';
} elseif ($this->table_element == 'c_type_fees') {
$fieldrowid = 'id';
} }
$sql = "SELECT"; $sql = "SELECT";
@@ -233,6 +237,8 @@ class CGenericDic
if ($this->table_element == 'c_stcomm') { if ($this->table_element == 'c_stcomm') {
$fieldrowid = 'id'; $fieldrowid = 'id';
$fieldlabel = 'libelle'; $fieldlabel = 'libelle';
} elseif ($this->table_element == 'c_type_fees') {
$fieldrowid = 'id';
} }
$sql = "SELECT"; $sql = "SELECT";
@@ -303,6 +309,8 @@ class CGenericDic
if ($this->table_element == 'c_stcomm') { if ($this->table_element == 'c_stcomm') {
$fieldrowid = 'id'; $fieldrowid = 'id';
$fieldlabel = 'libelle'; $fieldlabel = 'libelle';
} elseif ($this->table_element == 'c_type_fees') {
$fieldrowid = 'id';
} }
// Clean parameters // Clean parameters

View File

@@ -6084,6 +6084,8 @@ abstract class CommonObject
if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
//var_dump($conf->disable_compute); //var_dump($conf->disable_compute);
if (empty($conf->disable_compute)) { if (empty($conf->disable_compute)) {
global $objectoffield; // We set a global variable to $objectoffield so
$objectoffield = $this; // we can use it inside computed formula
$this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '');
} }
} }

View File

@@ -8917,10 +8917,12 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
// Only global variables can be changed by eval function and returned to caller // Only global variables can be changed by eval function and returned to caller
global $db, $langs, $user, $conf, $website, $websitepage; global $db, $langs, $user, $conf, $website, $websitepage;
global $action, $mainmenu, $leftmenu; global $action, $mainmenu, $leftmenu;
global $mysoc;
global $objectoffield;
// Old variables used
global $rights; global $rights;
global $object; global $object;
global $mysoc;
global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
global $soc; // For backward compatibility global $soc; // For backward compatibility

View File

@@ -336,15 +336,19 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$object->fetchObjectLinked('', '', '', ''); $object->fetchObjectLinked('', '', '', '');
//print_r($object->linkedObjects['propal']); exit; //print_r($object->linkedObjects['propal']); exit;
$propal_object = $object->linkedObjects['propal'][0]; if (isset($object->linkedObjects['propal'][0])) {
$propal_object = $object->linkedObjects['propal'][0];
} else {
$propal_object = null;
}
// Make substitution // Make substitution
$substitutionarray = array( $substitutionarray = array(
'__FROM_NAME__' => $this->emetteur->name, '__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email, '__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht, '__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_tva '__TOTAL_VAT__' => $object->total_tva
); );
complete_substitutions_array($substitutionarray, $langs, $object); complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
@@ -435,8 +439,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
} else { } else {
$odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
} }
} else // Text } else {
{ // Text
$odfHandler->setVars($key, $value, true, 'UTF-8'); $odfHandler->setVars($key, $value, true, 'UTF-8');
} }
} catch (OdfException $e) { } catch (OdfException $e) {

View File

@@ -1846,7 +1846,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($object->isService()) { if ($object->isService()) {
$type = $langs->trans('Service'); $type = $langs->trans('Service');
} }
//print load_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), ""); // print load_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
// Main official, simple, and not duplicated code // Main official, simple, and not duplicated code
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="formprod">'."\n"; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST" name="formprod">'."\n";
@@ -1865,19 +1865,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Ref // Ref
if (empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { if (empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) {
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag($object->ref).'"></td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag(GETPOSTISSET('ref') ? GETPOST('ref') : $object->ref).'"></td></tr>';
} else { } else {
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag($object->ref).'" readonly="true"></td></tr>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td colspan="3"><input name="ref" class="maxwidth200" maxlength="128" value="'.dol_escape_htmltag($object->ref).'" readonly="true"></td></tr>';
} }
// Label // Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag($object->label).'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td colspan="3"><input name="label" class="minwidth300 maxwidth400onsmartphone" maxlength="255" value="'.dol_escape_htmltag(GETPOSTISSET('label') ? GETPOST('label') : $object->label).'"></td></tr>';
// Status To sell // Status To sell
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td colspan="3">';
print '<select class="flat" name="statut">'; print '<select class="flat" name="statut">';
if ($object->status) { if ((GETPOSTISSET('statut') && GETPOST('statut')) || (!GETPOSTISSET('statut') && $object->status)) {
print '<option value="1" selected>'.$langs->trans("OnSell").'</option>'; print '<option value="1" selected>'.$langs->trans("OnSell").'</option>';
print '<option value="0">'.$langs->trans("NotOnSell").'</option>'; print '<option value="0">'.$langs->trans("NotOnSell").'</option>';
} else { } else {
@@ -1890,7 +1889,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Status To Buy // Status To Buy
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">'; print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td colspan="3">';
print '<select class="flat" name="statut_buy">'; print '<select class="flat" name="statut_buy">';
if ($object->status_buy) { if ((GETPOSTISSET('statut_buy') && GETPOST('statut_buy')) || (!GETPOSTISSET('statut_buy') && $object->status_buy)) {
print '<option value="1" selected>'.$langs->trans("ProductStatusOnBuy").'</option>'; print '<option value="1" selected>'.$langs->trans("ProductStatusOnBuy").'</option>';
print '<option value="0">'.$langs->trans("ProductStatusNotOnBuy").'</option>'; print '<option value="0">'.$langs->trans("ProductStatusNotOnBuy").'</option>';
} else { } else {
@@ -1905,7 +1904,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>'; print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
$statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial"));
print $form->selectarray('status_batch', $statutarray, $object->status_batch); print $form->selectarray('status_batch', $statutarray, (GETPOSTISSET('status_batch') ? GETPOST('status_batch') : $object->status_batch));
print '</td></tr>'; print '</td></tr>';
if (!empty($object->status_batch) || !empty($conf->use_javascript_ajax)) { if (!empty($object->status_batch) || !empty($conf->use_javascript_ajax)) {
$langs->load("admin"); $langs->load("admin");
@@ -2024,7 +2023,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Default warehouse // Default warehouse
print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>'; print '<tr><td>'.$langs->trans("DefaultWarehouse").'</td><td>';
print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"'); print img_picto($langs->trans("DefaultWarehouse"), 'stock', 'class="pictofixedwidth"');
print $formproduct->selectWarehouses($object->fk_default_warehouse, 'fk_default_warehouse', 'warehouseopen', 1); print $formproduct->selectWarehouses((GETPOSTISSET('fk_default_warehouse') ? GETPOST('fk_default_warehouse') : $object->fk_default_warehouse), 'fk_default_warehouse', 'warehouseopen', 1);
print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].'?action=create&type='.GETPOST('type', 'int')).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>'; print ' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].'?action=create&type='.GETPOST('type', 'int')).'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddWarehouse").'"></span></a>';
print '</td></tr>'; print '</td></tr>';
/* /*
@@ -2072,7 +2071,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { if (empty($conf->global->PRODUCT_DISABLE_NATURE)) {
// Nature // Nature
print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>'; print '<tr><td>'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).'</td><td>';
print $formproduct->selectProductNature('finished', $object->finished); print $formproduct->selectProductNature('finished', (GETPOSTISSET('finished') ? GETPOST('finished') : $object->finished));
print '</td></tr>'; print '</td></tr>';
} }
} }
@@ -2080,7 +2079,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (!$object->isService() && isModEnabled('bom')) { if (!$object->isService() && isModEnabled('bom')) {
print '<tr><td>'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).'</td><td>'; print '<tr><td>'.$form->textwithpicto($langs->trans("DefaultBOM"), $langs->trans("DefaultBOMDesc", $langs->transnoentitiesnoconv("Finished"))).'</td><td>';
$bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".((int) $object->id); $bomkey = "Bom:bom/class/bom.class.php:0:t.status=1 AND t.fk_product=".((int) $object->id);
print $form->selectForForms($bomkey, 'fk_default_bom', $object->fk_default_bom, 1); print $form->selectForForms($bomkey, 'fk_default_bom', (GETPOSTISSET('fk_default_bom') ? GETPOST('fk_default_bom') : $object->fk_default_bom), 1);
print '</td></tr>'; print '</td></tr>';
} }
@@ -2135,7 +2134,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Custom code // Custom code
if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) {
print '<tr><td class="wordbreak">'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.$object->customcode.'"></td></tr>'; print '<tr><td class="wordbreak">'.$langs->trans("CustomCode").'</td><td><input name="customcode" class="maxwidth100onsmartphone" value="'.(GETPOSTISSET('customcode') ? GETPOST('customcode') : $object->customcode).'"></td></tr>';
// Origin country // Origin country
print '<tr><td>'.$langs->trans("CountryOrigin").'</td>'; print '<tr><td>'.$langs->trans("CountryOrigin").'</td>';
print '<td>'; print '<td>';
@@ -2188,6 +2187,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$arrayselected[] = $cat->id; $arrayselected[] = $cat->id;
} }
} }
if (GETPOSTISSET('categories', 'array')) {
foreach (GETPOST('categories', 'array') as $cat) {
$arrayselected[] = $cat;
}
}
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print "</td></tr>"; print "</td></tr>";
} }
@@ -2213,76 +2217,76 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Accountancy_code_sell // Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300'); print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell), 'accountancy_code_sell', 1, '', 1, 1, 'minwidth150 maxwidth300');
print '</td></tr>'; print '</td></tr>';
// Accountancy_code_sell_intra // Accountancy_code_sell_intra
if ($mysoc->isInEEC()) { if ($mysoc->isInEEC()) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_code_sell_intra, 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra), 'accountancy_code_sell_intra', 1, '', 1, 1, 'minwidth150 maxwidth300');
print '</td></tr>'; print '</td></tr>';
} }
// Accountancy_code_sell_export // Accountancy_code_sell_export
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_code_sell_export, 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); print $formaccounting->select_account((GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export), 'accountancy_code_sell_export', 1, '', 1, 1, 'minwidth150 maxwidth300');
print '</td></tr>'; print '</td></tr>';
// Accountancy_code_buy // Accountancy_code_buy
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>'; print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300'); print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy), 'accountancy_code_buy', 1, '', 1, 1, 'minwidth150 maxwidth300');
print '</td></tr>'; print '</td></tr>';
// Accountancy_code_buy_intra // Accountancy_code_buy_intra
if ($mysoc->isInEEC()) { if ($mysoc->isInEEC()) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_code_buy_intra, 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300'); print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra), 'accountancy_code_buy_intra', 1, '', 1, 1, 'minwidth150 maxwidth300');
print '</td></tr>'; print '</td></tr>';
} }
// Accountancy_code_buy_export // Accountancy_code_buy_export
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
print '<td>'; print '<td>';
print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300'); print $formaccounting->select_account((GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export), 'accountancy_code_buy_export', 1, '', 1, 1, 'minwidth150 maxwidth300');
print '</td></tr>'; print '</td></tr>';
} else { } else {
// For external software // For external software
// Accountancy_code_sell // Accountancy_code_sell
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellCode").'</td>';
print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.$object->accountancy_code_sell.'">'; print '<td><input name="accountancy_code_sell" class="maxwidth200" value="'.(GETPOSTISSET('accountancy_code_sell') ? GETPOST('accountancy_code_sell') : $object->accountancy_code_sell).'">';
print '</td></tr>'; print '</td></tr>';
// Accountancy_code_sell_intra // Accountancy_code_sell_intra
if ($mysoc->isInEEC()) { if ($mysoc->isInEEC()) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellIntraCode").'</td>';
print '<td><input name="accountancy_code_sell_intra" class="maxwidth200" value="'.$object->accountancy_code_sell_intra.'">'; print '<td><input name="accountancy_code_sell_intra" class="maxwidth200" value="'.(GETPOSTISSET('accountancy_code_sell_intra') ? GETPOST('accountancy_code_sell_intra') : $object->accountancy_code_sell_intra).'">';
print '</td></tr>'; print '</td></tr>';
} }
// Accountancy_code_sell_export // Accountancy_code_sell_export
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancySellExportCode").'</td>';
print '<td><input name="accountancy_code_sell_export" class="maxwidth200" value="'.$object->accountancy_code_sell_export.'">'; print '<td><input name="accountancy_code_sell_export" class="maxwidth200" value="'.(GETPOSTISSET('accountancy_code_sell_export') ? GETPOST('accountancy_code_sell_export') : $object->accountancy_code_sell_export).'">';
print '</td></tr>'; print '</td></tr>';
// Accountancy_code_buy // Accountancy_code_buy
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>'; print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.$object->accountancy_code_buy.'">'; print '<td><input name="accountancy_code_buy" class="maxwidth200" value="'.(GETPOSTISSET('accountancy_code_buy') ? GETPOST('accountancy_code_buy') : $object->accountancy_code_buy).'">';
print '</td></tr>'; print '</td></tr>';
// Accountancy_code_buy_intra // Accountancy_code_buy_intra
if ($mysoc->isInEEC()) { if ($mysoc->isInEEC()) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyIntraCode").'</td>';
print '<td><input name="accountancy_code_buy_intra" class="maxwidth200" value="'.$object->accountancy_code_buy_intra.'">'; print '<td><input name="accountancy_code_buy_intra" class="maxwidth200" value="'.(GETPOSTISSET('accountancy_code_buy_intra') ? GETPOST('accountancy_code_buy_intra') : $object->accountancy_code_buy_intra).'">';
print '</td></tr>'; print '</td></tr>';
} }
// Accountancy_code_buy_export // Accountancy_code_buy_export
print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("ProductAccountancyBuyExportCode").'</td>';
print '<td><input name="accountancy_code_buy_export" class="maxwidth200" value="'.$object->accountancy_code_buy_export.'">'; print '<td><input name="accountancy_code_buy_export" class="maxwidth200" value="'.(GETPOSTISSET('accountancy_code_buy_export') ? GETPOST('accountancy_code_buy_export') : $object->accountancy_code_buy_export).'">';
print '</td></tr>'; print '</td></tr>';
} }
} }