Merge pull request #19058 from FHenry/fix_php8

fix php8 warning
This commit is contained in:
Laurent Destailleur 2021-10-31 18:02:14 +01:00 committed by GitHub
commit 5b4602fbd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 98 additions and 74 deletions

View File

@ -2210,7 +2210,7 @@ if ($id > 0) {
$delallowed = $user->rights->agenda->myactions->create;
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang);
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang());
print '</div><div class="fichehalfright">';

View File

@ -1031,6 +1031,7 @@ print "</tr>\n";
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);

View File

@ -48,7 +48,7 @@ if ($resql) { // This can fail when class is used on old database (during mig
case 'sellist':
$tmp = '';
$tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null
if ($tmpparam['options'] && is_array($tmpparam['options'])) {
if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) {
$tmpkeys = array_keys($tmpparam['options']);
$tmp = array_shift($tmpkeys);
}

View File

@ -1045,7 +1045,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line2 .= ($line2 ? " - " : "").$fromcompany->email;
}
}
if ($showdetails == 2 || $showdetails == 3 || ($fromcompany->country_code == 'DE')) {
if ($showdetails == 2 || $showdetails == 3 || (!empty($fromcompany->country_code) && $fromcompany->country_code == 'DE')) {
// Managers
if ($fromcompany->managers) {
$line2 .= ($line2 ? " - " : "").$fromcompany->managers;
@ -1054,11 +1054,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Line 3 of company infos
// Juridical status
if ($fromcompany->forme_juridique_code) {
if (!empty($fromcompany->forme_juridique_code) && $fromcompany->forme_juridique_code) {
$line3 .= ($line3 ? " - " : "").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
}
// Capital
if ($fromcompany->capital) {
if (!empty($fromcompany->capital) && $fromcompany->capital) {
$tmpamounttoshow = price2num($fromcompany->capital); // This field is a free string
if (is_numeric($tmpamounttoshow) && $tmpamounttoshow > 0) {
$line3 .= ($line3 ? " - " : "").$outputlangs->transnoentities("CapitalOf", price($tmpamounttoshow, 0, $outputlangs, 0, 0, 0, $conf->currency));
@ -1067,7 +1067,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
}
}
// Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
if (!empty($fromcompany->idprof1) && $fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
$field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@ -1075,7 +1075,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line3 .= ($line3 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof1);
}
// Prof Id 2
if ($fromcompany->idprof2) {
if (!empty($fromcompany->idprof2) && $fromcompany->idprof2) {
$field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@ -1085,7 +1085,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
// Line 4 of company infos
// Prof Id 3
if ($fromcompany->idprof3) {
if (!empty($fromcompany->idprof3) && $fromcompany->idprof3) {
$field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@ -1093,7 +1093,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof3);
}
// Prof Id 4
if ($fromcompany->idprof4) {
if (!empty($fromcompany->idprof4) && $fromcompany->idprof4) {
$field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@ -1101,7 +1101,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4);
}
// Prof Id 5
if ($fromcompany->idprof5) {
if (!empty($fromcompany->idprof5) && $fromcompany->idprof5) {
$field = $outputlangs->transcountrynoentities("ProfId5", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@ -1109,7 +1109,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5);
}
// Prof Id 6
if ($fromcompany->idprof6) {
if (!empty($fromcompany->idprof6) && $fromcompany->idprof6) {
$field = $outputlangs->transcountrynoentities("ProfId6", $fromcompany->country_code);
if (preg_match('/\((.*)\)/i', $field, $reg)) {
$field = $reg[1];
@ -1117,7 +1117,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_
$line4 .= ($line4 ? " - " : "").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6);
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '') {
if (!empty($fromcompany->tva_intra) && $fromcompany->tva_intra != '') {
$line4 .= ($line4 ? " - " : "").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($fromcompany->tva_intra);
}

View File

@ -282,7 +282,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$sepaname = '______________________________________________';
if ($thirdparty->id > 0) {
$sepaname = $thirdparty->name.($object->account_owner ? ' ('.$object->account_owner.')' : '');
$sepaname = $thirdparty->name.($object->proprio ? ' ('.$object->proprio.')' : '');
}
$posY = $pdf->GetY();
$posY += 3;

View File

@ -132,7 +132,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Parametrage du prefix customers
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("CustomerCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.$conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER.'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value1" value="'.getDolGlobalConst('COMPANY_ELEPHANT_MASK_CUSTOMER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"'.$disabled.'></td>';
@ -140,7 +140,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Parametrage du prefix suppliers
$texte .= '<tr><td>'.$langs->trans("Mask").' ('.$langs->trans("SupplierCodeModel").'):</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value2" value="'.$conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER.'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="value2" value="'.getDolGlobalConst('COMPANY_ELEPHANT_MASK_SUPPLIER').'"'.$disabled.'>', $tooltip, 1, 1).'</td>';
$texte .= '</tr>';
$texte .= '</table>';

View File

@ -53,6 +53,9 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
print '</td>';
if (!$i) {
if (empty($totalarray)) {
$totalarray['nbfield'] = 0;
}
$totalarray['nbfield']++;
}

View File

@ -138,6 +138,7 @@ if (in_array($modulepart, array('facture_paiement', 'unpaid'))) {
*/
// If we have a hash public (hashp), we guess the original_file.
$ecmfile='';
if (!empty($hashp)) {
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($db);

View File

@ -2178,8 +2178,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
print $object->getLibStatut(0, 2);
print '</td></tr>';
if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) {
if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) {
print '<tr><td>'.$langs->trans("ManageLotMask").'</td><td>';
print $object->batch_mask;
print '</td></tr>';
@ -2689,7 +2689,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
// Documents
$objectref = dol_sanitizeFileName($object->ref);
$relativepath = $comref.'/'.$objectref.'.pdf';
if (!empty($conf->product->multidir_output[$object->entity])) {
$filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities
} else {
@ -2699,7 +2698,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
$genallowed = $usercanread;
$delallowed = $usercancreate;
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $langs->getDefaultLang(), '', $object);
$somethingshown = $formfile->numoffiles;
print '</div><div class="fichehalfright">';

View File

@ -931,7 +931,7 @@ END;
'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.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => (!empty($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.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>15),
@ -942,14 +942,19 @@ END;
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["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) {
$extratitle = $langs->trans($value);
$arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position'] + 1), 'langfile'=>$extrafields->attributes["product_fournisseur_price"]['langfile'][$key], 'help'=>$extrafields->attributes["product_fournisseur_price"]['help'][$key]);
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) {
$extratitle = $langs->trans($value);
$arrayfields['ef.' . $key] = array('label' => $extratitle, 'checked' => 0,
'position' => (end($arrayfields)['position'] + 1),
'langfile' => $extrafields->attributes["product_fournisseur_price"]['langfile'][$key],
'help' => $extrafields->attributes["product_fournisseur_price"]['help'][$key]);
}
}
}
}
@ -1023,29 +1028,31 @@ END;
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["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);
}
if (!empty($arrayfields['ef.'.$key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.'.$key, '', $param, '', $sortfield, $sortorder, 'right ');
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);
}
if (!empty($arrayfields['ef.' . $key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.' . $key, '', $param, '', $sortfield, $sortorder, 'right ');
}
}
}
}
}
if (is_object($hookmanager)) {
$parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
$parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@ -1213,7 +1220,7 @@ END;
}
if (is_object($hookmanager)) {
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);
}

View File

@ -746,7 +746,7 @@ if (!$conf->use_javascript_ajax) {
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
);
print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print $form->selectarray("activate_COMPANY_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'COMPANY_USE_SEARCH_TO_SELECT')?$conf->global->COMPANY_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td><td class="right">';
print '<input type="submit" class="button reposition" name="COMPANY_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print "</td>";
@ -767,7 +767,7 @@ if (!$conf->use_javascript_ajax) {
'2'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
'3'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
);
print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, $conf->global->CONTACT_USE_SEARCH_TO_SELECT, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print $form->selectarray("activate_CONTACT_USE_SEARCH_TO_SELECT", $arrval, (property_exists($conf->global, 'CONTACT_USE_SEARCH_TO_SELECT')?$conf->global->CONTACT_USE_SEARCH_TO_SELECT:''), 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp');
print '</td><td class="right">';
print '<input type="submit" class="button reposition" name="CONTACT_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
print "</td>";
@ -870,7 +870,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("DefaultCustomerType").'</td>';
print '<td>';
print $formcompany->selectProspectCustomerType($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT, 'defaultcustomertype', 'defaultcustomertype', 'admin');
print $formcompany->selectProspectCustomerType((property_exists($conf->global, 'THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT')?$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT:''), 'defaultcustomertype', 'defaultcustomertype', 'admin');
print '</td>';
print '<td class="center">';
print '<input type="submit" class="button reposition" name="THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT" value="'.$langs->trans("Modify").'">';

View File

@ -50,6 +50,8 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
@ -160,16 +162,16 @@ if ($object->client) {
$obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer");
if ($conf->propal->enabled && $user->rights->propal->lire) {
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
if ($conf->commande->enabled && $user->rights->commande->lire) {
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
if ($conf->facture->enabled && $user->rights->facture->lire) {
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if ($conf->contrat->enabled && $user->rights->contrat->lire) {
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
}
@ -219,6 +221,7 @@ print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?socid='.$socid.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
$sql_select = '';
$documentstaticline = '';
/*if ($type_element == 'action')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -232,7 +235,8 @@ $sql_select = '';
if ($type_element == 'fichinter') { // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$documentstatic = new Fichinter($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, ';
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, NULL as paid, ';
$sql_select .= 'NULL as fk_product, NULL as info_bits, NULL as date_start, NULL as date_end, NULL as prod_qty, NULL as total_ht, ';
$tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines.
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND f.entity = ".$conf->entity;
@ -242,7 +246,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices
if ($type_element == 'invoice') { // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic = new Facture($db);
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, ';
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, d.fk_remise_except, ';
$tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_facture = f.rowid";
@ -254,7 +258,7 @@ if ($type_element == 'invoice') { // Customer : show products from invoices
if ($type_element == 'propal') {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$documentstatic = new Propal($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, NULL as paid,';
$tables_from = MAIN_DB_PREFIX."propal as c,".MAIN_DB_PREFIX."propaldet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_propal = c.rowid";
@ -266,7 +270,7 @@ if ($type_element == 'propal') {
if ($type_element == 'order') {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic = new Commande($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, NULL as paid, ';
$tables_from = MAIN_DB_PREFIX."commande as c,".MAIN_DB_PREFIX."commandedet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_commande = c.rowid";
@ -290,7 +294,7 @@ if ($type_element == 'supplier_invoice') { // Supplier : Show products from inv
if ($type_element == 'supplier_proposal') {
require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$documentstatic = new SupplierProposal($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, NULL as paid, ';
$tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_supplier_proposal = c.rowid";
@ -302,7 +306,7 @@ if ($type_element == 'supplier_proposal') {
if ($type_element == 'supplier_order') { // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic = new CommandeFournisseur($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, NULL as paid, ';
$tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_commande = c.rowid";
@ -315,7 +319,7 @@ if ($type_element == 'contract') { // Order
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$documentstatic = new Contrat($db);
$documentstaticline = new ContratLigne($db);
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, ';
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, NULL as paid,';
$tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d";
$where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".((int) $socid);
$where .= " AND d.fk_contrat = c.rowid";
@ -341,7 +345,7 @@ if (!empty($sql_select)) {
$sql .= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
}
if ($type_element != 'fichinter') {
$sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,';
$sql .= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity, ';
}
$sql .= " s.rowid as socid ";
if ($type_element != 'fichinter') {
@ -423,7 +427,7 @@ if ($sql_select) {
if ($year) {
$param .= "&year=".urlencode($year);
}
if ($optioncss != '') {
if ($optioncss) {
$param .= '&optioncss='.urlencode($optioncss);
}
@ -567,6 +571,7 @@ if ($sql_select) {
</a>
<?php
if ($objp->description) {
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0) {
$discount = new DiscountAbsolute($db);
$discount->fetch($objp->fk_remise_except);
@ -652,7 +657,10 @@ if ($sql_select) {
$total_qty += $objp->prod_qty;
print '<td class="right"><span class="amount">'.price($objp->total_ht).'</span></td>';
$total_ht += $objp->total_ht;
if (empty($total_ht)) {
$total_ht = 0;
}
$total_ht += (float) $objp->total_ht;
print '<td class="right">'.price($objp->total_ht / (empty($objp->prod_qty) ? 1 : $objp->prod_qty)).'</td>';

View File

@ -773,16 +773,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$obj = $db->fetch_object($resql);
$nbFactsClient = $obj->nb;
$thirdTypeArray['customer'] = $langs->trans("customer");
if ($conf->propal->enabled && $user->rights->propal->lire) {
if (!empty($conf->propal->enabled) && $user->rights->propal->lire) {
$elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals');
}
if ($conf->commande->enabled && $user->rights->commande->lire) {
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders');
}
if ($conf->facture->enabled && $user->rights->facture->lire) {
if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
$elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices');
}
if ($conf->contrat->enabled && $user->rights->contrat->lire) {
if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
$elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts');
}
@ -1304,7 +1304,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
}
print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre('', '', '', '', '', '', '', '', 'center ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch ');
print "</tr>\n";
foreach ($rib_list as $rib) {
@ -1393,7 +1393,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$out = '';
if (is_array($modellist) && count($modellist)) {
$out .= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
$out .= '<form action="'.$_SERVER["PHP_SELF"].(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
$out .= '<input type="hidden" name="action" value="builddocrib">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">';
$out .= '<input type="hidden" name="socid" value="'.$object->id.'">';
@ -1407,14 +1407,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$modelselected = $conf->global->BANKADDON_PDF;
}
$out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0, '', 0, 0, 0, '', 'minwidth100');
$out .= ajax_combobox('modelrib'.$rib->id);
$allowgenifempty = 0;
// Language code (if multilang)
if ($conf->global->MAIN_MULTILANGS) {
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$formadmin = new FormAdmin($db);
$defaultlang = $codelang ? $codelang : $langs->getDefaultLang();
$defaultlang = $langs->getDefaultLang();
$morecss = 'maxwidth150';
if ($conf->browser->layout == 'phone') {
$morecss = 'maxwidth100';

View File

@ -919,6 +919,7 @@ if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_a
// Loop on record
// --------------------------------------------------------------------
$i = 0;
$cacheofoutputfield = array();
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@ -953,15 +954,17 @@ while ($i < min($num, $limit)) {
}
if (!empty($arrayfields['t.'.$key]['checked'])) {
print '<td';
if (!empty($cssforfield) || !empty($val['css'])) {
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print ' class="';
}
print empty($cssforfield) ? '' : $cssforfield;
if (!empty($cssforfield) && !empty($val['css'])) {
print $cssforfield;
if ($cssforfield && array_key_exists('css', $val) && $val['css']) {
print ' ';
}
print empty($val['css']) ? '' : $val['css'];
if (!empty($cssforfield) || !empty($val['css'])) {
if (array_key_exists('css', $val)) {
print $val['css'];
}
if ($cssforfield || (array_key_exists('css', $val) && $val['css'])) {
print '"';
}
print '>';