actualize from develop
This commit is contained in:
parent
7c3e643fca
commit
dff36c9d68
@ -246,7 +246,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
|||||||
// We ask to move a qty
|
// We ask to move a qty
|
||||||
if (GETPOST($qty) != 0) {
|
if (GETPOST($qty) != 0) {
|
||||||
if (! (GETPOST($ent, 'int') > 0)) {
|
if (! (GETPOST($ent, 'int') > 0)) {
|
||||||
dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed');
|
dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.');
|
||||||
$text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline);
|
$text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline);
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -283,7 +283,7 @@ if ($action == 'dispatch' && $user->rights->fournisseur->commande->receptionner)
|
|||||||
// We ask to move a qty
|
// We ask to move a qty
|
||||||
if (GETPOST($qty) > 0) {
|
if (GETPOST($qty) > 0) {
|
||||||
if (! (GETPOST($ent, 'int') > 0)) {
|
if (! (GETPOST($ent, 'int') > 0)) {
|
||||||
dol_syslog('No dispatch for line ' . $key . ' as no warehouse choosed');
|
dol_syslog('No dispatch for line ' . $key . ' as no warehouse was chosen.');
|
||||||
$text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1);
|
$text = $langs->transnoentities('Warehouse') . ', ' . $langs->transnoentities('Line') . ' ' . ($numline) . '-' . ($reg[1] + 1);
|
||||||
setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired', $text), null, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -418,13 +418,13 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
if ($object->methode_commande_id > 0) {
|
if ($object->methode_commande_id > 0) {
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("Date") . '</td><td>';
|
print '<tr><td class="titlefield">' . $langs->trans("Date") . '</td><td>';
|
||||||
if ($object->date_commande) {
|
if ($object->date_commande) {
|
||||||
print dol_print_date($object->date_commande, "dayhourtext") . "\n";
|
print dol_print_date($object->date_commande, "dayhour") . "\n";
|
||||||
}
|
}
|
||||||
print "</td></tr>";
|
print "</td></tr>";
|
||||||
|
|
||||||
@ -454,12 +454,13 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
|
|
||||||
// Line of orders
|
// Line of orders
|
||||||
if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) {
|
if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) {
|
||||||
print '<span class="opacitymedium">'.$langs->trans("OrderStatusNotReadyToDispatch").'</span>';
|
print '<br><span class="opacitymedium">'.$langs->trans("OrderStatusNotReadyToDispatch").'</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT
|
if ($object->statut == CommandeFournisseur::STATUS_ORDERSENT
|
||||||
|| $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY
|
|| $object->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY
|
||||||
|| $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) {
|
|| $object->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY)
|
||||||
|
{
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||||
$formproduct = new FormProduct($db);
|
$formproduct = new FormProduct($db);
|
||||||
@ -500,11 +501,35 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
|
|
||||||
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
|
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
|
||||||
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
|
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
|
||||||
|
|
||||||
|
// Enable hooks to alter the SQL query (SELECT)
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks(
|
||||||
|
'printFieldListSelect',
|
||||||
|
$parameters,
|
||||||
|
$object,
|
||||||
|
$action
|
||||||
|
);
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
||||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
||||||
$sql .= " WHERE l.fk_commande = " . $object->id;
|
$sql .= " WHERE l.fk_commande = " . $object->id;
|
||||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||||
$sql .= " AND l.product_type = 0";
|
$sql .= " AND l.product_type = 0";
|
||||||
|
|
||||||
|
// Enable hooks to alter the SQL query (WHERE)
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks(
|
||||||
|
'printFieldListWhere',
|
||||||
|
$parameters,
|
||||||
|
$object,
|
||||||
|
$action
|
||||||
|
);
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
$sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
|
$sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
|
||||||
$sql .= " ORDER BY p.ref, p.label";
|
$sql .= " ORDER BY p.ref, p.label";
|
||||||
|
|
||||||
@ -514,23 +539,23 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($num) {
|
if ($num) {
|
||||||
$entrepot = new Entrepot($db);
|
$entrepot = new Entrepot($db);
|
||||||
$listwarehouses=$entrepot->list_array(1);
|
$listwarehouses=$entrepot->list_array(1);
|
||||||
|
// entrepot par défaut
|
||||||
|
print $langs->trans("Warehouse").' : ';
|
||||||
|
if (count($listwarehouses)>1)
|
||||||
|
{
|
||||||
|
print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled);
|
||||||
|
}
|
||||||
|
elseif (count($listwarehouses)==1)
|
||||||
|
{
|
||||||
|
print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("NoWarehouseDefined");
|
||||||
|
}
|
||||||
|
|
||||||
// entrepot par défaut
|
|
||||||
print $langs->trans("Warehouse").' : ';
|
|
||||||
if (count($listwarehouses)>1)
|
|
||||||
{
|
|
||||||
print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 1, 0, 0, '', 0, 0, $disabled);
|
|
||||||
}
|
|
||||||
elseif (count($listwarehouses)==1)
|
|
||||||
{
|
|
||||||
print $form->selectarray('fk_default_warehouse', $listwarehouses, $fk_default_warehouse, 0, 0, 0, '', 0, 0, $disabled);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $langs->trans("NoWarehouseDefined");
|
|
||||||
}
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
|
|
||||||
print '<td>' . $langs->trans("Description") . '</td>';
|
print '<td>' . $langs->trans("Description") . '</td>';
|
||||||
@ -546,12 +571,24 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
print '<td></td>';
|
print '<td></td>';
|
||||||
}
|
}
|
||||||
print '<td class="right">' . $langs->trans("SupplierRef") . '</td>';
|
//print '<td class="right">' . $langs->trans("SupplierRef") . '</td>';
|
||||||
print '<td class="right">' . $langs->trans("QtyOrdered") . '</td>';
|
print '<td class="right">' . $langs->trans("QtyOrdered") . '</td>';
|
||||||
print '<td class="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
|
print '<td class="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
|
||||||
print '<td class="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
|
print '<td class="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
|
||||||
print '<td width="32"></td>';
|
print '<td width="32"></td>';
|
||||||
print '<td class="right">' . $langs->trans("Warehouse") . '</td>';
|
print '<td align="right">' . $langs->trans("Warehouse") . '</td>';
|
||||||
|
|
||||||
|
// Enable hooks to append additional columns
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks(
|
||||||
|
'printFieldListTitle',
|
||||||
|
$parameters,
|
||||||
|
$object,
|
||||||
|
$action
|
||||||
|
);
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +655,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
|
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
|
||||||
|
|
||||||
// Supplier ref
|
// Supplier ref
|
||||||
print '<td class="right">'.$objp->sref.'</td>';
|
//print '<td class="right">'.$objp->sref.'</td>';
|
||||||
|
|
||||||
// Qty ordered
|
// Qty ordered
|
||||||
print '<td class="right">' . $objp->qty . '</td>';
|
print '<td class="right">' . $objp->qty . '</td>';
|
||||||
@ -634,6 +671,23 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
//print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
|
//print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
|
||||||
print '</td>'; // Dispatch column
|
print '</td>'; // Dispatch column
|
||||||
print '<td></td>'; // Warehouse column
|
print '<td></td>'; // Warehouse column
|
||||||
|
|
||||||
|
// Enable hooks to append additional columns
|
||||||
|
$parameters = array(
|
||||||
|
'is_information_row' => true, // allows hook to distinguish between the
|
||||||
|
// rows with information and the rows with
|
||||||
|
// dispatch form input
|
||||||
|
'objp' => $objp
|
||||||
|
);
|
||||||
|
$reshook = $hookmanager->executeHooks(
|
||||||
|
'printFieldListValue',
|
||||||
|
$parameters,
|
||||||
|
$object,
|
||||||
|
$action
|
||||||
|
);
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven" name="' . $type . $suffix . '">';
|
print '<tr class="oddeven" name="' . $type . $suffix . '">';
|
||||||
@ -674,10 +728,27 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
//print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
|
//print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
|
||||||
print '</td>'; // Dispatch column
|
print '</td>'; // Dispatch column
|
||||||
print '<td></td>'; // Warehouse column
|
print '<td></td>'; // Warehouse column
|
||||||
|
|
||||||
|
// Enable hooks to append additional columns
|
||||||
|
$parameters = array(
|
||||||
|
'is_information_row' => true, // allows hook to distinguish between the
|
||||||
|
// rows with information and the rows with
|
||||||
|
// dispatch form input
|
||||||
|
'objp' => $objp
|
||||||
|
);
|
||||||
|
$reshook = $hookmanager->executeHooks(
|
||||||
|
'printFieldListValue',
|
||||||
|
$parameters,
|
||||||
|
$object,
|
||||||
|
$action
|
||||||
|
);
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven" name="' . $type . $suffix . '">';
|
print '<tr class="oddeven" name="' . $type . $suffix . '">';
|
||||||
print '<td colspan="7">';
|
print '<td colspan="6">';
|
||||||
print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">';
|
print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">';
|
||||||
print '<input name="product' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">';
|
print '<input name="product' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">';
|
||||||
|
|
||||||
@ -725,6 +796,19 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
}
|
}
|
||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
|
// Enable hooks to append additional columns
|
||||||
|
$parameters = array(
|
||||||
|
'is_information_row' => false // this is a dispatch form row
|
||||||
|
);
|
||||||
|
$reshook = $hookmanager->executeHooks(
|
||||||
|
'printFieldListValue',
|
||||||
|
$parameters,
|
||||||
|
$object,
|
||||||
|
$action
|
||||||
|
);
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
print $hookmanager->resPrint;
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -737,13 +821,12 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print "<br>\n";
|
|
||||||
|
|
||||||
if ($nbproduct)
|
if ($nbproduct)
|
||||||
{
|
{
|
||||||
$checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
|
$checkboxlabel = $langs->trans("CloseReceivedSupplierOrdersAutomatically", $langs->transnoentitiesnoconv('StatusOrderReceivedAll'));
|
||||||
|
|
||||||
print '<br><div class="center">';
|
print '<div class="center">';
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
// modified by hook
|
// modified by hook
|
||||||
@ -760,7 +843,7 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
}
|
}
|
||||||
empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive");
|
empty($conf->reception->enabled)?$dispatchBt=$langs->trans("DispatchVerb"):$dispatchBt=$langs->trans("Receive");
|
||||||
|
|
||||||
print '<br><input type="submit" class="button" value="' . $dispatchBt. '"';
|
print '<br><input type="submit" class="button" name="dispatch" value="' . dol_escape_htmltag($dispatchBt). '"';
|
||||||
if (count($listwarehouses) <= 0)
|
if (count($listwarehouses) <= 0)
|
||||||
print ' disabled';
|
print ' disabled';
|
||||||
print '>';
|
print '>';
|
||||||
@ -770,7 +853,8 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
|
|
||||||
// Message if nothing to dispatch
|
// Message if nothing to dispatch
|
||||||
if (! $nbproduct) {
|
if (! $nbproduct) {
|
||||||
if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))
|
print "<br>\n";
|
||||||
|
if (empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED))
|
||||||
print '<div class="opacitymedium">'.$langs->trans("NoPredefinedProductToDispatch").'</div>'; // No predefined line at all
|
print '<div class="opacitymedium">'.$langs->trans("NoPredefinedProductToDispatch").'</div>'; // No predefined line at all
|
||||||
else
|
else
|
||||||
print '<div class="opacitymedium">'.$langs->trans("NoMorePredefinedProductToDispatch").'</div>'; // No predefined line that remain to be dispatched.
|
print '<div class="opacitymedium">'.$langs->trans("NoMorePredefinedProductToDispatch").'</div>'; // No predefined line that remain to be dispatched.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user