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

This commit is contained in:
Laurent Destailleur 2020-09-09 19:25:36 +02:00
commit fb51fe1087
9 changed files with 141 additions and 74 deletions

View File

@ -390,7 +390,7 @@ if ($resql)
if (!empty($arrayfields['aa.account_number']['checked'])) if (!empty($arrayfields['aa.account_number']['checked']))
{ {
print "<td>"; print "<td>";
print $accountstatic->getNomUrl(1, 0, 0, '', 0, 1); print $accountstatic->getNomUrl(1, 0, 0, '', 0, 1, 0, 'accountcard');
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@ -44,6 +44,8 @@ $cancel = GETPOST('cancel', 'alpha');
$accountingaccount = GETPOST('accountingaccount', 'alpha'); $accountingaccount = GETPOST('accountingaccount', 'alpha');
// Security check // Security check
if ($user->socid > 0) accessforbidden();
if (!$user->rights->accounting->chartofaccount) accessforbidden();
$object = new AccountingAccount($db); $object = new AccountingAccount($db);

View File

@ -252,8 +252,8 @@ if ($action != 'export_csv')
print $langs->trans('to'); print $langs->trans('to');
print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, '');
print '</td>'; print '</td>';
print '<td class="liste_titre right">'; print '<td class="liste_titre center">';
$searchpicto = $form->showFilterAndCheckAddButtons(0); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -290,7 +290,7 @@ if ($action != 'export_csv')
{ {
$accountingaccountstatic->fetch(null, $line->numero_compte, true); $accountingaccountstatic->fetch(null, $line->numero_compte, true);
if (!empty($accountingaccountstatic->account_number)) { if (!empty($accountingaccountstatic->account_number)) {
$accounting_account = $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1); $accounting_account = $accountingaccountstatic->getNomUrl(0, 1);
} else { } else {
$accounting_account = length_accountg($line->numero_compte); $accounting_account = length_accountg($line->numero_compte);
} }

View File

@ -460,12 +460,15 @@ class AccountingAccount extends CommonObject
$result = ''; $result = '';
if (empty($option)) { if (empty($option) || $option == 'bookkeeping') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number; $url = DOL_URL_ROOT . '/accountancy/bookkeeping/list.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$labelurl = $langs->trans("ShowAccountingAccountInBookKeeping");
} elseif ($option == 'bookkeepinglistbyaccount') { } elseif ($option == 'bookkeepinglistbyaccount') {
$url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number; $url = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . $this->account_number . '&search_accountancy_code_end=' . $this->account_number;
$labelurl = $langs->trans("ShowAccountingAccountInBookKeepingByAccount");
} elseif ($option == 'accountcard') { } elseif ($option == 'accountcard') {
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id; $url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
$labelurl = $langs->trans("ShowAccountingAccount");
} }
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
@ -483,7 +486,7 @@ class AccountingAccount extends CommonObject
$labeltoshow = $this->labelshort; $labeltoshow = $this->labelshort;
} }
$label = '<u>'.$langs->trans("ShowAccountingAccount").'</u>'; $label = '<u>'.$labelurl.'</u>';
if (!empty($this->account_number)) if (!empty($this->account_number))
$label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number); $label .= '<br><b>'.$langs->trans('AccountAccounting').':</b> '.length_accountg($this->account_number);
if (!empty($labeltoshow)) if (!empty($labeltoshow))
@ -495,7 +498,7 @@ class AccountingAccount extends CommonObject
{ {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$label = $langs->trans("ShowAccountingAccount"); $label = $labelurl;
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
} }
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';

View File

