diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index f325fc286a5..327e9a030e0 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -383,602 +383,611 @@ $sql .= $db->plimit($limit + 1, $offset); //print $sql; $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - $arrayofselected = is_array($toselect) ? $toselect : array(); +$num = $db->num_rows($resql); - $expedition = new Expedition($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_exp) { - $param .= "&search_ref_exp=".urlencode($search_ref_exp); - } - if ($search_ref_liv) { - $param .= "&search_ref_liv=".urlencode($search_ref_liv); - } - if ($search_ref_customer) { - $param .= "&search_ref_customer=".urlencode($search_ref_customer); - } - if ($search_user > 0) { - $param .= '&search_user='.urlencode($search_user); - } - if ($search_sale > 0) { - $param .= '&search_sale='.urlencode($search_sale); - } - if ($search_company) { - $param .= "&search_company=".urlencode($search_company); - } - if ($search_tracking) { - $param .= "&search_tracking=".urlencode($search_tracking); - } - if ($search_town) { - $param .= '&search_town='.urlencode($search_town); - } - if ($search_zip) { - $param .= '&search_zip='.urlencode($search_zip); - } - if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { - $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); - } +$expedition = new Expedition($db); - if ($search_datedelivery_start) { - $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); - } - if ($search_datedelivery_end) { - $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); - } - if ($search_datereceipt_start) { - $param .= '&search_datereceipt_start='.urlencode($search_datereceipt_start); - } - if ($search_datereceipt_end) { - $param .= '&search_datereceipt_end='.urlencode($search_datereceipt_end); - } +$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_exp) { + $param .= "&search_ref_exp=".urlencode($search_ref_exp); +} +if ($search_ref_liv) { + $param .= "&search_ref_liv=".urlencode($search_ref_liv); +} +if ($search_ref_customer) { + $param .= "&search_ref_customer=".urlencode($search_ref_customer); +} +if ($search_user > 0) { + $param .= '&search_user='.urlencode($search_user); +} +if ($search_sale > 0) { + $param .= '&search_sale='.urlencode($search_sale); +} +if ($search_company) { + $param .= "&search_company=".urlencode($search_company); +} +if ($search_tracking) { + $param .= "&search_tracking=".urlencode($search_tracking); +} +if ($search_town) { + $param .= '&search_town='.urlencode($search_town); +} +if ($search_zip) { + $param .= '&search_zip='.urlencode($search_zip); +} +if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { + $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); +} - if ($search_product_category != '') { - $param .= '&search_product_category='.urlencode($search_product_category); - } - if ($search_categ_cus > 0) { - $param .= '&search_categ_cus='.urlencode($search_categ_cus); - } - if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +if ($search_datedelivery_start) { + $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); +} +if ($search_datedelivery_end) { + $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); +} +if ($search_datereceipt_start) { + $param .= '&search_datereceipt_start='.urlencode($search_datereceipt_start); +} +if ($search_datereceipt_end) { + $param .= '&search_datereceipt_end='.urlencode($search_datereceipt_end); +} - $arrayofmassactions = array( - 'builddoc' => $langs->trans("PDFMerge"), - //'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged - 'presend' => $langs->trans("SendByMail"), - ); - if (in_array($massaction, array('presend'))) { - $arrayofmassactions = array(); +if ($search_product_category != '') { + $param .= '&search_product_category='.urlencode($search_product_category); +} +if ($search_categ_cus > 0) { + $param .= '&search_categ_cus='.urlencode($search_categ_cus); +} +if ($search_status != '') { + $param .= '&search_status='.urlencode($search_status); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +$arrayofmassactions = array( + 'builddoc' => $langs->trans("PDFMerge"), + //'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged + 'presend' => $langs->trans("SendByMail"), +); +if (in_array($massaction, array('presend'))) { + $arrayofmassactions = array(); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); + +// 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 = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2', '', $user->rights->expedition->creer); + +$i = 0; +print '
'; + +$hidegeneratedfilelistifempty = 1; +if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { + $hidegeneratedfilelistifempty = 0; +} + +// Show list of available documents +$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; +$urlsource .= str_replace('&', '&', $param); + +$filedir = $diroutputmassaction; +$genallowed = $user->rights->expedition->lire; +$delallowed = $user->rights->expedition->creer; +$title = ''; + +print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + // End of page llxFooter(); $db->close(); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index cb9bc100f79..7e108636962 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -117,6 +117,8 @@ 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'); +$error = 0; + /* * Actions @@ -485,444 +487,456 @@ $sql .= $db->plimit($limit + 1, $offset); //print $sql; $resql = $db->query($sql); -if ($resql) +if (!$resql) { + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + +$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); +// Add $param from extra fields +foreach ($search_array_options as $key => $val) { - $num = $db->num_rows($resql); - - $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); - // Add $param from extra fields - foreach ($search_array_options as $key => $val) - { - $crit = $val; - $tmpkey = preg_replace('/search_options_/', '', $key); - if ($val != '') $param .= '&search_options_'.$tmpkey.'='.urlencode($val); - } + $crit = $val; + $tmpkey = preg_replace('/search_options_/', '', $key); + if ($val != '') $param .= '&search_options_'.$tmpkey.'='.urlencode($val); +} - $arrayofmassactions = array( +$arrayofmassactions = array( // 'presend'=>$langs->trans("SendByMail"), - ); +); - 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"))); +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 ''; + +$db->free($resql); + llxFooter(); $db->close();