NEW list and fix conf
This commit is contained in:
parent
66093343b8
commit
489ccc3c49
@ -113,9 +113,6 @@ if($action)
|
||||
if($action == 'STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT') {
|
||||
$res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if($action == 'STOCK_MUST_BE_ENOUGH_FOR_RECEPTION') {
|
||||
$res = dolibarr_set_const($db, "STOCK_MUST_BE_ENOUGH_FOR_RECEPTION", GETPOST('STOCK_MUST_BE_ENOUGH_FOR_RECEPTION','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
if($action == 'INDEPENDANT_SUBPRODUCT_STOCK') {
|
||||
$res = dolibarr_set_const($db, "INDEPENDANT_SUBPRODUCT_STOCK", GETPOST('INDEPENDANT_SUBPRODUCT_STOCK','alpha'),'chaine',0,'',$conf->entity);
|
||||
}
|
||||
@ -444,20 +441,7 @@ if($conf->expedition->enabled) {
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
if($conf->reception->enabled) {
|
||||
$var = !$var;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="60%">'.$langs->trans("StockMustBeEnoughForReception").'</td>';
|
||||
print '<td width="160" align="right">';
|
||||
print "<form method=\"post\" action=\"stock.php\">";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"STOCK_MUST_BE_ENOUGH_FOR_RECEPTION\">";
|
||||
print $form->selectyesno("STOCK_MUST_BE_ENOUGH_FOR_RECEPTION",$conf->global->STOCK_MUST_BE_ENOUGH_FOR_RECEPTION,1);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print "</td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
$virtualdiffersfromphysical=0;
|
||||
|
||||
@ -5566,6 +5566,10 @@ class Form
|
||||
$tplpath = 'expedition';
|
||||
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
|
||||
}
|
||||
else if ($objecttype == 'reception') {
|
||||
$tplpath = 'reception';
|
||||
if (empty($conf->reception->enabled)) continue; // Do not show if module disabled
|
||||
}
|
||||
else if ($objecttype == 'delivery') {
|
||||
$tplpath = 'livraison';
|
||||
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
|
||||
@ -5585,7 +5589,7 @@ class Form
|
||||
|
||||
global $linkedObjectBlock;
|
||||
$linkedObjectBlock = $objects;
|
||||
|
||||
|
||||
|
||||
// Output template part (modules that overwrite templates must declare this into descriptor)
|
||||
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/'.$tplpath.'/tpl'));
|
||||
|
||||
@ -9,7 +9,7 @@ ShowReception=Show Receptions
|
||||
Receivings=Delivery Receipts
|
||||
ReceptionsArea=Receptions area
|
||||
ListOfReceptions=List of receptions
|
||||
ReceptionMethod=Shipping method
|
||||
ReceptionMethod=Reception method
|
||||
LastReceptions=Latest %s receptions
|
||||
StatisticsOfReceptions=Statistics for receptions
|
||||
NbOfReceptions=Number of receptions
|
||||
@ -44,9 +44,9 @@ DateDeliveryPlanned=Planned date of delivery
|
||||
RefDeliveryReceipt=Ref delivery receipt
|
||||
StatusReceipt=Status delivery receipt
|
||||
DateReceived=Date delivery received
|
||||
SendShippingByEMail=Send reception by EMail
|
||||
SendShippingRef=Submission of reception %s
|
||||
ActionsOnShipping=Events on reception
|
||||
SendReceptionByEMail=Send reception by EMail
|
||||
SendReceptionRef=Submission of reception %s
|
||||
ActionsOnReception=Events on reception
|
||||
LinkToTrackYourPackage=Link to track your package
|
||||
ReceptionCreationIsDoneFromOrder=For the moment, creation of a new reception is done from the order card.
|
||||
ReceptionLine=Reception line
|
||||
|
||||
@ -69,3 +69,6 @@ SumOfProductWeights=Somme des poids des produits
|
||||
# warehouse details
|
||||
DetailWarehouseNumber= Détail de l'entrepôt
|
||||
DetailWarehouseFormat= W:%s (Qté : %d)
|
||||
|
||||
Billed=Facturé
|
||||
ClassifyUnbilled=Classer non facturé
|
||||
|
||||
@ -108,7 +108,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('receptioncard','globalcard'));
|
||||
|
||||
$permissiondellink=$user->rights->reception->livraison->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiondellink=$user->rights->reception->creer; // Used by the include of actions_dellink.inc.php
|
||||
//var_dump($object->lines[0]->detail_batch);
|
||||
|
||||
|
||||
@ -333,9 +333,10 @@ if (empty($reshook))
|
||||
$idl = "idl".$i;
|
||||
|
||||
$entrepot_id = is_numeric(GETPOST($ent, 'int')) ? GETPOST($ent, 'int') : GETPOST('entrepot_id', 'int');
|
||||
|
||||
if ($entrepot_id < 0)
|
||||
$entrepot_id = '';
|
||||
if (!($linesrc->fk_product > 0))
|
||||
if (!($linesrc->fk_product > 0) && empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
$entrepot_id = 0;
|
||||
$eatby = GETPOST($eatby, 'alpha');
|
||||
$sellby = GETPOST($sellby, 'alpha');
|
||||
@ -387,22 +388,6 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a receiving receipt
|
||||
*/
|
||||
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->reception->livraison->creer)
|
||||
{
|
||||
$result = $object->create_delivery($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT.'/livraison/card.php?action=create_delivery&id='.$result);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->reception->creer))
|
||||
@ -542,7 +527,7 @@ if (empty($reshook))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$upload_dir = $conf->reception->dir_output . "/reception";
|
||||
$upload_dir = $conf->reception->dir_output ;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
|
||||
@ -1801,6 +1786,7 @@ else if ($id || $ref)
|
||||
$sql.= " AND obj.fk_commande = ".$origin_id;
|
||||
$sql.= " AND obj.rowid = ed.fk_commandefourndet";
|
||||
$sql.= " AND ed.fk_reception = e.rowid";
|
||||
$sql.= " AND ed.fk_reception !=".$object->id;
|
||||
//if ($filter) $sql.= $filter;
|
||||
$sql.= " ORDER BY obj.fk_product";
|
||||
|
||||
@ -2166,7 +2152,7 @@ else if ($id || $ref)
|
||||
{
|
||||
$label="Close"; $paramaction='classifyclosed'; // = Transferred/Received
|
||||
// Label here should be "Close" or "ClassifyBilled" if we decided to make bill on receptions instead of orders
|
||||
if (! empty($conf->facture->enabled) && ! empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
|
||||
if (! empty($conf->fournisseur->enabled) && ! empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ?
|
||||
{
|
||||
$label="ClassifyBilled";
|
||||
$paramaction='classifybilled';
|
||||
|
||||
@ -753,38 +753,6 @@ class Reception extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a delivery receipt from a reception
|
||||
*
|
||||
* @param User $user User
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function create_delivery($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($conf->livraison_bon->enabled)
|
||||
{
|
||||
if ($this->statut == 1 || $this->statut == 2)
|
||||
{
|
||||
// Reception validee
|
||||
include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php';
|
||||
$delivery = new Livraison($this->db);
|
||||
$result=$delivery->create_from_reception($user, $this->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$delivery->error;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an reception line.
|
||||
@ -814,7 +782,7 @@ class Reception extends CommonObject
|
||||
|
||||
$supplierorderline = new CommandeFournisseurLigne($this->db);
|
||||
$supplierorderline->fetch($id);
|
||||
|
||||
|
||||
if (! empty($conf->stock->enabled) && ! empty($supplierorderline->fk_product))
|
||||
{
|
||||
$fk_product = $supplierorderline->fk_product;
|
||||
@ -826,28 +794,7 @@ class Reception extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_RECEPTION)
|
||||
{
|
||||
// Check must be done for stock of product into warehouse if $entrepot_id defined
|
||||
$product=new Product($this->db);
|
||||
$result=$product->fetch($fk_product);
|
||||
|
||||
if ($entrepot_id > 0) {
|
||||
$product->load_stock('warehouseopen');
|
||||
$product_stock = $product->stock_warehouse[$entrepot_id]->real;
|
||||
}
|
||||
else
|
||||
$product_stock = $product->stock_reel;
|
||||
|
||||
$product_type=$product->type;
|
||||
if ($product_type == 0 && $product_stock < $qty)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnoughToAddProductOnReception', $product->ref);
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// extrafields
|
||||
@ -973,7 +920,6 @@ class Reception extends CommonObject
|
||||
|
||||
/**
|
||||
* Delete reception.
|
||||
* Warning, do not delete a reception if a delivery is linked to (with table llx_element_element)
|
||||
*
|
||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||
*/
|
||||
@ -985,13 +931,7 @@ class Reception extends CommonObject
|
||||
$error=0;
|
||||
$this->error='';
|
||||
|
||||
// Add a protection to refuse deleting if reception has at least one delivery
|
||||
$this->fetchObjectLinked($this->id, 'reception', 0, 'delivery'); // Get deliveries linked to this reception
|
||||
if (count($this->linkedObjectsIds) > 0)
|
||||
{
|
||||
$this->error='ErrorThereIsSomeDeliveries';
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
$this->db->begin();
|
||||
// Stock control
|
||||
@ -1205,11 +1145,10 @@ class Reception extends CommonObject
|
||||
function getNomUrl($withpicto=0,$option=0,$max=0,$short=0,$notooltip=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowReception") . '</u>';
|
||||
$label .= '<br><b>' . $langs->trans('Ref') . ':</b> '.$this->ref;
|
||||
$label .= '<br><b>'.$langs->trans('RefCustomer').':</b> '.($this->ref_supplier ? $this->ref_supplier : $this->ref_client);
|
||||
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.($this->ref_supplier ? $this->ref_supplier : $this->ref_client);
|
||||
|
||||
$url = DOL_URL_ROOT.'/reception/card.php?id='.$this->id;
|
||||
|
||||
@ -1762,7 +1701,7 @@ class Reception extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET fk_statut=1';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET fk_statut=1, billed=0';
|
||||
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0';
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
@ -124,7 +124,7 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.entity = ".$conf->entity;
|
||||
$sql.= " AND c.fk_statut = 2";//Approuvé
|
||||
$sql.= " AND c.fk_statut = 3";//Commandé
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY c.rowid ASC";
|
||||
|
||||
@ -19,31 +19,32 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/expedition/list.php
|
||||
* \ingroup expedition
|
||||
* \brief Page to list all shipments
|
||||
* \file htdocs/reception/list.php
|
||||
* \ingroup reception
|
||||
* \brief Page to list all receptions
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->load("sendings");
|
||||
$langs->load("receptions");
|
||||
$langs->load("deliveries");
|
||||
$langs->load('companies');
|
||||
|
||||
$socid=GETPOST('socid','int');
|
||||
// Security check
|
||||
$expeditionid = GETPOST('id','int');
|
||||
$receptionid = GETPOST('id','int');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'expedition',$expeditionid,'');
|
||||
$result = restrictedArea($user, 'reception',$receptionid,'');
|
||||
|
||||
$diroutputmassaction=$conf->expedition->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
$diroutputmassaction=$conf->reception->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
$search_ref_exp = GETPOST("search_ref_exp");
|
||||
$search_ref_liv = GETPOST('search_ref_liv');
|
||||
$search_ref_supplier = GETPOST('search_ref_supplier');
|
||||
$search_company = GETPOST("search_company");
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
@ -66,16 +67,16 @@ $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='shipmentlist';
|
||||
$contextpage='receptionlist';
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('shipmentlist'));
|
||||
$hookmanager->initHooks(array('receptionlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('expedition');
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('reception');
|
||||
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
|
||||
|
||||
// List of fields to search into when doing a "search in all"
|
||||
@ -89,7 +90,7 @@ if (empty($user->socid)) $fieldstosearchall["e.note_private"]="NotePrivate";
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'e.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'e.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
'e.ref_supplier'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
@ -100,9 +101,7 @@ $arrayfields=array(
|
||||
'e.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'e.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
'e.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000),
|
||||
'l.ref'=>array('label'=>$langs->trans("DeliveryRef"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled),
|
||||
'l.date_delivery'=>array('label'=>$langs->trans("DateReceived"), 'checked'=>1, 'enabled'=>$conf->livraison_bon->enabled),
|
||||
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
|
||||
'e.billed'=>array('label'=>$langs->trans("Billed"), 'checked'=>1, 'position'=>1000, 'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)))
|
||||
);
|
||||
|
||||
// Extra fields
|
||||
@ -131,6 +130,7 @@ 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
|
||||
{
|
||||
$search_ref_supplier='';
|
||||
$search_ref_exp='';
|
||||
$search_ref_liv='';
|
||||
$search_company='';
|
||||
@ -171,13 +171,13 @@ if (empty($reshook))
|
||||
|
||||
$form=new Form($db);
|
||||
$companystatic=new Societe($db);
|
||||
$shipment=new Expedition($db);
|
||||
$reception=new Reception($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
$helpurl='EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
|
||||
llxHeader('',$langs->trans('ListOfSendings'),$helpurl);
|
||||
$helpurl='EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones';
|
||||
llxHeader('',$langs->trans('ListOfReceptions'),$helpurl);
|
||||
|
||||
$sql = "SELECT e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,";
|
||||
$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as date_livraison, l.date_delivery as date_reception, 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.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
@ -188,19 +188,19 @@ foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->att
|
||||
$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."expedition as e";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."expedition_extrafields as ef on (e.rowid = ef.fk_object)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."reception as e";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."reception_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 = 'shipping' AND ee.targettype = 'delivery'";
|
||||
$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."livraison as l ON l.rowid = ee.fk_target";
|
||||
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('expedition').")";
|
||||
$sql.= " WHERE e.entity IN (".getEntity('reception').")";
|
||||
if (!$user->rights->societe->client->voir && !$socid) // Internal user with no permission to see all
|
||||
{
|
||||
$sql.= " AND e.fk_soc = sc.fk_soc";
|
||||
@ -222,6 +222,7 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdp
|
||||
if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp);
|
||||
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
|
||||
@ -259,7 +260,7 @@ if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$expedition = new Expedition($db);
|
||||
$reception = new Reception($db);
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
@ -289,7 +290,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans('ListOfReceptions'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
@ -324,10 +325,10 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Ref customer
|
||||
if (! empty($arrayfields['e.ref_customer']['checked']))
|
||||
if (! empty($arrayfields['e.ref_supplier']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref_customer" value="'.$search_ref_customer.'">';
|
||||
print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Thirdparty
|
||||
@ -422,7 +423,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['e.fk_statut']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
|
||||
print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'),'1'=>$langs->trans('StatusSendingValidatedShort'),'2'=>$langs->trans('StatusSendingProcessedShort')),$viewstatut,1);
|
||||
print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusReceptionDraftShort'),'1'=>$langs->trans('StatusReceptionValidatedShort'),'2'=>$langs->trans('StatusReceptionProcessedShort')),$viewstatut,1);
|
||||
print '</td>';
|
||||
}
|
||||
// Status billed
|
||||
@ -441,7 +442,7 @@ if ($resql)
|
||||
|
||||
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_customer']['checked'])) print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"],"e.ref_customer","",$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,'align="left"',$sortfield,$sortorder);
|
||||
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);
|
||||
@ -483,8 +484,8 @@ if ($resql)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
$shipment->id=$obj->rowid;
|
||||
$shipment->ref=$obj->ref;
|
||||
$reception->id=$obj->rowid;
|
||||
$reception->ref=$obj->ref;
|
||||
|
||||
$companystatic->id=$obj->socid;
|
||||
$companystatic->ref=$obj->name;
|
||||
@ -497,16 +498,16 @@ if ($resql)
|
||||
if (! empty($arrayfields['e.ref']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $shipment->getNomUrl(1);
|
||||
print $reception->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Ref customer
|
||||
if (! empty($arrayfields['e.ref_customer']['checked']))
|
||||
if (! empty($arrayfields['e.ref_supplier']['checked']))
|
||||
{
|
||||
print "<td>";
|
||||
print $obj->ref_customer;
|
||||
print $obj->ref_supplier;
|
||||
print "</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -566,7 +567,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_livraison),"day");
|
||||
/*$now = time();
|
||||
if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 )
|
||||
if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 )
|
||||
{
|
||||
}*/
|
||||
print "</td>\n";
|
||||
@ -574,9 +575,9 @@ if ($resql)
|
||||
|
||||
if (! empty($arrayfields['l.ref']['checked']) || ! empty($arrayfields['l.date_delivery']['checked']))
|
||||
{
|
||||
$shipment->fetchObjectLinked($shipment->id,$shipment->element);
|
||||
$reception->fetchObjectLinked($reception->id,$reception->element);
|
||||
$receiving='';
|
||||
if (count($shipment->linkedObjects['delivery']) > 0) $receiving=reset($shipment->linkedObjects['delivery']);
|
||||
if (count($reception->linkedObjects['delivery']) > 0) $receiving=reset($reception->linkedObjects['delivery']);
|
||||
|
||||
if (! empty($arrayfields['l.ref']['checked']))
|
||||
{
|
||||
@ -636,7 +637,7 @@ if ($resql)
|
||||
// Status
|
||||
if (! empty($arrayfields['e.fk_statut']['checked']))
|
||||
{
|
||||
print '<td align="right" class="nowrap">'.$shipment->LibStatut($obj->fk_statut,5).'</td>';
|
||||
print '<td align="right" class="nowrap">'.$reception->LibStatut($obj->fk_statut,5).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Billed
|
||||
|
||||
Loading…
Reference in New Issue
Block a user