@ -7538,7 +7538,7 @@ class Form
} }
/** /**
* Return HTML to show the search and clear seach button * Return HTML to show the search and clear search button
* *
* @param string $cssclass CSS class * @param string $cssclass CSS class
* @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes * @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes
@ -7611,7 +7611,7 @@ class Form
*/ */
public function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array(), $info_admin = 1) public function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array(), $info_admin = 1)
{ {
global $db, $conf, $langs, $user; global $db, $langs, $user;
$out = ''; $out = '';
$sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1'; $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1';
@ -7933,7 +7933,7 @@ class Form
*/ */
public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array()) public function searchComponent($arrayofcriterias, $search_component_params, $arrayofinputfieldsalreadyoutput = array())
{ {
global $conf, $langs; global $langs;
$ret = ''; $ret = '';

View File

@ -56,7 +56,7 @@ function accounting_prepare_head(AccountingAccount $object)
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("Asset"); $head[$h][1] = $langs->trans("AccountAccounting");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;

View File

@ -127,7 +127,7 @@ if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions =
$massactionbutton = $form->selectMassAction('', $arrayofmassactions); $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,"; $sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity, tosell, tobuy,";
$sql .= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,"; $sql .= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,";
$sql .= " s.rowid as socid, s.nom as name"; $sql .= " s.rowid as socid, s.nom as name";
// Add fields to SELECT from hooks // Add fields to SELECT from hooks
@ -296,6 +296,8 @@ if ($resql)
$productstatic->ref = $objp->ref; $productstatic->ref = $objp->ref;
$productstatic->type = $objp->fk_product_type; $productstatic->type = $objp->fk_product_type;
$productstatic->entity = $objp->entity; $productstatic->entity = $objp->entity;
$productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy;
print $productstatic->getNomUrl(1, 'supplier'); print $productstatic->getNomUrl(1, 'supplier');
print '</td>'; print '</td>';

View File

@ -89,6 +89,8 @@ SubledgerAccount=Subledger account
SubledgerAccountLabel=Subledger account label SubledgerAccountLabel=Subledger account label
ShowAccountingAccount=Show accounting account ShowAccountingAccount=Show accounting account
ShowAccountingJournal=Show accounting journal ShowAccountingJournal=Show accounting journal
ShowAccountingAccountInBookKeeping=Show accounting account in ledger
ShowAccountingAccountInBookKeepingByAccount=Show accounting account in ledger by account
AccountAccountingSuggest=Accounting account suggested AccountAccountingSuggest=Accounting account suggested
MenuDefaultAccounts=Default accounts MenuDefaultAccounts=Default accounts
MenuBankAccounts=Bank accounts MenuBankAccounts=Bank accounts

View File

@ -858,6 +858,52 @@ SCRIPT;
print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1); print_barre_liste($langs->trans('SupplierPrices'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit, 1);
// Definition of fields for lists
// Some fields are missing because they are not included in the database query
$arrayfields = array(
'pfp.datec'=>array('label'=>$langs->trans("AppliedPricesFrom"), 'checked'=>1, 'position'=>1),
's.nom'=>array('label'=>$langs->trans("Suppliers"), 'checked'=>1, 'position'=>2),
'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY), 'checked'=>0, 'position'=>4),
'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5),
'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9),
'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => $conf->multicurrency->enabled, 'checked'=>0, 'position'=>10),
'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13),
'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14),
'pfp.barcode'=>array('label'=>$langs->trans("BarcodeValue"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>15),
'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>16),
'pfp.packaging'=>array('label'=>$langs->trans("PackagingForThisProduct"), 'enabled' => !empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING), 'checked'=>0, 'position'=>17),
'pfp.tms'=>array('label'=>$langs->trans("DateModification"), 'enabled' => $conf->barcode->enabled, 'checked'=>1, 'position'=>18),
);
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
else $extratitle = $langs->trans($value);
$arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position']+1));
}
}
}
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post" name="formulaire">';
print '<input type="hidden" name="token" value="'. newToken() . '">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
// Suppliers list title // Suppliers list title
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="liste centpercent">'; print '<table class="liste centpercent">';
@ -865,42 +911,37 @@ SCRIPT;
$param = "&id=".$object->id; $param = "&id=".$object->id;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['pfp.datec']['checked'])) print_liste_field_titre("AppliedPricesFrom", $_SERVER["PHP_SELF"], "pfp.datec", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre("Suppliers", $_SERVER["PHP_SELF"], "s.nom", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("SupplierRef", $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre("Availability", $_SERVER["PHP_SELF"], "pfp.fk_availability", "", $param, "", $sortfield, $sortorder); if (!empty($arrayfields['pfp.fk_availability']['checked'])) print_liste_field_titre("Availability", $_SERVER["PHP_SELF"], "pfp.fk_availability", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['pfp.quantity']['checked'])) print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "pfp.quantity", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
if ($conf->multicurrency->enabled) { if ($conf->multicurrency->enabled) print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['pfp.unitprice']['checked'])) print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "pfp.unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
} if (!empty($arrayfields['pfp.multicurrency_unitprice']['checked'])) print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "pfp.unitprice", "", $param, '', $sortfield, $sortorder, 'right '); if ($conf->multicurrency->enabled) print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
if ($conf->multicurrency->enabled) {
print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
}
print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("NbDaysToDelivery", $_SERVER["PHP_SELF"], "pfp.delivery_time_days", "", $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['pfp.delivery_time_days']['checked'])) print_liste_field_titre("NbDaysToDelivery", $_SERVER["PHP_SELF"], "pfp.delivery_time_days", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("ReputationForThisProduct", $_SERVER["PHP_SELF"], "pfp.supplier_reputation", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['pfp.supplier_reputation']['checked'])) print_liste_field_titre("ReputationForThisProduct", $_SERVER["PHP_SELF"], "pfp.supplier_reputation", "", $param, '', $sortfield, $sortorder, 'center ');
if ($conf->barcode->enabled) { if (!empty($arrayfields['pfp.barcode']['checked'])) print_liste_field_titre("BarcodeValue", $_SERVER["PHP_SELF"], "pfp.barcode", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("BarcodeValue", $_SERVER["PHP_SELF"], "pfp.barcode", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['pfp.fk_barcode_type']['checked'])) print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("BarcodeType", $_SERVER["PHP_SELF"], "pfp.fk_barcode_type", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['pfp.packaging']['checked'])) print_liste_field_titre("PackagingForThisProduct", $_SERVER["PHP_SELF"], "pfp.packaging", "", $param, 'align="center"', $sortfield, $sortorder);
} if (!empty($arrayfields['pfp.tms']['checked'])) print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) print_liste_field_titre("PackagingForThisProduct", $_SERVER["PHP_SELF"], "pfp.packaging", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("DateModification", $_SERVER["PHP_SELF"], "pfp.tms", "", $param, '', $sortfield, $sortorder, 'right ');
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price"); $extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label']; $extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if (!empty($extralabels)) { if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) { foreach ($extralabels as $key => $value) {
// Show field if not hidden // Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
else $extratitle = $langs->trans($value); else $extratitle = $langs->trans($value);
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); if (!empty($arrayfields['ef.'.$key]['checked'])) print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.'.$key, '', $param, '', $sortfield, $sortorder, 'right ');
} }
} }
} }
@ -910,7 +951,7 @@ SCRIPT;
$parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id); $parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
} }
print_liste_field_titre(''); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
if (is_array($product_fourn_list)) if (is_array($product_fourn_list))
@ -920,10 +961,14 @@ SCRIPT;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Date from // Date from
print '<td>'.dol_print_date(($productfourn->fourn_date_creation ? $productfourn->fourn_date_creation : $productfourn->date_creation), 'dayhour').'</td>'; if (!empty($arrayfields['pfp.datec']['checked'])) {
print '<td>'.dol_print_date(($productfourn->fourn_date_creation ? $productfourn->fourn_date_creation : $productfourn->date_creation), 'dayhour').'</td>';
}
// Supplier // Supplier
print '<td>'.$productfourn->getSocNomUrl(1, 'supplier').'</td>'; if (!empty($arrayfields['s.nom']['checked'])) {
print '<td>'.$productfourn->getSocNomUrl(1, 'supplier').'</td>';
}
// Supplier ref // Supplier ref
if ($usercancreate) // change required right here if ($usercancreate) // change required right here
@ -934,7 +979,7 @@ SCRIPT;
} }
// Availability // Availability
if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) if (!empty($arrayfields['pfp.fk_availability']['checked']))
{ {
$form->load_cache_availability(); $form->load_cache_availability();
$availability = $form->cache_availability[$productfourn->fk_availability]['label']; $availability = $form->cache_availability[$productfourn->fk_availability]['label'];
@ -942,16 +987,18 @@ SCRIPT;
} }
// Quantity // Quantity
print '<td class="right">'; if (!empty($arrayfields['pfp.quantity']['checked'])) {
print $productfourn->fourn_qty; print '<td class="right">';
// Units print $productfourn->fourn_qty;
if ($conf->global->PRODUCT_USE_UNITS) { // Units
$unit = $object->getLabelOfUnit(); if ($conf->global->PRODUCT_USE_UNITS) {
if ($unit !== '') { $unit = $object->getLabelOfUnit();
print '&nbsp;&nbsp;'.$langs->trans($unit); if ($unit !== '') {
} print '&nbsp;&nbsp;'.$langs->trans($unit);
} }
print '</td>'; }
print '</td>';
}
// VAT rate // VAT rate
print '<td class="right">'; print '<td class="right">';
@ -971,18 +1018,21 @@ SCRIPT;
} }
// Unit price // Unit price
print '<td class="right">'; if (!empty($arrayfields['pfp.unitprice']['checked'])) {
print price($productfourn->fourn_unitprice); print '<td class="right">';
//print $objp->unitprice? price($objp->unitprice) : ($objp->quantity?price($objp->price/$objp->quantity):"&nbsp;"); print price($productfourn->fourn_unitprice);
print '</td>'; //print $objp->unitprice? price($objp->unitprice) : ($objp->quantity?price($objp->price/$objp->quantity):"&nbsp;");
print '</td>';
}
if ($conf->multicurrency->enabled) { // Unit price in currency
// Unit price in currency if (!empty($arrayfields['pfp.multicurrency_unitprice']['checked'])) {
print '<td class="right">'; print '<td class="right">';
print price($productfourn->fourn_multicurrency_unitprice); print price($productfourn->fourn_multicurrency_unitprice);
print '</td>'; print '</td>';}
// Currency // Currency
if ($conf->multicurrency->enabled) {
print '<td class="right">'; print '<td class="right">';
print $productfourn->fourn_multicurrency_code ? currency_name($productfourn->fourn_multicurrency_code) : ''; print $productfourn->fourn_multicurrency_code ? currency_name($productfourn->fourn_multicurrency_code) : '';
print '</td>'; print '</td>';
@ -994,24 +1044,30 @@ SCRIPT;
print '</td>'; print '</td>';
// Delivery delay // Delivery delay
print '<td class="right">'; if (!empty($arrayfields['pfp.delivery_time_days']['checked'])) {
print $productfourn->delivery_time_days; print '<td class="right">';
print '</td>'; print $productfourn->delivery_time_days;
print '</td>';
}
// Reputation // Reputation
print '<td class="center">'; if (!empty($arrayfields['pfp.supplier_reputation']['checked'])) {
if (!empty($productfourn->supplier_reputation) && !empty($object->reputations[$productfourn->supplier_reputation])) { print '<td class="center">';
print $object->reputations[$productfourn->supplier_reputation]; if (!empty($productfourn->supplier_reputation) && !empty($object->reputations[$productfourn->supplier_reputation])) {
print $object->reputations[$productfourn->supplier_reputation];
}
print'</td>';
} }
print'</td>';
if ($conf->barcode->enabled) { // Barcode
// Barcode if (!empty($arrayfields['pfp.barcode']['checked'])) {
print '<td align="right">'; print '<td align="right">';
print $productfourn->barcode; print $productfourn->barcode;
print '</td>'; print '</td>';
}
// Barcode type // Barcode type
if (!empty($arrayfields['pfp.fk_barcode_type']['checked'])) {
print '<td class="center">'; print '<td class="center">';
$productfourn->barcode_type = !empty($productfourn->fk_barcode_type) ? $productfourn->fk_barcode_type : 0; $productfourn->barcode_type = !empty($productfourn->fk_barcode_type) ? $productfourn->fk_barcode_type : 0;
$productfourn->fetch_barcode(); $productfourn->fetch_barcode();
@ -1020,17 +1076,18 @@ SCRIPT;
} }
// Packaging // Packaging
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) if (!empty($arrayfields['pfp.packaging']['checked'])) {
{
print '<td align="center">'; print '<td align="center">';
print price2num($productfourn->packaging); print price2num($productfourn->packaging);
print '</td>'; print '</td>';
} }
// Date // Date
print '<td align="right">'; if (!empty($arrayfields['pfp.tms']['checked'])) {
print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification), "dayhour"); print '<td align="right">';
print '</td>'; print dol_print_date(($productfourn->fourn_date_modification ? $productfourn->fourn_date_modification : $productfourn->date_modification), "dayhour");
print '</td>';
}
// Extrafields // Extrafields
if (!empty($extralabels)) { if (!empty($extralabels)) {
@ -1045,14 +1102,14 @@ SCRIPT;
if ($resql) { if ($resql) {
if ($db->num_rows($resql) != 1) { if ($db->num_rows($resql) != 1) {
foreach ($extralabels as $key => $value) { foreach ($extralabels as $key => $value) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { if (!empty($arrayfields['ef.'.$key]['checked']) && !empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
print "<td></td>"; print "<td></td>";
} }
} }
} else { } else {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
foreach ($extralabels as $key => $value) { foreach ($extralabels as $key => $value) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { if (!empty($arrayfields['ef.'.$key]['checked']) && !empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key})."</td>"; print '<td align="right">'.$extrafields->showOutputField($key, $obj->{$key})."</td>";
} }
} }
@ -1087,6 +1144,7 @@ SCRIPT;
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</form>';
} }
} }
} }