|
@@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransfer
|
|
|
// Load translation files required by the page
|
|
|
$langs->loadLangs(array("stocks", "other"));
|
|
|
|
|
|
-$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
|
|
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
|
|
|
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
|
|
|
$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
|
|
|
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
|
|
@@ -51,7 +51,9 @@ $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');
|
|
|
-if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters
|
|
|
+if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
|
|
+ $page = 0;
|
|
|
+} // If $page is not defined, or '' or -1 or if we click on clear filters
|
|
|
$offset = $limit * $page;
|
|
|
$pageprev = $page - 1;
|
|
|
$pagenext = $page + 1;
|
|
@@ -69,14 +71,20 @@ $extrafields->fetch_name_optionals_label($object->table_element);
|
|
|
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
|
|
|
|
|
|
// Default sort order (if not yet defined by previous GETPOST)
|
|
|
-if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
|
|
|
-if (!$sortorder) $sortorder = "ASC";
|
|
|
+if (!$sortfield) {
|
|
|
+ $sortfield = "t.".key($object->fields);
|
|
|
+} // Set here default search field. By default 1st field in definition.
|
|
|
+if (!$sortorder) {
|
|
|
+ $sortorder = "ASC";
|
|
|
+}
|
|
|
|
|
|
// Initialize array of search criterias
|
|
|
$search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml'));
|
|
|
$search = array();
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
- if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
|
|
|
+ if (GETPOST('search_'.$key, 'alpha') !== '') {
|
|
|
+ $search[$key] = GETPOST('search_'.$key, 'alpha');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// List of fields to search into when doing a "search in all"
|
|
@@ -91,7 +99,9 @@ foreach ($object->fields as $key => $val) {
|
|
|
$arrayfields = array();
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
// If $val['visible']==0, then we never show the field
|
|
|
- if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
|
|
|
+ if (!empty($val['visible'])) {
|
|
|
+ $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
|
|
|
+ }
|
|
|
}
|
|
|
//var_dump($object->fields);
|
|
|
// Extra fields
|
|
@@ -116,14 +126,18 @@ $permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write');
|
|
|
$permissiontodelete = $user->hasRight('stocktransfer', 'stocktransfer', 'delete');
|
|
|
|
|
|
// Security check
|
|
|
-if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
|
|
|
+if (empty($conf->stocktransfer->enabled)) {
|
|
|
+ accessforbidden('Module not enabled');
|
|
|
+}
|
|
|
$socid = 0;
|
|
|
if ($user->socid > 0) { // Protection if external user
|
|
|
//$socid = $user->socid;
|
|
|
accessforbidden();
|
|
|
}
|
|
|
//$result = restrictedArea($user, 'stocktransfer', $id, '');
|
|
|
-if (!$permissiontoread) accessforbidden();
|
|
|
+if (!$permissiontoread) {
|
|
|
+ accessforbidden();
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
@@ -131,12 +145,19 @@ if (!$permissiontoread) accessforbidden();
|
|
|
* Actions
|
|
|
*/
|
|
|
|
|
|
-if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
|
|
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
|
|
+if (GETPOST('cancel', 'alpha')) {
|
|
|
+ $action = 'list';
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
|
|
|
$parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
|
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
+if ($reshook < 0) {
|
|
|
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
|
|
+}
|
|
|
|
|
|
if (empty($reshook)) {
|
|
|
// Selection of new fields
|
|
@@ -196,18 +217,29 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
|
|
if (!empty($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 ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
|
|
-else $sql .= " WHERE 1 = 1";
|
|
|
+if ($object->ismultientitymanaged == 1) {
|
|
|
+ $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
|
|
+} else {
|
|
|
+ $sql .= " WHERE 1 = 1";
|
|
|
+}
|
|
|
foreach ($search as $key => $val) {
|
|
|
- if ($key == 'status' && $search[$key] == -1) continue;
|
|
|
+ if ($key == 'status' && $search[$key] == -1) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
|
|
|
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
|
|
|
- if ($search[$key] == '-1') $search[$key] = '';
|
|
|
+ if ($search[$key] == '-1') {
|
|
|
+ $search[$key] = '';
|
|
|
+ }
|
|
|
$mode_search = 2;
|
|
|
}
|
|
|
- if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
|
|
+ if ($search[$key] != '') {
|
|
|
+ $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
|
|
|
+ }
|
|
|
+}
|
|
|
+if ($search_all) {
|
|
|
+ $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
|
|
}
|
|
|
-if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
|
|
//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
|
|
|
// Add where from extra fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
|
@@ -249,7 +281,9 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
|
|
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
|
|
$num = $nbtotalofrecords;
|
|
|
} else {
|
|
|
- if ($limit) $sql .= $db->plimit($limit + 1, $offset);
|
|
|
+ if ($limit) {
|
|
|
+ $sql .= $db->plimit($limit + 1, $offset);
|
|
|
+ }
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
if (!$resql) {
|
|
@@ -292,13 +326,24 @@ jQuery(document).ready(function() {
|
|
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
|
|
|
$param = '';
|
|
|
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit);
|
|
|
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
+ $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+}
|
|
|
+if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
+ $param .= '&limit='.((int) $limit);
|
|
|
+}
|
|
|
foreach ($search as $key => $val) {
|
|
|
- if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
|
|
|
- else $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
|
|
+ if (is_array($search[$key]) && count($search[$key])) {
|
|
|
+ foreach ($search[$key] as $skey) {
|
|
|
+ $param .= '&search_'.$key.'[]='.urlencode($skey);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
|
|
+ }
|
|
|
+}
|
|
|
+if ($optioncss != '') {
|
|
|
+ $param .= '&optioncss='.urlencode($optioncss);
|
|
|
}
|
|
|
-if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
|
|
// Add $param from extra fields
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|
|
|
|
@@ -309,12 +354,18 @@ $arrayofmassactions = array(
|
|
|
//'builddoc'=>$langs->trans("PDFMerge"),
|
|
|
//'presend'=>$langs->trans("SendByMail"),
|
|
|
);
|
|
|
-if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
|
|
+if ($permissiontodelete) {
|
|
|
+ $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
+}
|
|
|
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
|
|
|
+ $arrayofmassactions = array();
|
|
|
+}
|
|
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|
|
|
|
|
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
|
|
|
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+if ($optioncss != '') {
|
|
|
+ print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
+}
|
|
|
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">';
|
|
@@ -336,7 +387,9 @@ $trackid = 'xxxx'.$object->id;
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
|
|
|
|
|
if ($search_all) {
|
|
|
- foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ foreach ($fieldstosearchall as $key => $val) {
|
|
|
+ $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ }
|
|
|
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
|
|
|
}
|
|
|
|
|
@@ -347,8 +400,11 @@ $moreforfilter.= '</div>';*/
|
|
|
|
|
|
$parameters = array();
|
|
|
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
-if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
|
|
-else $moreforfilter = $hookmanager->resPrint;
|
|
|
+if (empty($reshook)) {
|
|
|
+ $moreforfilter .= $hookmanager->resPrint;
|
|
|
+} else {
|
|
|
+ $moreforfilter = $hookmanager->resPrint;
|
|
|
+}
|
|
|
|
|
|
if (!empty($moreforfilter)) {
|
|
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
@@ -369,10 +425,15 @@ print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwit
|
|
|
print '<tr class="liste_titre">';
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
- if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
- elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ if ($key == 'status') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ } elseif (in_array($val['type'], array('timestamp'))) {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ }
|
|
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
|
|
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
|
|
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
|
@@ -405,10 +466,15 @@ print '</tr>'."\n";
|
|
|
print '<tr class="liste_titre">';
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
- if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
- elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ if ($key == 'status') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ } elseif (in_array($val['type'], array('timestamp'))) {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ }
|
|
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
|
|
print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
|
|
|
}
|
|
@@ -441,7 +507,9 @@ $i = 0;
|
|
|
$totalarray = array();
|
|
|
while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
- if (empty($obj)) break; // Should not happen
|
|
|
+ if (empty($obj)) {
|
|
|
+ break;
|
|
|
+ } // Should not happen
|
|
|
|
|
|
// Store properties in $object
|
|
|
$object->setVarsFromFetchObj($obj);
|
|
@@ -450,31 +518,48 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
print '<tr class="oddeven">';
|
|
|
foreach ($object->fields as $key => $val) {
|
|
|
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
|
|
- if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
- elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ } elseif ($key == 'status') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'center';
|
|
|
+ }
|
|
|
|
|
|
- if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
- elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ if (in_array($val['type'], array('timestamp'))) {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ } elseif ($key == 'ref') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
|
|
+ }
|
|
|
|
|
|
- if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
|
|
|
+ $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
|
|
+ }
|
|
|
//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
|
|
|
|
|
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
|
|
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
|
|
- if ($key == 'status') print $object->getLibStatut(5);
|
|
|
- else {
|
|
|
+ if ($key == 'status') {
|
|
|
+ print $object->getLibStatut(5);
|
|
|
+ } else {
|
|
|
print $object->showOutputField($val, $key, $object->$key, '');
|
|
|
if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) {
|
|
|
$date_prevue_depart = $object->$key;
|
|
|
$date_prevue_depart_plus_delai = $date_prevue_depart;
|
|
|
- if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
|
|
|
- if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
|
|
|
+ if ($object->lead_time_for_warning > 0) {
|
|
|
+ $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
|
|
|
+ }
|
|
|
+ if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
|
|
|
+ print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
if (!empty($val['isameasure'])) {
|
|
|
- if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
|
|
+ }
|
|
|
$totalarray['val']['t.'.$key] += $object->$key;
|
|
|
}
|
|
|
}
|
|
@@ -489,11 +574,15 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
|
|
|
print '<td class="nowrap center">';
|
|
|
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
$selected = 0;
|
|
|
- if (in_array($object->id, $arrayofselected)) $selected = 1;
|
|
|
+ if (in_array($object->id, $arrayofselected)) {
|
|
|
+ $selected = 1;
|
|
|
+ }
|
|
|
print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
}
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
|
|
|
print '</tr>'."\n";
|
|
|
|
|
@@ -506,7 +595,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|
|
// If no record found
|
|
|
if ($num == 0) {
|
|
|
$colspan = 1;
|
|
|
- foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
|
|
+ foreach ($arrayfields as $key => $val) {
|
|
|
+ if (!empty($val['checked'])) {
|
|
|
+ $colspan++;
|
|
|
+ }
|
|
|
+ }
|
|
|
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
|
|
}
|
|
|
|
|
@@ -524,7 +617,9 @@ print '</form>'."\n";
|
|
|
|
|
|
if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
|
|
|
$hidegeneratedfilelistifempty = 1;
|
|
|
- if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
|
|
+ if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
|
|
|
+ $hidegeneratedfilelistifempty = 0;
|
|
|
+ }
|
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
|
$formfile = new FormFile($db);
|