NEW Can select dynamicaly number of lines to show on page on product,

shipment, contact, orders, thirdparties
Fix can make a shipment for product not predefined in multiwarehouse
mode
This commit is contained in:
Laurent Destailleur 2016-02-10 23:37:34 +01:00
parent 9b41e11a1e
commit 6662c1b5e1
7 changed files with 164 additions and 90 deletions

View File

@ -64,10 +64,10 @@ $id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'commande', $id,''); $result = restrictedArea($user, 'commande', $id,'');
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
@ -90,6 +90,19 @@ $fieldstosearchall = array(
); );
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
$arrayfields=array(
);
// Extra fields
/*
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
*/
/* /*
* Actions * Actions
@ -257,6 +270,7 @@ if ($resql)
$title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $title.=' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled)?'':$langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill');
$param=''; $param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($socid > 0) $param.='&socid='.$socid; if ($socid > 0) $param.='&socid='.$socid;
if ($viewstatut != '') $param.='&viewstatut='.$viewstatut; if ($viewstatut != '') $param.='&viewstatut='.$viewstatut;
if ($ordermonth) $param.='&ordermonth='.$ordermonth; if ($ordermonth) $param.='&ordermonth='.$ordermonth;
@ -272,7 +286,6 @@ if ($resql)
if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($optioncss != '') $param.='&optioncss='.$optioncss;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png');
// Lignes des champs de filtre // Lignes des champs de filtre
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
@ -283,6 +296,8 @@ if ($resql)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit);
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);

View File

@ -67,6 +67,7 @@ $optioncss = GETPOST('optioncss','alpha');
$type=GETPOST("type"); $type=GETPOST("type");
$view=GETPOST("view"); $view=GETPOST("view");
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield', 'alpha'); $sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int'); $page = GETPOST('page', 'int');
@ -76,7 +77,6 @@ $begin=GETPOST('begin');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname"; if (! $sortfield) $sortfield="p.lastname";
if ($page < 0) { $page = 0; } if ($page < 0) { $page = 0; }
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page; $offset = $limit * $page;
$langs->load("companies"); $langs->load("companies");
@ -345,12 +345,12 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
if($view == "recent") if($view == "recent")
{ {
$sql.= $db->order("p.datec","DESC"); $sql.= $db->order("p.datec","DESC");
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
} }
else else
{ {
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
} }
//print $sql; //print $sql;
@ -361,11 +361,14 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param='';
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view);
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ); if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname); if ($search_lastname != '') $param.='&amp;search_lastname='.urlencode($search_lastname);
if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname); if ($search_firstname != '') $param.='&amp;search_firstname='.urlencode($search_firstname);
if ($search_societe != '') $param.='&amp;search_societe='.urlencode($search_societe);
if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip); if ($search_zip != '') $param.='&amp;search_zip='.urlencode($search_zip);
if ($search_town != '') $param.='&amp;search_town='.urlencode($search_town); if ($search_town != '') $param.='&amp;search_town='.urlencode($search_town);
if ($search_job != '') $param.='&amp;search_job='.urlencode($search_job); if ($search_job != '') $param.='&amp;search_job='.urlencode($search_job);
@ -385,8 +388,6 @@ if ($result)
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_companies.png');
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
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="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -395,6 +396,8 @@ if ($result)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit);
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
@ -739,9 +742,9 @@ if ($result)
print "</table>"; print "</table>";
print '</form>'; if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1);
if ($num > $limit) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print '</form>';
$db->free($result); $db->free($result);
} }

View File

@ -2968,10 +2968,11 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois
* @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $pictoisfullpath 1=Icon name is a full absolute url of image
* @param string $morehtml More html to show * @param string $morehtml More html to show
* @param string $morecss More css to the table * @param string $morecss More css to the table
* @param int $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit) * @param int|string $limit Max number of lines (-1 = use default, 0 = no limit, > 0 = limit).
* @param int $hideselectlimit Force to hide select limit
* @return void * @return void
*/ */
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1) function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=0, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
{ {
global $conf,$langs; global $conf,$langs;
@ -3057,7 +3058,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
$pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1)."</li>"; $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1)."</li>";
} }
} }
print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines); // output the div and ul for previous/last completed with page numbers into $pagelist print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist
print '</td>'; print '</td>';
print '</tr></table>'."\n"; print '</tr></table>'."\n";
@ -3075,14 +3076,15 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
* @param string $afterarrows HTML content to show after arrows. Must NOT contains '<li> </li>' tags. * @param string $afterarrows HTML content to show after arrows. Must NOT contains '<li> </li>' tags.
* @param int $limit Max nb of record to show (-1 = no combo with limit, 0 = no limit, > 0 = limit) * @param int $limit Max nb of record to show (-1 = no combo with limit, 0 = no limit, > 0 = limit)
* @param int $totalnboflines Total number of records/lines for all pages (if known) * @param int $totalnboflines Total number of records/lines for all pages (if known)
* @param int $hideselectlimit Force to hide select limit
* @return void * @return void
*/ */
function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0) function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betweenarrows='', $afterarrows='', $limit=-1, $totalnboflines=0, $hideselectlimit=0)
{ {
global $conf, $langs; global $conf, $langs;
print '<div class="pagination"><ul>'; print '<div class="pagination"><ul>';
if ((int) $limit >= 0) if ((int) $limit >= 0 && empty($hideselectlimit))
{ {
$pagesizechoices='10:10,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000'; $pagesizechoices='10:10,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported //$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported

View File

@ -242,7 +242,8 @@ if (empty($reshook))
} }
else else
{ {
//shipment line for product with no batch management var_dump($_POST); var_dump($batch);
//shipment line for product with no batch management and no multiple stock location
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int'); if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
} }
@ -549,7 +550,7 @@ if ($action == 'create2')
$action=''; $id=''; $ref=''; $action=''; $id=''; $ref='';
} }
// Mode creation. TODO This part seems to not be used at all. Receipt record is created by the action "create_delivery" not from a form. // Mode creation.
if ($action == 'create') if ($action == 'create')
{ {
$expe = new Expedition($db); $expe = new Expedition($db);
@ -577,9 +578,6 @@ if ($action == 'create')
if (! empty($conf->stock->enabled)) $entrepot = new Entrepot($db); if (! empty($conf->stock->enabled)) $entrepot = new Entrepot($db);
/*
* Document source
*/
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
@ -711,9 +709,7 @@ if ($action == 'create')
dol_fiche_end(); dol_fiche_end();
/* // Shipment lines
* Expedition Lines
*/
$numAsked = count($object->lines); $numAsked = count($object->lines);
@ -745,7 +741,7 @@ if ($action == 'create')
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
/* Lecture des expeditions deja effectuees */ // Lecture des expeditions deja effectuees
$object->loadExpeditions(); $object->loadExpeditions();
if ($numAsked) if ($numAsked)
@ -794,7 +790,7 @@ if ($action == 'create')
print "<tr ".$bc[$var].">\n"; print "<tr ".$bc[$var].">\n";
// Product label // Product label
if ($line->fk_product > 0) if ($line->fk_product > 0) // Predefined product ?
{ {
$product->fetch($line->fk_product); $product->fetch($line->fk_product);
$product->load_stock(); $product->load_stock();
@ -846,7 +842,7 @@ if ($action == 'create')
print '</td>'; print '</td>';
$qtyProdCom=$line->qty; $qtyProdCom=$line->qty;
// Qty already sent // Qty already shipped
print '<td align="center">'; print '<td align="center">';
$quantityDelivered = $object->expeditions[$line->id]; $quantityDelivered = $object->expeditions[$line->id];
print $quantityDelivered; print $quantityDelivered;
@ -865,7 +861,7 @@ if ($action == 'create')
$warehouse_id = GETPOST('entrepot_id','int'); $warehouse_id = GETPOST('entrepot_id','int');
$warehouseObject = null; $warehouseObject = null;
if ($warehouse_id > 0) if ($warehouse_id > 0 || ! ($line->fk_product > 0)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
{ {
//ship from preselected location //ship from preselected location
$stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number $stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number
@ -942,7 +938,7 @@ if ($action == 'create')
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
$staticwarehouse=new Entrepot($db); $staticwarehouse=new Entrepot($db);
$staticwarehouse->fetch($warehouse_id); if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id);
$subj=0; $subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
@ -970,16 +966,18 @@ if ($action == 'create')
$quantityToBeDelivered = 0; $quantityToBeDelivered = 0;
} }
$subj++; $subj++;
print '</td></tr>';
} }
} }
else else
{ {
print '<tr><td colspan="3" ></td><td align="center">'; print '<tr><td colspan="3"></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> '; print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> ';
print '</td>'; print '</td>';
print '<td align="left">'; print '<td align="left">';
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle); print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle);
print '</td></tr>';
} }
} }
} }
@ -989,12 +987,15 @@ if ($action == 'create')
if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
{ {
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
$subj=0; $subj=0;
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) { foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
{
$warehouseObject=new Entrepot($db); $warehouseObject=new Entrepot($db);
$warehouseObject->fetch($warehouse_id); $warehouseObject->fetch($warehouse_id);
if ($stock_warehouse->real > 0) { if ($stock_warehouse->real > 0)
{
$stock = + $stock_warehouse->real; // Convert it to number $stock = + $stock_warehouse->real; // Convert it to number
$deliverableQty = min($quantityToBeDelivered,$stock); $deliverableQty = min($quantityToBeDelivered,$stock);
// Quantity to send // Quantity to send
@ -1039,7 +1040,7 @@ if ($action == 'create')
{ {
$product->get_sousproduits_arbo(); $product->get_sousproduits_arbo();
$prods_arbo = $product->get_arbo_each_prod($qtyProdCom); $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
if(count($prods_arbo) > 0) if (count($prods_arbo) > 0)
{ {
foreach($prods_arbo as $key => $value) foreach($prods_arbo as $key => $value)
{ {
@ -1049,10 +1050,12 @@ if ($action == 'create')
{ {
$img=img_warning($langs->trans("StockTooLow")); $img=img_warning($langs->trans("StockTooLow"));
} }
print "<tr ".$bc[$var]."><td>&nbsp; &nbsp; &nbsp; -> print "<tr ".$bc[$var]."><td>";
print "&nbsp; &nbsp; &nbsp; ->
<a href=\"".DOL_URL_ROOT."/product/card.php?id=".$value['id']."\">".$value['fullpath']." <a href=\"".DOL_URL_ROOT."/product/card.php?id=".$value['id']."\">".$value['fullpath']."
</a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td>&nbsp</td><td>&nbsp</td> </a> (".$value['nb'].")</td><td align=\"center\"> ".$value['nb_total']."</td><td>&nbsp</td><td>&nbsp</td>
<td align=\"center\">".$value['stock']." ".$img."</td></tr>"; <td align=\"center\">".$value['stock']." ".$img."</td>";
print "</tr>";
} }
} }
} }
@ -1064,7 +1067,8 @@ if ($action == 'create')
$subj=0; $subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse) { foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
{
$warehouseObject=new Entrepot($db); $warehouseObject=new Entrepot($db);
$warehouseObject->fetch($warehouse_id); $warehouseObject->fetch($warehouse_id);
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) { if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
@ -1073,7 +1077,7 @@ if ($action == 'create')
//var_dump($dbatch); //var_dump($dbatch);
$batchStock = + $dbatch->qty; // To get a numeric $batchStock = + $dbatch->qty; // To get a numeric
$deliverableQty = min($quantityToBeDelivered,$batchStock); $deliverableQty = min($quantityToBeDelivered,$batchStock);
print '<tr><td colspan="3" ></td><td align="center">'; print '<tr><td colspan="3"></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">'; print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>'; print '</td>';
@ -1091,26 +1095,45 @@ if ($action == 'create')
} }
//dol_syslog('deliverableQty = '.$deliverableQty.' batchStock = '.$batchStock); //dol_syslog('deliverableQty = '.$deliverableQty.' batchStock = '.$batchStock);
$subj++; $subj++;
print '</td></tr>';
} }
} }
} }
} }
if ($subj == 0) if ($subj == 0) // Line not shown yet
{ {
print '<tr><td colspan="3" ></td><td align="center">'; print '<tr><td colspan="3" ></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0" disabled="disabled"> '; if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
//$disabled='disabled="disabled"';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="0"'.($disabled?' '.$disabled:'').'> ';
}
else
{
print $langs->trans("NA");
}
print '</td>'; print '</td>';
print '<td align="left">'; print '<td align="left">';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{
if ($warehouseObject) if ($warehouseObject)
{ {
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle); print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->libelle);
} }
else else
{ {
print img_warning().' '.$langs->trans("StockTooLow"); if ($line->fk_product) print img_warning().' '.$langs->trans("StockTooLow");
else print '';
} }
} }
else
{
print $langs->trans("Service");
}
print '</td>';
print '</tr>';
}
} }
@ -1576,6 +1599,7 @@ else if ($id || $ref)
{ {
print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):''; print (! empty($lines[$i]->description) && $lines[$i]->description!=$lines[$i]->product)?'<br>'.dol_htmlentitiesbr($lines[$i]->description):'';
} }
print "</td>\n";
} }
else else
{ {

View File

@ -42,17 +42,16 @@ $search_company = GETPOST("search_company");
$sall = GETPOST('sall'); $sall = GETPOST('sall');
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha'); $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha'); $sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int'); $page = GETPOST('page','int');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="DESC";
if ($page == -1) { $page = 0; } if ($page == -1) { $page = 0; }
$offset = $limit * $page; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) $sortfield="e.ref";
if (! $sortorder) $sortorder="DESC";
$viewstatut=GETPOST('viewstatut'); $viewstatut=GETPOST('viewstatut');
@ -71,6 +70,19 @@ $fieldstosearchall = array(
's.nom'=>"ThirdParty" 's.nom'=>"ThirdParty"
); );
$arrayfields=array(
);
// Extra fields
/*
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
}
}
*/
/* /*
* View * View
@ -129,18 +141,22 @@ if ($resql)
$expedition = new Expedition($db); $expedition = new Expedition($db);
$param=""; $param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp; if ($search_ref_exp) $param.= "&amp;search_ref_exp=".$search_ref_exp;
if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv; if ($search_ref_liv) $param.= "&amp;search_ref_liv=".$search_ref_liv;
if ($search_company) $param.= "&amp;search_company=".$search_company; if ($search_company) $param.= "&amp;search_company=".$search_company;
if ($optioncss != '') $param.='&amp;optioncss='.$optioncss; if ($optioncss != '') $param.='&amp;optioncss='.$optioncss;
print_barre_liste($langs->trans('ListOfSendings'), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords);
$i = 0; $i = 0;
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n"; 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="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
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);
if ($sall) if ($sall)
{ {
@ -149,6 +165,18 @@ if ($resql)
} }
$moreforfilter=''; $moreforfilter='';
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
$parameters=array('type'=>$type);
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">'; print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';

View File

@ -314,6 +314,8 @@ else
setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs');
} }
$param='';
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_categ > 0) $param.="&amp;search_categ=".$search_categ; if ($search_categ > 0) $param.="&amp;search_categ=".$search_categ;
if ($sref) $param="&amp;sref=".$sref; if ($sref) $param="&amp;sref=".$sref;
if ($search_ref_supplier) $param="&amp;search_ref_supplier=".$search_ref_supplier; if ($search_ref_supplier) $param="&amp;search_ref_supplier=".$search_ref_supplier;
@ -337,7 +339,16 @@ else
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords,'title_products.png'); print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_products.png', 0, '', '', $limit);
if (! empty($catid)) if (! empty($catid))
{ {
@ -368,15 +379,6 @@ else
} }
else else
{ {
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
if ($sall) if ($sall)
{ {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
@ -781,8 +783,8 @@ else
$db->free($resql); $db->free($resql);
print "</table>"; print "</table>";
print '</form>';
} }
print '</form>';
} }
else else
{ {

View File

@ -83,7 +83,7 @@ $page=GETPOST("page",'int');
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom"; if (! $sortfield) $sortfield="s.nom";
if ($page == -1) { $page = 0 ; } if ($page == -1) { $page = 0 ; }
$offset = $limit * $page ; $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;