Fix: multiple avoid Warning and errors
This commit is contained in:
parent
2d3a55a6a8
commit
9f7fcdc8bf
@ -6466,27 +6466,30 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
|
|||||||
// Clean parameters
|
// Clean parameters
|
||||||
$order=strtolower($order);
|
$order=strtolower($order);
|
||||||
|
|
||||||
$sizearray=count($array);
|
if (is_array($array))
|
||||||
if (is_array($array) && $sizearray>0)
|
|
||||||
{
|
{
|
||||||
$temp = array();
|
$sizearray=count($array);
|
||||||
foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index];
|
if ($sizearray>0)
|
||||||
|
|
||||||
if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
($case_sensitive) ? natsort($temp) : natcasesort($temp);
|
$temp = array();
|
||||||
if($order!='asc') $temp=array_reverse($temp,TRUE);
|
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;
|
return $array;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,12 +148,13 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
// Mass actions. Controls on number of lines checked
|
// Mass actions. Controls on number of lines checked
|
||||||
$maxformassaction=1000;
|
$maxformassaction=1000;
|
||||||
if (! empty($massaction) && count($toselect) < 1)
|
$numtoselect = (is_array($toselect)?count($toselect):0);
|
||||||
|
if (! empty($massaction) && $numtoselect < 1)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||||
}
|
}
|
||||||
if (! $error && count($toselect) > $maxformassaction)
|
if (! $error && $numtoselect > $maxformassaction)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
@ -541,7 +542,7 @@ if ($resql)
|
|||||||
{
|
{
|
||||||
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
|
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
|
||||||
$receiving='';
|
$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']))
|
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;
|
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
|
-- For 8.0
|
||||||
|
|
||||||
|
|||||||
@ -185,7 +185,9 @@ foreach($object->fields as $key => $val)
|
|||||||
$sql.='t.'.$key.', ';
|
$sql.='t.'.$key.', ';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// 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
|
// Add fields from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
$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
|
// Detect if we need a fetch on each output line
|
||||||
$needToFetchEachLine=0;
|
$needToFetchEachLine=0;
|
||||||
foreach ($extrafields->attributes[$object->element]['computed'] as $key => $val)
|
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
|
{
|
||||||
|
if (preg_match('/\$object/',$val)) $needToFetchEachLine++; // There is at least one compute field that use $object
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Loop on record
|
// Loop on record
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
$i=0;
|
$i=0;
|
||||||
|
|||||||
@ -278,7 +278,9 @@ else
|
|||||||
$sql .= ', pac.rowid prod_comb_id';
|
$sql .= ', pac.rowid prod_comb_id';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// 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
|
// Add fields from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||||
@ -335,7 +337,9 @@ else
|
|||||||
$sql .= ', pac.rowid';
|
$sql .= ', pac.rowid';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// 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
|
// Add fields from hooks
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook
|
$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 (! $sortfield) $sortfield="e.ref";
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
$page = GETPOST("page");
|
$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;
|
$offset = $limit * $page;
|
||||||
|
|
||||||
$year = strftime("%Y",time());
|
$year = strftime("%Y",time());
|
||||||
|
|||||||
@ -55,6 +55,7 @@ $idline = GETPOST('idline');
|
|||||||
$sortfield = GETPOST('sortfield','alpha');
|
$sortfield = GETPOST('sortfield','alpha');
|
||||||
$sortorder = GETPOST('sortorder','alpha');
|
$sortorder = GETPOST('sortorder','alpha');
|
||||||
$page = GETPOST('page','int');
|
$page = GETPOST('page','int');
|
||||||
|
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||||
|
|
||||||
if (!$sortfield) {
|
if (!$sortfield) {
|
||||||
$sortfield = 'p.ref';
|
$sortfield = 'p.ref';
|
||||||
|
|||||||
@ -72,7 +72,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
|
|||||||
$page = GETPOST("page",'int');
|
$page = GETPOST("page",'int');
|
||||||
$sortfield = GETPOST("sortfield",'alpha');
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
$sortorder = GETPOST("sortorder",'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;
|
$offset = $limit * $page;
|
||||||
if (! $sortfield) $sortfield="m.datem";
|
if (! $sortfield) $sortfield="m.datem";
|
||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user