diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 91ae4345214..42257707ea2 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -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 '
';
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index a3ae38184e9..02e0211c01d 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -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);
}
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index 53b1a85e889..f56d531ffdf 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -67,10 +67,12 @@ $search_task_user = GETPOST('search_task_user', 'int');
$search_task_progress = GETPOST('search_task_progress');
$search_task_budget_amount = GETPOST('search_task_budget_amount');
$search_societe = GETPOST('search_societe');
+$search_opp_status = GETPOST("search_opp_status", 'alpha');
-$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
+$mine = GETPOST('mode', 'alpha') == 'mine' ? 1 : 0;
if ($mine) {
- $search_task_user = $user->id; $mine = 0;
+ $search_task_user = $user->id;
+ $mine = 0;
}
$search_date_startday = GETPOST('search_date_startday', 'int');
@@ -346,7 +348,7 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid";
}
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
}
if ($search_project_user > 0) {
@@ -604,7 +606,9 @@ print '
';
print '
';
print '
';
print '
';
-print '
';
+if (!empty($type)) {
+ print '
';
+}
print '
';
// Show description of content
@@ -634,7 +638,7 @@ if ($search_all) {
print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
';
}
-$morehtmlfilter = '';
+$moreforfilter = '';
// Filter on categories
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
@@ -861,10 +865,34 @@ if (!empty($arrayfields['t.tobill']['checked'])) {
if (!empty($arrayfields['t.billed']['checked'])) {
print_liste_field_titre($arrayfields['t.billed']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'center ');
}
+$totalarray = array(
+ 'nbfield' => 0,
+ 'val' => array(
+ 't.planned_workload' => 0,
+ 't.duration_effective' => 0,
+ 't.progress' => 0,
+ 't.budget_amount' => 0,
+ ),
+ 'totalplannedworkload' => 0,
+ 'totaldurationeffective' => 0,
+ 'totaldurationdeclared' => 0,
+ 'totaltobillfield' => 0,
+ 'totalbilledfield' => 0,
+ 'totalbudget_amountfield' => 0,
+ 'totalbudgetamount' => 0,
+ 'totaltobill' => 0,
+ 'totalbilled' => 0,
+);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
-$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
+$parameters = array(
+ 'arrayfields' => $arrayfields,
+ 'param' => $param,
+ 'sortfield' => $sortfield,
+ 'sortorder' => $sortorder,
+ 'totalarray' => &$totalarray,
+);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (!empty($arrayfields['t.datec']['checked'])) {
@@ -887,7 +915,6 @@ if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) {
}
$i = 0;
-$totalarray = array();
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);
@@ -1148,7 +1175,7 @@ while ($i < min($num, $limit)) {
}
$totalarray['val']['t.budget_amount'] += $obj->budget_amount;
if (!$i) {
- $totalarray['totalbudget_amount'] = $totalarray['nbfield'];
+ $totalarray['totalbudget_amountfield'] = $totalarray['nbfield'];
}
$totalarray['totalbudgetamount'] += $obj->budget_amount;
print '';
@@ -1269,7 +1296,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota
print '
'.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).' | ';
} elseif ($totalarray['totalbilledfield'] == $i) {
print '
'.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).' | ';
- } elseif ($totalarray['totalbudget_amount'] == $i) {
+ } elseif ($totalarray['totalbudget_amountfield'] == $i) {
print '
'.price($totalarray['totalbudgetamount'], 0, $langs, 1, 0, 0, $conf->currency).' | ';
} else {
print '
| ';
diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php
index 18bc3a3785b..536eb0546cc 100644
--- a/htdocs/societe/admin/societe.php
+++ b/htdocs/societe/admin/societe.php
@@ -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 '
';
print '';
print " | ";
@@ -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 '
';
print '';
print " | ";
@@ -870,7 +870,7 @@ if (empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
print '
';
print '| '.$langs->trans("DefaultCustomerType").' | ';
print '';
- 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 ' | ';
print '';
print '';
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index c4bd26e1fc2..d9abbd61c22 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -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 ' |
\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 .= '