diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 2e6f3ffb4f7..9588e8c9852 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1989,6 +1989,7 @@ class Expedition extends CommonObject
$return .= '';
$return .= '';
$return .= '';
+
return $return;
}
diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php
index 60d63b1505c..4394f2018e1 100644
--- a/htdocs/expedition/list.php
+++ b/htdocs/expedition/list.php
@@ -48,13 +48,8 @@ $action = GETPOST('action', 'alpha');
$massaction = GETPOST('massaction', 'alpha');
$show_files = GETPOST('show_files', 'int');
$toselect = GETPOST('toselect', 'array');
-
-// Security check
-$expeditionid = GETPOST('id', 'int');
-if ($user->socid) {
- $socid = $user->socid;
-}
-$result = restrictedArea($user, 'expedition', $expeditionid, '');
+$optioncss = GETPOST('optioncss', 'alpha');
+$mode = GETPOST('mode', 'alpha');
$search_ref_exp = GETPOST("search_ref_exp", 'alpha');
$search_ref_liv = GETPOST('search_ref_liv', 'alpha');
@@ -72,13 +67,11 @@ $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_st
$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int'));
$search_datereceipt_start = dol_mktime(0, 0, 0, GETPOST('search_datereceipt_startmonth', 'int'), GETPOST('search_datereceipt_startday', 'int'), GETPOST('search_datereceipt_startyear', 'int'));
$search_datereceipt_end = dol_mktime(23, 59, 59, GETPOST('search_datereceipt_endmonth', 'int'), GETPOST('search_datereceipt_endday', 'int'), GETPOST('search_datereceipt_endyear', 'int'));
-$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
+$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_user = GETPOST('search_user', 'int');
$search_sale = GETPOST('search_sale', 'int');
$search_categ_cus = GETPOST("search_categ_cus", 'int');
$search_product_category = GETPOST('search_product_category', 'int');
-$optioncss = GETPOST('optioncss', 'alpha');
-$mode = GETPOST('mode', 'alpha');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -103,7 +96,6 @@ $search_status = GETPOST('search_status', 'intcomma');
$diroutputmassaction = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id;
$object = new Expedition($db);
-$form = new Form($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('shipmentlist'));
@@ -154,6 +146,14 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
+// Security check
+$expeditionid = GETPOST('id', 'int');
+if ($user->socid) {
+ $socid = $user->socid;
+}
+$result = restrictedArea($user, 'expedition', $expeditionid, '');
+
+
/*
* Actions
@@ -213,34 +213,34 @@ if (empty($reshook)) {
$permissiontodelete = $user->rights->expedition->supprimer;
$uploaddir = $conf->expedition->dir_output.'/sending';
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
-}
-// If massaction is close
-if ($massaction == 'classifyclose') {
- $error=0;
- $selectids = GETPOST('toselect', 'array');
- foreach ($selectids as $selectid) {
- // $object->fetch($selectid);
- $object->fetch($selectid);
- $result = $object->setClosed();
- }
+ // If massaction is close
+ if ($massaction == 'classifyclose') {
+ $error=0;
+ $selectids = GETPOST('toselect', 'array');
+ foreach ($selectids as $selectid) {
+ // $object->fetch($selectid);
+ $object->fetch($selectid);
+ $result = $object->setClosed();
+ }
- $massaction = $action = 'classifyclose';
+ $massaction = $action = 'classifyclose';
- if ($result < 0) {
- $error++;
- }
+ if ($result < 0) {
+ $error++;
+ }
- if (!$error) {
- $db->commit();
+ if (!$error) {
+ $db->commit();
- setEventMessage($langs->trans("Close Done"));
- header('Location: '.$_SERVER["PHP_SELF"]);
- exit;
- } else {
- $db->rollback();
- exit;
+ setEventMessage($langs->trans("Close Done"));
+ header('Location: '.$_SERVER["PHP_SELF"]);
+ exit;
+ } else {
+ $db->rollback();
+ exit;
+ }
}
}
@@ -261,7 +261,7 @@ $helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Ex
llxHeader('', $langs->trans('ListOfSendings'), $helpurl);
$sql = 'SELECT';
-if ($sall || $search_user > 0) {
+if ($search_all || $search_user > 0) {
$sql = 'SELECT DISTINCT';
}
$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, e.fk_statut, e.billed, e.tracking_number, e.fk_shipping_method,";
@@ -294,7 +294,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
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 (e.rowid = ef.fk_object)";
}
-if ($sall) {
+if ($search_all) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet as ed ON e.rowid=ed.fk_expedition';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON pd.rowid=ed.fk_origin_line';
}
@@ -314,10 +314,6 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON e.fk_user_author = u.rowid';
if ($search_user > 0) { // Get link to order to get the order id in eesource.fk_source
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande'";
}
-// We'll need this table joined to the select in order to filter by sale
-if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) {
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-}
if ($search_user > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
@@ -333,10 +329,6 @@ $sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if ($socid > 0) {
$sql .= " AND s.rowid = ".((int) $socid);
}
-if (!$user->hasRight('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 = ".((int) $user->id);
-}
if ($socid) {
$sql .= " AND e.fk_soc = ".((int) $socid);
}
@@ -400,8 +392,8 @@ if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
$sql .= " AND l.date_delivery <= '".$db->idate($search_datereceipt_end)."'";
}
}
-if ($sall) {
- $sql .= natural_search(array_keys($fieldstosearchall), $sall);
+if ($search_all) {
+ $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
if ($search_categ_cus > 0) {
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
@@ -501,8 +493,8 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
-if ($sall) {
- $param .= "&sall=".urlencode($sall);
+if ($search_all) {
+ $param .= "&search_all=".urlencode($search_all);
}
if ($search_ref_exp) {
$param .= "&search_ref_exp=".urlencode($search_ref_exp);
@@ -523,7 +515,7 @@ if ($search_company) {
$param .= "&search_company=".urlencode($search_company);
}
if ($search_shipping_method_id) {
- $param .= "&search_shipping_method_id=".urlencode($search_shipping_method_id);
+ $param .= "&search_shipping_method_id=".urlencode($search_shipping_method_id);
}
if ($search_tracking) {
$param .= "&search_tracking=".urlencode($search_tracking);
@@ -609,11 +601,11 @@ $objecttmp = new Expedition($db);
$trackid = 'shi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
-if ($sall) {
+if ($search_all) {
foreach ($fieldstosearchall as $key => $val) {
$fieldstosearchall[$key] = $langs->trans($val);
}
- print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
';
+ print ''.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
';
}
$moreforfilter = '';
@@ -765,7 +757,7 @@ if (!empty($arrayfields['e.tracking_number']['checked'])) {
if (!empty($arrayfields['l.ref']['checked'])) {
// Delivery ref
print '';
- print ' ';
}
if (!empty($arrayfields['l.date_delivery']['checked'])) {
@@ -826,70 +818,90 @@ print ' ';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.ref']['checked'])) {
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.ref_customer']['checked'])) {
print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"], "e.ref_customer", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['s.nom']['checked'])) {
print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['s.town']['checked'])) {
print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['s.zip']['checked'])) {
print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['state.nom']['checked'])) {
print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
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 ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['typent.code']['checked'])) {
print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.weight']['checked'])) {
print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
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 ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
print_liste_field_titre($arrayfields['e.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "e.fk_shipping_method", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.tracking_number']['checked'])) {
print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['l.ref']['checked'])) {
print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
+ $totalarray['nbfield']++;
}
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 ');
+ $totalarray['nbfield']++;
}
// 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); // Note that $action and $object may have been modified by hook
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, '$totalarray'=>&$totalarray);
+$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 ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.tms']['checked'])) {
print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
+ $totalarray['nbfield']++;
}
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 ');
+ $totalarray['nbfield']++;
}
if (!empty($arrayfields['e.billed']['checked'])) {
print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
+ $totalarray['nbfield']++;
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
+ $totalarray['nbfield']++;
}
print " \n";
@@ -987,7 +999,7 @@ while ($i < $imaxinloop) {
// Town
if (!empty($arrayfields['s.town']['checked'])) {
print '';
- print $obj->town;
+ print dol_escape_htmltag($obj->town);
print ' ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1093,7 +1105,7 @@ while ($i < $imaxinloop) {
if (!empty($arrayfields['l.date_delivery']['checked'])) {
// Date received
- print '';
+ print ' ';
print dol_print_date($db->jdate($obj->date_reception), "day");
print ' '."\n";
}
@@ -1107,8 +1119,8 @@ while ($i < $imaxinloop) {
print $hookmanager->resPrint;
// Date creation
if (!empty($arrayfields['e.datec']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
+ print ' ';
+ print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuserrel');
print ' ';
if (!$i) {
$totalarray['nbfield']++;
@@ -1116,7 +1128,7 @@ while ($i < $imaxinloop) {
}
// Date modification
if (!empty($arrayfields['e.tms']['checked'])) {
- print '';
+ print ' ';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print ' ';
if (!$i) {
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 333e350a560..5a63a356703 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -1366,8 +1366,6 @@ class Reception extends CommonObject
*/
public function getKanbanView($option = '', $arraydata = null)
{
- global $langs, $conf;
-
$selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']);
$return = '';
@@ -1383,15 +1381,16 @@ class Reception extends CommonObject
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
$return .= '
'.$this->thirdparty->getNomUrl(1).'
';
}
- if (property_exists($this, 'total_ht')) {
+ /*if (property_exists($this, 'total_ht')) {
$return .= '
'.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency).' '.$langs->trans('HT').'
';
- }
+ }*/
if (method_exists($this, 'getLibStatut')) {
$return .= '
'.$this->getLibStatut(3).'
';
}
$return .= '
';
$return .= '';
$return .= '';
+
return $return;
}
diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php
index 5d408ebf796..a03270f809b 100644
--- a/htdocs/reception/list.php
+++ b/htdocs/reception/list.php
@@ -38,9 +38,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills', 'orders'));
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
+
$socid = GETPOST('socid', 'int');
+
$massaction = GETPOST('massaction', 'alpha');
$toselect = GETPOST('toselect', 'array');
+$optioncss = GETPOST('optioncss', 'alpha');
+$mode = GETPOST('mode', 'alpha');
$diroutputmassaction = $conf->reception->dir_output.'/temp/massgeneration/'.$user->id;
@@ -70,8 +75,8 @@ $search_date_create_endyear = GETPOST('search_date_create_endyear', 'int');
$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver
$search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
$search_billed = GETPOST("search_billed", 'int');
-$sall = GETPOST('sall', 'alphanohtml');
-$optioncss = GETPOST('optioncss', 'alpha');
+$search_status = GETPOST('search_status', 'intcomma');
+$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -83,17 +88,14 @@ if (!$sortfield) {
if (!$sortorder) {
$sortorder = "DESC";
}
-if (empty($page) || $page == -1) {
+if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
+ // If $page is not defined, or '' or -1 or if we click on clear filters
$page = 0;
-} // If $page is not defined, or '' or -1
+}
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
-$contextpage = 'receptionlist';
-
-$search_status = GETPOST('search_status', 'intcomma');
$object = new Reception($db);
@@ -101,7 +103,7 @@ $object = new Reception($db);
$hookmanager->initHooks(array('receptionlist'));
$extrafields = new ExtraFields($db);
-// fetch optionals attributes and labels
+// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
@@ -152,11 +154,11 @@ $result = restrictedArea($user, 'reception', $receptionid, '');
* Actions
*/
-if (GETPOST('cancel')) {
+if (GETPOST('cancel', 'alpha')) {
$action = 'list';
$massaction = '';
}
-if (!GETPOST('confirmmassaction') && $massaction != 'confirm_createbills') {
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_createbills') {
$massaction = '';
}
@@ -197,6 +199,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_date_create_end = '';
$search_billed = '';
$search_status = '';
+ $toselect = array();
$search_array_options = array();
}
@@ -578,6 +581,8 @@ if (empty($reshook)) {
* View
*/
+$now = dol_now();
+
$form = new Form($db);
$companystatic = new Societe($db);
$reception = new Reception($db);
@@ -588,11 +593,11 @@ $formfile = new FormFile($db);
$helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
llxHeader('', $langs->trans('ListOfReceptions'), $helpurl);
-$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,";
-$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ';
+$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut as status, e.billed,";
+$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
$sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
-$sql .= ' e.date_creation as date_creation, e.tms as date_update';
+$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) {
@@ -616,18 +621,11 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_ty
$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->hasRight('societe', 'client', 'voir') && !$socid) { // Internal user with no permission to see all
- $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-}
-// Add joins from hooks
+// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE e.entity IN (".getEntity('reception').")";
-if (!$user->hasRight('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 = ".((int) $user->id);
-}
if ($socid) {
$sql .= " AND e.fk_soc = ".((int) $socid);
}
@@ -676,8 +674,8 @@ if ($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_all) {
+ $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
// Add where from extra fields
@@ -687,6 +685,11 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
+// Add HAVING from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
+
$nbtotalofrecords = '';
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
/* The fast and low memory method to get and count full list converts the sql into a sql count */
@@ -727,14 +730,17 @@ $reception = new Reception($db);
$arrayofselected = is_array($toselect) ? $toselect : array();
$param = '';
+if (!empty($mode)) {
+ $param .= '&mode='.urlencode($mode);
+}
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
-if ($sall) {
- $param .= "&sall=".urlencode($sall);
+if ($search_all) {
+ $param .= "&search_all=".urlencode($search_all);
}
if ($search_ref_rcp) {
$param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
@@ -843,11 +849,20 @@ $arrayofmassactions = array(
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
$arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisReceptions");
}
-if ($massaction == 'createbills') {
+if (in_array($massaction, array('presend', 'createbills'))) {
$arrayofmassactions = array();
}
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
-//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
+
+// Currently: a sending can't create from sending list
+// $url = DOL_URL_ROOT.'/expedition/card.php?action=create';
+// if (!empty($socid)) $url .= '&socid='.$socid;
+// $newcardbutton = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer);
+$newcardbutton = '';
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitleSeparator();
+$newcardbutton .= dolGetButtonTitle($langs->trans('NewReception'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/reception/card.php?action=create2', '', $user->hasRight('reception', 'creer'));
$i = 0;
print '