|
@@ -42,7 +42,9 @@ $toselect = GETPOST('toselect', 'array');
|
|
|
|
|
|
// Security check
|
|
|
$receptionid = GETPOST('id', 'int');
|
|
|
-if ($user->socid) $socid = $user->socid;
|
|
|
+if ($user->socid) {
|
|
|
+ $socid = $user->socid;
|
|
|
+}
|
|
|
$result = restrictedArea($user, 'reception', $receptionid, '');
|
|
|
|
|
|
$diroutputmassaction = $conf->reception->dir_output.'/temp/massgeneration/'.$user->id;
|
|
@@ -64,9 +66,15 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
|
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
|
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
|
|
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
|
|
-if (!$sortfield) $sortfield = "e.ref";
|
|
|
-if (!$sortorder) $sortorder = "DESC";
|
|
|
-if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
|
|
+if (!$sortfield) {
|
|
|
+ $sortfield = "e.ref";
|
|
|
+}
|
|
|
+if (!$sortorder) {
|
|
|
+ $sortorder = "DESC";
|
|
|
+}
|
|
|
+if (empty($page) || $page == -1) {
|
|
|
+ $page = 0;
|
|
|
+} // If $page is not defined, or '' or -1
|
|
|
$offset = $limit * $page;
|
|
|
$pageprev = $page - 1;
|
|
|
$pagenext = $page + 1;
|
|
@@ -92,7 +100,9 @@ $fieldstosearchall = array(
|
|
|
's.nom'=>"ThirdParty",
|
|
|
'e.note_public'=>'NotePublic',
|
|
|
);
|
|
|
-if (empty($user->socid)) $fieldstosearchall["e.note_private"] = "NotePrivate";
|
|
|
+if (empty($user->socid)) {
|
|
|
+ $fieldstosearchall["e.note_private"] = "NotePrivate";
|
|
|
+}
|
|
|
|
|
|
$checkedtypetiers = 0;
|
|
|
$arrayfields = array(
|
|
@@ -124,18 +134,23 @@ $error = 0;
|
|
|
* Actions
|
|
|
*/
|
|
|
|
|
|
-if (GETPOST('cancel')) { $action = 'list'; $massaction = ''; }
|
|
|
-if (!GETPOST('confirmmassaction') && $massaction != 'confirm_createbills') { $massaction = ''; }
|
|
|
+if (GETPOST('cancel')) {
|
|
|
+ $action = 'list'; $massaction = '';
|
|
|
+}
|
|
|
+if (!GETPOST('confirmmassaction') && $massaction != 'confirm_createbills') {
|
|
|
+ $massaction = '';
|
|
|
+}
|
|
|
|
|
|
$parameters = array('socid'=>$socid);
|
|
|
$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');
|
|
|
+}
|
|
|
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
|
|
|
|
// Purge search criteria
|
|
|
-if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
|
|
-{
|
|
|
+if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
|
|
$search_ref_supplier = '';
|
|
|
$search_ref_rcp = '';
|
|
|
$search_ref_liv = '';
|
|
@@ -150,8 +165,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
|
|
$search_array_options = array();
|
|
|
}
|
|
|
|
|
|
-if (empty($reshook))
|
|
|
-{
|
|
|
+if (empty($reshook)) {
|
|
|
if ($massaction == 'confirm_createbills') {
|
|
|
$receptions = GETPOST('toselect', 'array');
|
|
|
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
|
@@ -164,8 +178,7 @@ if (empty($reshook))
|
|
|
|
|
|
$db->begin();
|
|
|
$errors = array();
|
|
|
- foreach ($receptions as $id_reception)
|
|
|
- {
|
|
|
+ foreach ($receptions as $id_reception) {
|
|
|
$rcp = new Reception($db);
|
|
|
// On ne facture que les réceptions validées
|
|
|
if ($rcp->fetch($id_reception) <= 0 || $rcp->statut != 1) {
|
|
@@ -177,16 +190,19 @@ if (empty($reshook))
|
|
|
$object = new FactureFournisseur($db);
|
|
|
if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
|
|
|
$object = $TFactThird[$rcp->socid]; // If option "one bill per third" is set, we use already created reception.
|
|
|
- if (empty($object->rowid) && $object->id != null)$object->rowid = $object->id;
|
|
|
- if (!empty($object->rowid))$object->fetchObjectLinked();
|
|
|
+ if (empty($object->rowid) && $object->id != null) {
|
|
|
+ $object->rowid = $object->id;
|
|
|
+ }
|
|
|
+ if (!empty($object->rowid)) {
|
|
|
+ $object->fetchObjectLinked();
|
|
|
+ }
|
|
|
$rcp->fetchObjectLinked();
|
|
|
|
|
|
- if (count($rcp->linkedObjectsIds['reception']) > 0)
|
|
|
- {
|
|
|
- foreach ($rcp->linkedObjectsIds['reception'] as $key => $value)
|
|
|
- {
|
|
|
- if (empty($object->linkedObjectsIds['reception']) || !in_array($value, $object->linkedObjectsIds['reception']))//Dont try to link if already linked
|
|
|
+ if (count($rcp->linkedObjectsIds['reception']) > 0) {
|
|
|
+ foreach ($rcp->linkedObjectsIds['reception'] as $key => $value) {
|
|
|
+ if (empty($object->linkedObjectsIds['reception']) || !in_array($value, $object->linkedObjectsIds['reception'])) { //Dont try to link if already linked
|
|
|
$object->add_object_linked('reception', $value); // add supplier order linked object
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -202,8 +218,7 @@ if (empty($reshook))
|
|
|
$object->ref_supplier = $rcp->ref_supplier;
|
|
|
|
|
|
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
|
|
- if (empty($datefacture))
|
|
|
- {
|
|
|
+ if (empty($datefacture)) {
|
|
|
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
|
|
|
}
|
|
|
|
|
@@ -212,10 +227,8 @@ if (empty($reshook))
|
|
|
$object->origin_id = $id_reception;
|
|
|
|
|
|
$rcp->fetchObjectLinked();
|
|
|
- if (count($rcp->linkedObjectsIds['reception']) > 0)
|
|
|
- {
|
|
|
- foreach ($rcp->linkedObjectsIds['reception'] as $key => $value)
|
|
|
- {
|
|
|
+ if (count($rcp->linkedObjectsIds['reception']) > 0) {
|
|
|
+ foreach ($rcp->linkedObjectsIds['reception'] as $key => $value) {
|
|
|
$object->linked_objects['reception'] = $value;
|
|
|
}
|
|
|
}
|
|
@@ -231,23 +244,19 @@ if (empty($reshook))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ($object->id > 0)
|
|
|
- {
|
|
|
+ if ($object->id > 0) {
|
|
|
if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) { //cause function create already add object linked for facturefournisseur
|
|
|
$res = $object->add_object_linked($object->origin, $id_reception);
|
|
|
|
|
|
- if ($res == 0)
|
|
|
- {
|
|
|
+ if ($res == 0) {
|
|
|
$errors[] = $object->error;
|
|
|
$error++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!$error)
|
|
|
- {
|
|
|
+ if (!$error) {
|
|
|
$lines = $rcp->lines;
|
|
|
- if (empty($lines) && method_exists($rcp, 'fetch_lines'))
|
|
|
- {
|
|
|
+ if (empty($lines) && method_exists($rcp, 'fetch_lines')) {
|
|
|
$rcp->fetch_lines();
|
|
|
$lines = $rcp->lines;
|
|
|
}
|
|
@@ -255,11 +264,9 @@ if (empty($reshook))
|
|
|
$fk_parent_line = 0;
|
|
|
$num = count($lines);
|
|
|
|
|
|
- for ($i = 0; $i < $num; $i++)
|
|
|
- {
|
|
|
+ for ($i = 0; $i < $num; $i++) {
|
|
|
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
|
|
|
- if ($lines[$i]->subprice < 0)
|
|
|
- {
|
|
|
+ if ($lines[$i]->subprice < 0) {
|
|
|
// Negative line, we create a discount line
|
|
|
$discount = new DiscountAbsolute($db);
|
|
|
$discount->fk_soc = $object->socid;
|
|
@@ -270,8 +277,7 @@ if (empty($reshook))
|
|
|
$discount->fk_user = $user->id;
|
|
|
$discount->description = $desc;
|
|
|
$discountid = $discount->create($user);
|
|
|
- if ($discountid > 0)
|
|
|
- {
|
|
|
+ if ($discountid > 0) {
|
|
|
$result = $object->insert_discount($discountid);
|
|
|
//$result=$discount->link_to_invoice($lineid,$id);
|
|
|
} else {
|
|
@@ -284,17 +290,28 @@ if (empty($reshook))
|
|
|
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
|
|
// Date start
|
|
|
$date_start = false;
|
|
|
- if ($lines[$i]->date_debut_prevue) $date_start = $lines[$i]->date_debut_prevue;
|
|
|
- if ($lines[$i]->date_debut_reel) $date_start = $lines[$i]->date_debut_reel;
|
|
|
- if ($lines[$i]->date_start) $date_start = $lines[$i]->date_start;
|
|
|
+ if ($lines[$i]->date_debut_prevue) {
|
|
|
+ $date_start = $lines[$i]->date_debut_prevue;
|
|
|
+ }
|
|
|
+ if ($lines[$i]->date_debut_reel) {
|
|
|
+ $date_start = $lines[$i]->date_debut_reel;
|
|
|
+ }
|
|
|
+ if ($lines[$i]->date_start) {
|
|
|
+ $date_start = $lines[$i]->date_start;
|
|
|
+ }
|
|
|
//Date end
|
|
|
$date_end = false;
|
|
|
- if ($lines[$i]->date_fin_prevue) $date_end = $lines[$i]->date_fin_prevue;
|
|
|
- if ($lines[$i]->date_fin_reel) $date_end = $lines[$i]->date_fin_reel;
|
|
|
- if ($lines[$i]->date_end) $date_end = $lines[$i]->date_end;
|
|
|
+ if ($lines[$i]->date_fin_prevue) {
|
|
|
+ $date_end = $lines[$i]->date_fin_prevue;
|
|
|
+ }
|
|
|
+ if ($lines[$i]->date_fin_reel) {
|
|
|
+ $date_end = $lines[$i]->date_fin_reel;
|
|
|
+ }
|
|
|
+ if ($lines[$i]->date_end) {
|
|
|
+ $date_end = $lines[$i]->date_end;
|
|
|
+ }
|
|
|
// Reset fk_parent_line for no child products and special product
|
|
|
- if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9)
|
|
|
- {
|
|
|
+ if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
|
|
|
$fk_parent_line = 0;
|
|
|
}
|
|
|
$result = $object->addline(
|
|
@@ -323,8 +340,7 @@ if (empty($reshook))
|
|
|
|
|
|
$rcp->add_object_linked('facture_fourn_det', $result);
|
|
|
|
|
|
- if ($result > 0)
|
|
|
- {
|
|
|
+ if ($result > 0) {
|
|
|
$lineid = $result;
|
|
|
} else {
|
|
|
$lineid = 0;
|
|
@@ -332,8 +348,7 @@ if (empty($reshook))
|
|
|
break;
|
|
|
}
|
|
|
// Defined the new fk_parent_line
|
|
|
- if ($result > 0 && $lines[$i]->product_type == 9)
|
|
|
- {
|
|
|
+ if ($result > 0 && $lines[$i]->product_type == 9) {
|
|
|
$fk_parent_line = $result;
|
|
|
}
|
|
|
}
|
|
@@ -343,22 +358,22 @@ if (empty($reshook))
|
|
|
|
|
|
//$rcp->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
|
|
|
|
|
- if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) $TFactThird[$rcp->socid] = $object;
|
|
|
- else $TFact[$object->id] = $object;
|
|
|
+ if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) {
|
|
|
+ $TFactThird[$rcp->socid] = $object;
|
|
|
+ } else {
|
|
|
+ $TFact[$object->id] = $object;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Build doc with all invoices
|
|
|
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
|
|
$toselect = array();
|
|
|
|
|
|
- if (!$error && $validate_invoices)
|
|
|
- {
|
|
|
+ if (!$error && $validate_invoices) {
|
|
|
$massaction = $action = 'builddoc';
|
|
|
- foreach ($TAllFact as &$object)
|
|
|
- {
|
|
|
+ foreach ($TAllFact as &$object) {
|
|
|
$result = $object->validate($user);
|
|
|
- if ($result <= 0)
|
|
|
- {
|
|
|
+ if ($result <= 0) {
|
|
|
$error++;
|
|
|
setEventMessages($object->error, $object->errors, 'errors');
|
|
|
break;
|
|
@@ -376,8 +391,7 @@ if (empty($reshook))
|
|
|
$massaction = $action = 'confirm_createbills';
|
|
|
}
|
|
|
|
|
|
- if (!$error)
|
|
|
- {
|
|
|
+ if (!$error) {
|
|
|
$db->commit();
|
|
|
setEventMessage($langs->trans('BillCreated', $nb_bills_created));
|
|
|
} else {
|
|
@@ -413,60 +427,85 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,";
|
|
|
$sql .= ' e.date_creation as date_creation, e.tms as date_update';
|
|
|
// Add fields from extrafields
|
|
|
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
|
|
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
|
|
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
|
|
+ $sql .= ($extrafields->attributes[$object->table_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
|
|
|
$sql .= $hookmanager->resPrint;
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."reception as e";
|
|
|
-if (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 (e.rowid = ef.fk_object)";
|
|
|
+if (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 (e.rowid = ef.fk_object)";
|
|
|
+}
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'";
|
|
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
|
|
|
-if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
|
|
|
-{
|
|
|
+if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all
|
|
|
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
|
|
}
|
|
|
$sql .= " WHERE e.entity IN (".getEntity('reception').")";
|
|
|
-if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
|
|
|
-{
|
|
|
+if (!$user->rights->societe->client->voir && !$socid) { // Internal user with no permission to see all
|
|
|
$sql .= " AND e.fk_soc = sc.fk_soc";
|
|
|
$sql .= " AND sc.fk_user = ".$user->id;
|
|
|
}
|
|
|
-if ($socid)
|
|
|
-{
|
|
|
+if ($socid) {
|
|
|
$sql .= " AND e.fk_soc = ".$socid;
|
|
|
}
|
|
|
if ($search_status <> '' && $search_status >= 0) {
|
|
|
$sql .= " AND e.fk_statut = ".$search_status;
|
|
|
}
|
|
|
-if ($search_billed != '' && $search_billed >= 0) $sql .= ' AND e.billed = '.$search_billed;
|
|
|
-if ($search_town) $sql .= natural_search('s.town', $search_town);
|
|
|
-if ($search_zip) $sql .= natural_search("s.zip", $search_zip);
|
|
|
-if ($search_state) $sql .= natural_search("state.nom", $search_state);
|
|
|
-if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
|
|
|
-if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
|
|
-if ($search_ref_rcp) $sql .= natural_search('e.ref', $search_ref_rcp);
|
|
|
-if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv);
|
|
|
-if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
|
|
-if ($search_ref_supplier) $sql .= natural_search('e.ref_supplier', $search_ref_supplier);
|
|
|
-if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
|
|
+if ($search_billed != '' && $search_billed >= 0) {
|
|
|
+ $sql .= ' AND e.billed = '.$search_billed;
|
|
|
+}
|
|
|
+if ($search_town) {
|
|
|
+ $sql .= natural_search('s.town', $search_town);
|
|
|
+}
|
|
|
+if ($search_zip) {
|
|
|
+ $sql .= natural_search("s.zip", $search_zip);
|
|
|
+}
|
|
|
+if ($search_state) {
|
|
|
+ $sql .= natural_search("state.nom", $search_state);
|
|
|
+}
|
|
|
+if ($search_country) {
|
|
|
+ $sql .= " AND s.fk_pays IN (".$search_country.')';
|
|
|
+}
|
|
|
+if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
|
|
+ $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
|
|
|
+}
|
|
|
+if ($search_ref_rcp) {
|
|
|
+ $sql .= natural_search('e.ref', $search_ref_rcp);
|
|
|
+}
|
|
|
+if ($search_ref_liv) {
|
|
|
+ $sql .= natural_search('l.ref', $search_ref_liv);
|
|
|
+}
|
|
|
+if ($search_company) {
|
|
|
+ $sql .= natural_search('s.nom', $search_company);
|
|
|
+}
|
|
|
+if ($search_ref_supplier) {
|
|
|
+ $sql .= natural_search('e.ref_supplier', $search_ref_supplier);
|
|
|
+}
|
|
|
+if ($sall) {
|
|
|
+ $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
|
|
+}
|
|
|
|
|
|
// Add where from extra fields
|
|
|
-foreach ($search_array_options as $key => $val)
|
|
|
-{
|
|
|
+foreach ($search_array_options as $key => $val) {
|
|
|
$crit = $val;
|
|
|
$tmpkey = preg_replace('/search_options_/', '', $key);
|
|
|
$typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey];
|
|
|
$mode = 0;
|
|
|
- if (in_array($typ, array('int', 'double', 'real'))) $mode = 1; // Search on a numeric
|
|
|
- if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode = 2; // Search on a foreign key int
|
|
|
- if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0'))
|
|
|
- {
|
|
|
+ if (in_array($typ, array('int', 'double', 'real'))) {
|
|
|
+ $mode = 1; // Search on a numeric
|
|
|
+ }
|
|
|
+ if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') {
|
|
|
+ $mode = 2; // Search on a foreign key int
|
|
|
+ }
|
|
|
+ if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0')) {
|
|
|
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
|
|
}
|
|
|
}
|
|
@@ -476,8 +515,7 @@ $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // No
|
|
|
$sql .= $hookmanager->resPrint;
|
|
|
|
|
|
$nbtotalofrecords = '';
|
|
|
-if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
-{
|
|
|
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|
|
$result = $db->query($sql);
|
|
|
$nbtotalofrecords = $db->num_rows($result);
|
|
|
}
|
|
@@ -499,27 +537,58 @@ $reception = new Reception($db);
|
|
|
$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='.urlencode($limit);
|
|
|
-if ($sall) $param .= "&sall=".urlencode($sall);
|
|
|
-if ($search_ref_rcp) $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
|
|
|
-if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv);
|
|
|
-if ($search_company) $param .= "&search_company=".urlencode($search_company);
|
|
|
-if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
|
|
-if ($search_billed != '' && $search_billed >= 0) $param .= "&search_billed=".urlencode($search_billed);
|
|
|
-if ($search_town) $param .= "&search_town=".urlencode($search_town);
|
|
|
-if ($search_zip) $param .= "&search_zip=".urlencode($search_zip);
|
|
|
-if ($search_state) $param .= "&search_state=".urlencode($search_state);
|
|
|
-if ($search_status != '') $param .= "&search_status=".urlencode($search_status);
|
|
|
-if ($search_country) $param .= "&search_country=".urlencode($search_country);
|
|
|
-if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
|
|
|
-if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
|
|
|
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
+ $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+}
|
|
|
+if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
+ $param .= '&limit='.urlencode($limit);
|
|
|
+}
|
|
|
+if ($sall) {
|
|
|
+ $param .= "&sall=".urlencode($sall);
|
|
|
+}
|
|
|
+if ($search_ref_rcp) {
|
|
|
+ $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
|
|
|
+}
|
|
|
+if ($search_ref_liv) {
|
|
|
+ $param .= "&search_ref_liv=".urlencode($search_ref_liv);
|
|
|
+}
|
|
|
+if ($search_company) {
|
|
|
+ $param .= "&search_company=".urlencode($search_company);
|
|
|
+}
|
|
|
+if ($optioncss != '') {
|
|
|
+ $param .= '&optioncss='.urlencode($optioncss);
|
|
|
+}
|
|
|
+if ($search_billed != '' && $search_billed >= 0) {
|
|
|
+ $param .= "&search_billed=".urlencode($search_billed);
|
|
|
+}
|
|
|
+if ($search_town) {
|
|
|
+ $param .= "&search_town=".urlencode($search_town);
|
|
|
+}
|
|
|
+if ($search_zip) {
|
|
|
+ $param .= "&search_zip=".urlencode($search_zip);
|
|
|
+}
|
|
|
+if ($search_state) {
|
|
|
+ $param .= "&search_state=".urlencode($search_state);
|
|
|
+}
|
|
|
+if ($search_status != '') {
|
|
|
+ $param .= "&search_status=".urlencode($search_status);
|
|
|
+}
|
|
|
+if ($search_country) {
|
|
|
+ $param .= "&search_country=".urlencode($search_country);
|
|
|
+}
|
|
|
+if ($search_type_thirdparty) {
|
|
|
+ $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
|
|
|
+}
|
|
|
+if ($search_ref_supplier) {
|
|
|
+ $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
|
|
|
+}
|
|
|
// Add $param from extra fields
|
|
|
-foreach ($search_array_options as $key => $val)
|
|
|
-{
|
|
|
+foreach ($search_array_options as $key => $val) {
|
|
|
$crit = $val;
|
|
|
$tmpkey = preg_replace('/search_options_/', '', $key);
|
|
|
- if ($val != '') $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
|
|
|
+ if ($val != '') {
|
|
|
+ $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -527,14 +596,20 @@ $arrayofmassactions = array(
|
|
|
// 'presend'=>$langs->trans("SendByMail"),
|
|
|
);
|
|
|
|
|
|
-if ($user->rights->fournisseur->facture->creer)$arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier");
|
|
|
-if ($massaction == 'createbills') $arrayofmassactions = array();
|
|
|
+if ($user->rights->fournisseur->facture->creer) {
|
|
|
+ $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier");
|
|
|
+}
|
|
|
+if ($massaction == 'createbills') {
|
|
|
+ $arrayofmassactions = array();
|
|
|
+}
|
|
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|
|
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
|
|
|
|
|
$i = 0;
|
|
|
print '<form method="POST" 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">';
|
|
@@ -543,9 +618,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
|
|
|
print_barre_liste($langs->trans('ListOfReceptions'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, '', '', $limit, 0, 0, 1);
|
|
|
|
|
|
-
|
|
|
-if ($massaction == 'createbills')
|
|
|
-{
|
|
|
+if ($massaction == 'createbills') {
|
|
|
//var_dump($_REQUEST);
|
|
|
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
|
|
|
|
@@ -571,8 +644,7 @@ if ($massaction == 'createbills')
|
|
|
print $langs->trans('ValidateInvoices');
|
|
|
print '</td>';
|
|
|
print '<td>';
|
|
|
- if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
|
|
- {
|
|
|
+ if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) {
|
|
|
print $form->selectyesno('validate_invoices', 0, 1, 1);
|
|
|
print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
|
|
|
} else {
|
|
@@ -590,15 +662,15 @@ if ($massaction == 'createbills')
|
|
|
print '<br>';
|
|
|
}
|
|
|
|
|
|
-if ($sall)
|
|
|
-{
|
|
|
- foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+if ($sall) {
|
|
|
+ foreach ($fieldstosearchall as $key => $val) {
|
|
|
+ $fieldstosearchall[$key] = $langs->trans($val);
|
|
|
+ }
|
|
|
print $langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall);
|
|
|
}
|
|
|
|
|
|
$moreforfilter = '';
|
|
|
-if (!empty($moreforfilter))
|
|
|
-{
|
|
|
+if (!empty($moreforfilter)) {
|
|
|
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
|
|
print $moreforfilter;
|
|
|
$parameters = array('type'=>$type);
|
|
@@ -619,65 +691,60 @@ print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" :
|
|
|
// --------------------------------------------------------------------
|
|
|
print '<tr class="liste_titre_filter">';
|
|
|
// Ref
|
|
|
-if (!empty($arrayfields['e.ref']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.ref']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.'">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Ref customer
|
|
|
-if (!empty($arrayfields['e.ref_supplier']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.ref_supplier']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Thirdparty
|
|
|
-if (!empty($arrayfields['s.nom']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
print '<td class="liste_titre left">';
|
|
|
print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Town
|
|
|
-if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
|
|
+if (!empty($arrayfields['s.town']['checked'])) {
|
|
|
+ print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
|
|
|
+}
|
|
|
// Zip
|
|
|
-if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
|
|
+if (!empty($arrayfields['s.zip']['checked'])) {
|
|
|
+ print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
|
|
|
+}
|
|
|
// State
|
|
|
-if (!empty($arrayfields['state.nom']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['state.nom']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Country
|
|
|
-if (!empty($arrayfields['country.code_iso']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['country.code_iso']['checked'])) {
|
|
|
print '<td class="liste_titre center">';
|
|
|
print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Company type
|
|
|
-if (!empty($arrayfields['typent.code']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['typent.code']['checked'])) {
|
|
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
|
|
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Date delivery planned
|
|
|
-if (!empty($arrayfields['e.date_delivery']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.date_delivery']['checked'])) {
|
|
|
print '<td class="liste_titre"> </td>';
|
|
|
}
|
|
|
-if (!empty($arrayfields['l.ref']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['l.ref']['checked'])) {
|
|
|
// Delivery ref
|
|
|
print '<td class="liste_titre">';
|
|
|
print '<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.'"';
|
|
|
print '</td>';
|
|
|
}
|
|
|
-if (!empty($arrayfields['l.date_delivery']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['l.date_delivery']['checked'])) {
|
|
|
// Date received
|
|
|
print '<td class="liste_titre"> </td>';
|
|
|
}
|
|
@@ -689,27 +756,23 @@ $parameters = array('arrayfields'=>$arrayfields);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// Date creation
|
|
|
-if (!empty($arrayfields['e.datec']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.datec']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Date modification
|
|
|
-if (!empty($arrayfields['e.tms']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.tms']['checked'])) {
|
|
|
print '<td class="liste_titre">';
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Status
|
|
|
-if (!empty($arrayfields['e.fk_statut']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.fk_statut']['checked'])) {
|
|
|
print '<td class="liste_titre maxwidthonsmartphone right">';
|
|
|
print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1);
|
|
|
print '</td>';
|
|
|
}
|
|
|
// Status billed
|
|
|
-if (!empty($arrayfields['e.billed']['checked']))
|
|
|
-{
|
|
|
+if (!empty($arrayfields['e.billed']['checked'])) {
|
|
|
print '<td class="liste_titre maxwidthonsmartphone center">';
|
|
|
print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
|
|
|
print '</td>';
|
|
@@ -722,34 +785,63 @@ print '</td>';
|
|
|
print "</tr>\n";
|
|
|
|
|
|
print '<tr class="liste_titre">';
|
|
|
-if (!empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
|
|
|
-if (!empty($arrayfields['e.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
|
|
-if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
|
|
|
-if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
|
|
-if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
|
|
-if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
|
|
-if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
-if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
-if (!empty($arrayfields['e.date_delivery']['checked'])) print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
-if (!empty($arrayfields['l.ref']['checked'])) print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
|
|
|
-if (!empty($arrayfields['l.date_delivery']['checked'])) print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+if (!empty($arrayfields['e.ref']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['e.ref_supplier']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['s.town']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['s.zip']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['state.nom']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['country.code_iso']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['typent.code']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['e.date_delivery']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['l.ref']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
|
|
|
+}
|
|
|
+if (!empty($arrayfields['l.date_delivery']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+}
|
|
|
// 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);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
-if (!empty($arrayfields['e.datec']['checked'])) print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
-if (!empty($arrayfields['e.tms']['checked'])) print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
-if (!empty($arrayfields['e.fk_statut']['checked'])) print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
-if (!empty($arrayfields['e.billed']['checked'])) print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+if (!empty($arrayfields['e.datec']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['e.tms']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['e.fk_statut']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
|
|
+}
|
|
|
+if (!empty($arrayfields['e.billed']['checked'])) {
|
|
|
+ print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
|
|
|
+}
|
|
|
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
|
|
print "</tr>\n";
|
|
|
|
|
|
$i = 0;
|
|
|
$totalarray = array();
|
|
|
-while ($i < min($num, $limit))
|
|
|
-{
|
|
|
+while ($i < min($num, $limit)) {
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
|
$reception->id = $obj->rowid;
|
|
@@ -763,8 +855,7 @@ while ($i < min($num, $limit))
|
|
|
print '<tr class="oddeven">';
|
|
|
|
|
|
// Ref
|
|
|
- if (!empty($arrayfields['e.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.ref']['checked'])) {
|
|
|
print "<td>";
|
|
|
print $reception->getNomUrl(1);
|
|
|
$filename = dol_sanitizeFileName($reception->ref);
|
|
@@ -773,95 +864,104 @@ while ($i < min($num, $limit))
|
|
|
print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
|
|
|
print "</td>\n";
|
|
|
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Ref customer
|
|
|
- if (!empty($arrayfields['e.ref_supplier']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.ref_supplier']['checked'])) {
|
|
|
print "<td>";
|
|
|
print $obj->ref_supplier;
|
|
|
print "</td>\n";
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Third party
|
|
|
- if (!empty($arrayfields['s.nom']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['s.nom']['checked'])) {
|
|
|
print '<td>';
|
|
|
print $companystatic->getNomUrl(1);
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Town
|
|
|
- if (!empty($arrayfields['s.town']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['s.town']['checked'])) {
|
|
|
print '<td class="nocellnopadd">';
|
|
|
print $obj->town;
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Zip
|
|
|
- if (!empty($arrayfields['s.zip']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['s.zip']['checked'])) {
|
|
|
print '<td class="nocellnopadd">';
|
|
|
print $obj->zip;
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// State
|
|
|
- if (!empty($arrayfields['state.nom']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['state.nom']['checked'])) {
|
|
|
print "<td>".$obj->state_name."</td>\n";
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Country
|
|
|
- if (!empty($arrayfields['country.code_iso']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['country.code_iso']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
$tmparray = getCountry($obj->fk_pays, 'all');
|
|
|
print $tmparray['label'];
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Type ent
|
|
|
- if (!empty($arrayfields['typent.code']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['typent.code']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
- if (count($typenArray) == 0) $typenArray = $formcompany->typent_array(1);
|
|
|
+ if (count($typenArray) == 0) {
|
|
|
+ $typenArray = $formcompany->typent_array(1);
|
|
|
+ }
|
|
|
print $typenArray[$obj->typent_code];
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Date delivery planed
|
|
|
- if (!empty($arrayfields['e.date_delivery']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.date_delivery']['checked'])) {
|
|
|
print '<td class="center">';
|
|
|
print dol_print_date($db->jdate($obj->delivery_date), "day");
|
|
|
/*$now = time();
|
|
|
- if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 )
|
|
|
- {
|
|
|
- }*/
|
|
|
+ if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 )
|
|
|
+ {
|
|
|
+ }*/
|
|
|
print "</td>\n";
|
|
|
}
|
|
|
|
|
|
- if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
|
|
|
$reception->fetchObjectLinked($reception->id, $reception->element);
|
|
|
$receiving = '';
|
|
|
- if (count($reception->linkedObjects['delivery']) > 0) $receiving = reset($reception->linkedObjects['delivery']);
|
|
|
+ if (count($reception->linkedObjects['delivery']) > 0) {
|
|
|
+ $receiving = reset($reception->linkedObjects['delivery']);
|
|
|
+ }
|
|
|
|
|
|
- if (!empty($arrayfields['l.ref']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['l.ref']['checked'])) {
|
|
|
// Ref
|
|
|
print '<td>';
|
|
|
print !empty($receiving) ? $receiving->getNomUrl($db) : '';
|
|
|
print '</td>';
|
|
|
}
|
|
|
|
|
|
- if (!empty($arrayfields['l.date_delivery']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['l.date_delivery']['checked'])) {
|
|
|
// Date received
|
|
|
print '<td class="center">';
|
|
|
print dol_print_date($db->jdate($obj->date_reception), "day");
|
|
@@ -877,44 +977,52 @@ while ($i < min($num, $limit))
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
// Date creation
|
|
|
- if (!empty($arrayfields['e.datec']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.datec']['checked'])) {
|
|
|
print '<td class="center nowrap">';
|
|
|
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Date modification
|
|
|
- if (!empty($arrayfields['e.tms']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.tms']['checked'])) {
|
|
|
print '<td class="center nowrap">';
|
|
|
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Status
|
|
|
- if (!empty($arrayfields['e.fk_statut']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.fk_statut']['checked'])) {
|
|
|
print '<td class="right nowrap">'.$reception->LibStatut($obj->fk_statut, 5).'</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
// Billed
|
|
|
- if (!empty($arrayfields['e.billed']['checked']))
|
|
|
- {
|
|
|
+ if (!empty($arrayfields['e.billed']['checked'])) {
|
|
|
print '<td class="center">'.yn($obj->billed).'</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Action column
|
|
|
print '<td class="center">';
|
|
|
- if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
|
|
- {
|
|
|
+ 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($obj->rowid, $arrayofselected)) $selected = 1;
|
|
|
+ if (in_array($obj->rowid, $arrayofselected)) {
|
|
|
+ $selected = 1;
|
|
|
+ }
|
|
|
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
|
|
}
|
|
|
print '</td>';
|
|
|
- if (!$i) $totalarray['nbfield']++;
|
|
|
+ if (!$i) {
|
|
|
+ $totalarray['nbfield']++;
|
|
|
+ }
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
@@ -935,7 +1043,6 @@ if ($num == 0) {
|
|
|
print "</table>";
|
|
|
print "</div>";
|
|
|
print '</form>';
|
|
|
-
|
|
|
$db->free($resql);
|
|
|
|
|
|
llxFooter();
|