mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-05 09:08:09 +01:00
Fix: multiple avoid Warning and errors
This commit is contained in:
@@ -6466,27 +6466,30 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
|
||||
// Clean parameters
|
||||
$order=strtolower($order);
|
||||
|
||||
$sizearray=count($array);
|
||||
if (is_array($array) && $sizearray>0)
|
||||
if (is_array($array))
|
||||
{
|
||||
$temp = array();
|
||||
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
||||
|
||||
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
||||
else
|
||||
$sizearray=count($array);
|
||||
if ($sizearray>0)
|
||||
{
|
||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
||||
$temp = array();
|
||||
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
||||
|
||||
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
||||
else
|
||||
{
|
||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
||||
}
|
||||
|
||||
$sorted = array();
|
||||
|
||||
foreach(array_keys($temp) as $key)
|
||||
{
|
||||
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
|
||||
}
|
||||
|
||||
return $sorted;
|
||||
}
|
||||
|
||||
$sorted = array();
|
||||
|
||||
foreach(array_keys($temp) as $key)
|
||||
{
|
||||
(is_numeric($key) && empty($keepindex)) ? $sorted[]=$array[$key] : $sorted[$key]=$array[$key];
|
||||
}
|
||||
|
||||
return $sorted;
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
@@ -148,12 +148,13 @@ if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
$numtoselect = (is_array($toselect)?count($toselect):0);
|
||||
if (! empty($massaction) && $numtoselect < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
if (! $error && $numtoselect > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
@@ -541,7 +542,7 @@ if ($resql)
|
||||
{
|
||||
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
|
||||
$receiving='';
|
||||
if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
|
||||
if (is_array($shipment->linkedObjects['delivery']) && count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
|
||||
|
||||
if (! empty($arrayfields['l.ref']['checked']))
|
||||
{
|
||||
|
||||
@@ -41,6 +41,12 @@ DROP TABLE llx_c_accountingaccount;
|
||||
|
||||
update llx_propal set fk_statut = 1 where fk_statut = -1;
|
||||
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_author integer;
|
||||
ALTER TABLE llx_inventory CHANGE COLUMN fk_user_author fk_user_creat integer;
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_modif integer;
|
||||
ALTER TABLE llx_inventory ADD COLUMN fk_user_valid integer;
|
||||
ALTER TABLE llx_inventory ADD COLUMN import_key varchar(14);
|
||||
|
||||
|
||||
-- For 8.0
|
||||
|
||||
|
||||
@@ -185,7 +185,9 @@ foreach($object->fields as $key => $val)
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
if (! empty($extrafields->attributes[$object->element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
@@ -409,12 +411,13 @@ print '</tr>'."\n";
|
||||
|
||||
// Detect if we need a fetch on each output line
|
||||
$needToFetchEachLine=0;
|
||||
foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
if (! empty($extrafields->attributes[$object->element]['computed'])) {
|
||||
foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val)
|
||||
{
|
||||
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
|
||||
@@ -278,7 +278,9 @@ else
|
||||
$sql .= ', pac.rowid prod_comb_id';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
if (! empty($extrafields->attributes[$object->element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@@ -335,7 +337,9 @@ else
|
||||
$sql .= ', pac.rowid';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : '');
|
||||
if (! empty($extrafields->attributes[$object->element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->element]['type'][$key] != 'separate' ? ",ef.".$key : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
|
||||
@@ -43,7 +43,7 @@ $sortorder = GETPOST("sortorder");
|
||||
if (! $sortfield) $sortfield="e.ref";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
$page = GETPOST("page");
|
||||
if ($page < 0) $page = 0;
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
|
||||
$year = strftime("%Y",time());
|
||||
|
||||
@@ -55,6 +55,7 @@ $idline = GETPOST('idline');
|
||||
$sortfield = GETPOST('sortfield','alpha');
|
||||
$sortorder = GETPOST('sortorder','alpha');
|
||||
$page = GETPOST('page','int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
|
||||
if (!$sortfield) {
|
||||
$sortfield = 'p.ref';
|
||||
|
||||
@@ -72,7 +72,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$page = GETPOST("page",'int');
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
if ($page < 0) $page = 0;
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
if (! $sortfield) $sortfield="m.datem";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
Reference in New Issue
Block a user