Code comment
This commit is contained in:
parent
cc78a666a0
commit
52d39d9d5a
@ -120,12 +120,12 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($cancel)
|
||||
{
|
||||
$action = '';
|
||||
if ($cancel)
|
||||
{
|
||||
$action = '';
|
||||
$object->fetch($id); // show shipment also after canceling modification
|
||||
}
|
||||
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Set incoterm
|
||||
@ -134,13 +134,13 @@ if (empty($reshook))
|
||||
$object->fetch($id);
|
||||
$result = $object->reOpen();
|
||||
}
|
||||
|
||||
|
||||
// Set incoterm
|
||||
if ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'setref_customer')
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
@ -157,14 +157,14 @@ if (empty($reshook))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'update_extras')
|
||||
{
|
||||
// Fill array 'array_options' with data from update form
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
@ -180,11 +180,11 @@ if (empty($reshook))
|
||||
} else if ($reshook < 0)
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if ($error)
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
|
||||
|
||||
// Create shipment
|
||||
if ($action == 'add' && $user->rights->expedition->creer)
|
||||
{
|
||||
@ -255,18 +255,18 @@ if (empty($reshook))
|
||||
$sub_qty[$j]['q']=GETPOST($qty,'int'); // the qty we want to move for this stock record
|
||||
$sub_qty[$j]['id_batch']=GETPOST($batch,'int'); // the id into llx_product_batch of stock record to move
|
||||
$subtotalqty+=$sub_qty[$j]['q'];
|
||||
|
||||
|
||||
//var_dump($qty);var_dump($batch);var_dump($sub_qty[$j]['q']);var_dump($sub_qty[$j]['id_batch']);
|
||||
|
||||
|
||||
$j++;
|
||||
$batch="batchl".$i."_".$j;
|
||||
$qty = "qtyl".$i.'_'.$j;
|
||||
}
|
||||
|
||||
|
||||
$batch_line[$i]['detail']=$sub_qty; // array of details
|
||||
$batch_line[$i]['qty']=$subtotalqty;
|
||||
$batch_line[$i]['ix_l']=GETPOST($idl,'int');
|
||||
|
||||
|
||||
$totalqty+=$subtotalqty;
|
||||
}
|
||||
else
|
||||
@ -293,11 +293,11 @@ if (empty($reshook))
|
||||
$stockLine[$i][$j]['ix_l']=GETPOST($idl,'int');
|
||||
|
||||
$totalqty+=GETPOST($qty,'int');
|
||||
|
||||
|
||||
$j++;
|
||||
$stockLocation="ent1".$i."_".$j;
|
||||
$qty = "qtyl".$i.'_'.$j;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -305,7 +305,7 @@ if (empty($reshook))
|
||||
//shipment line for product with no batch management and no multiple stock location
|
||||
if (GETPOST($qty,'int') > 0) $totalqty+=GETPOST($qty,'int');
|
||||
}
|
||||
|
||||
|
||||
// Extrafields
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options[$i] = $extrafieldsline->getOptionalsFromPost($extralabelsline, $i);
|
||||
@ -316,9 +316,9 @@ if (empty($reshook))
|
||||
unset($_POST["options_" . $key]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//var_dump($batch_line[2]);
|
||||
|
||||
if ($totalqty > 0) // There is at least one thing to ship
|
||||
@ -328,7 +328,7 @@ if (empty($reshook))
|
||||
{
|
||||
$qty = "qtyl".$i;
|
||||
if (! isset($batch_line[$i]))
|
||||
{
|
||||
{
|
||||
// not batch mode
|
||||
if (isset($stockLine[$i]))
|
||||
{
|
||||
@ -356,7 +356,7 @@ if (empty($reshook))
|
||||
$entrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int');
|
||||
if ($entrepot_id < 0) $entrepot_id='';
|
||||
if (! ($objectsrc->lines[$i]->fk_product > 0)) $entrepot_id = 0;
|
||||
|
||||
|
||||
$ret=$object->addline($entrepot_id, GETPOST($idl,'int'), GETPOST($qty,'int'), $array_options[$i]);
|
||||
if ($ret < 0)
|
||||
{
|
||||
@ -367,7 +367,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// batch mode
|
||||
if ($batch_line[$i]['qty']>0)
|
||||
{
|
||||
@ -379,11 +379,11 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$ret=$object->create($user); // This create shipment (like Odoo picking) and line of shipments. Stock movement will when validating shipment.
|
||||
@ -437,9 +437,9 @@ if (empty($reshook))
|
||||
)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
|
||||
$result = $object->valid($user);
|
||||
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -632,7 +632,7 @@ if ($action == 'create2')
|
||||
$action=''; $id=''; $ref='';
|
||||
}
|
||||
|
||||
// Mode creation.
|
||||
// Mode creation.
|
||||
if ($action == 'create')
|
||||
{
|
||||
$expe = new Expedition($db);
|
||||
@ -756,15 +756,15 @@ if ($action == 'create')
|
||||
print '<td colspan="3">';
|
||||
print '<input name="tracking_number" size="20" value="'.GETPOST('tracking_number','alpha').'">';
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$expe,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
|
||||
print $expe->showOptionals($extrafields, 'edit');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
@ -786,12 +786,12 @@ if ($action == 'create')
|
||||
print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
// Shipment lines
|
||||
|
||||
$numAsked = count($object->lines);
|
||||
@ -819,14 +819,14 @@ if ($action == 'create')
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
// Load shipments already done for same order
|
||||
$object->loadExpeditions();
|
||||
|
||||
|
||||
if ($numAsked)
|
||||
{
|
||||
print '<tr class="liste_titre">';
|
||||
@ -834,7 +834,7 @@ if ($action == 'create')
|
||||
print '<td align="center">'.$langs->trans("QtyOrdered").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyShipped").'</td>';
|
||||
print '<td align="center">'.$langs->trans("QtyToShip");
|
||||
if (empty($conf->productbatch->enabled))
|
||||
if (empty($conf->productbatch->enabled))
|
||||
{
|
||||
print ' <br>(<a href="#" id="autofill">'.$langs->trans("Fill").'</a>';
|
||||
print ' / <a href="#" id="autoreset">'.$langs->trans("Reset").'</a>)';
|
||||
@ -871,7 +871,7 @@ if ($action == 'create')
|
||||
if (! empty($line->date_end)) $type=1;
|
||||
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
|
||||
// Product label
|
||||
if ($line->fk_product > 0) // If predefined product
|
||||
{
|
||||
@ -899,7 +899,7 @@ if ($action == 'create')
|
||||
{
|
||||
print ($line->desc && $line->desc!=$line->product_label)?'<br>'.dol_htmlentitiesbr($line->desc):'';
|
||||
}
|
||||
|
||||
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
@ -944,7 +944,7 @@ if ($action == 'create')
|
||||
$quantityToBeDelivered = $quantityAsked - $quantityDelivered;
|
||||
}
|
||||
$warehouse_id = GETPOST('entrepot_id','int');
|
||||
|
||||
|
||||
$warehouseObject = null;
|
||||
if ($warehouse_id > 0 || ! ($line->fk_product > 0) || empty($conf->stock->enabled)) // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection
|
||||
{
|
||||
@ -1026,10 +1026,10 @@ if ($action == 'create')
|
||||
{
|
||||
// Product need lot
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
|
||||
|
||||
|
||||
$staticwarehouse=new Entrepot($db);
|
||||
if ($warehouse_id > 0) $staticwarehouse->fetch($warehouse_id);
|
||||
|
||||
|
||||
$subj=0;
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
@ -1052,11 +1052,11 @@ if ($action == 'create')
|
||||
print '<td colspan="3" ></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="left">';
|
||||
|
||||
|
||||
print $staticwarehouse->getNomUrl(0).' / ';
|
||||
|
||||
|
||||
print '<!-- Show details of lot -->';
|
||||
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
|
||||
print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
@ -1075,28 +1075,28 @@ if ($action == 'create')
|
||||
print '<tr '.$bc[$var].'><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 '</td>';
|
||||
|
||||
|
||||
print '<td align="left">';
|
||||
print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $staticwarehouse->libelle);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// ship from multiple locations
|
||||
if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
|
||||
{
|
||||
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
|
||||
print '<!-- Case warehouse not already known and product does not need lot -->';
|
||||
|
||||
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
$subj=0;
|
||||
// Define nb of lines suggested for this order line
|
||||
$nbofsuggested=0;
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
if ($stock_warehouse->real > 0)
|
||||
if ($stock_warehouse->real > 0)
|
||||
{
|
||||
$nbofsuggested++;
|
||||
}
|
||||
@ -1105,7 +1105,7 @@ if ($action == 'create')
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
if ($stock_warehouse->real > 0)
|
||||
if ($stock_warehouse->real > 0)
|
||||
{
|
||||
$stock = + $stock_warehouse->real; // Convert it to number
|
||||
$deliverableQty = min($quantityToBeDelivered,$stock);
|
||||
@ -1120,7 +1120,7 @@ if ($action == 'create')
|
||||
}
|
||||
else print $langs->trans("NA");
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Stock
|
||||
if (! empty($conf->stock->enabled))
|
||||
{
|
||||
@ -1128,10 +1128,10 @@ if ($action == 'create')
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
print $warehouseObject->getNomUrl(0).' ';
|
||||
|
||||
|
||||
print '<!-- Show details of stock -->';
|
||||
print '('.$stock.')';
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1179,7 +1179,7 @@ if ($action == 'create')
|
||||
|
||||
$subj=0;
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
|
||||
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$productlotObject=new Productlot($db);
|
||||
// Define nb of lines suggested for this order line
|
||||
@ -1193,7 +1193,7 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
foreach ($product->stock_warehouse as $warehouse_id=>$stock_warehouse)
|
||||
{
|
||||
$warehouseObject->fetch($warehouse_id);
|
||||
if (($stock_warehouse->real > 0) && (count($stock_warehouse->detail_batch))) {
|
||||
@ -1205,11 +1205,11 @@ if ($action == 'create')
|
||||
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">';
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="left">';
|
||||
|
||||
|
||||
print $warehouseObject->getNomUrl(0).' / ';
|
||||
|
||||
|
||||
print '<!-- Show details of lot -->';
|
||||
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
|
||||
//print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
|
||||
@ -1247,12 +1247,12 @@ if ($action == 'create')
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
print '<td align="left">';
|
||||
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
$warehouse_selected_id = GETPOST('entrepot_id','int');
|
||||
if ($warehouse_selected_id > 0)
|
||||
$warehouse_selected_id = GETPOST('entrepot_id','int');
|
||||
if ($warehouse_selected_id > 0)
|
||||
{
|
||||
$warehouseObject=new Entrepot($db);
|
||||
$warehouseObject->fetch($warehouse_selected_id);
|
||||
@ -1272,10 +1272,10 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Display lines extrafields
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0)
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0)
|
||||
{
|
||||
$colspan=5;
|
||||
$line = new ExpeditionLigne($db);
|
||||
@ -1325,14 +1325,14 @@ else if ($id || $ref)
|
||||
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($object->socid);
|
||||
|
||||
|
||||
$res = $object->fetch_optionals($object->id, $extralabels);
|
||||
|
||||
$head=shipping_prepare_head($object);
|
||||
dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending');
|
||||
|
||||
$formconfirm='';
|
||||
|
||||
|
||||
// Confirm deleteion
|
||||
if ($action == 'delete')
|
||||
{
|
||||
@ -1378,18 +1378,18 @@ else if ($id || $ref)
|
||||
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
|
||||
}
|
||||
|
||||
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
|
||||
|
||||
// Calculate totalWeight and totalVolume for all products
|
||||
// by adding weight and volume of each product line.
|
||||
$tmparray=$object->getTotalWeightVolume();
|
||||
$totalWeight=$tmparray['weight'];
|
||||
$totalVolume=$tmparray['volume'];
|
||||
|
||||
|
||||
|
||||
|
||||
if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled))
|
||||
{
|
||||
$objectsrc=new Commande($db);
|
||||
@ -1444,15 +1444,15 @@ else if ($id || $ref)
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Linked documents
|
||||
@ -1535,7 +1535,7 @@ else if ($id || $ref)
|
||||
if (!empty($object->trueWeight)) print ' ('.$langs->trans("SumOfProductWeights").': ';
|
||||
//print $totalWeight.' '.measuring_units_string(0,"weight");
|
||||
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
|
||||
//if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')';
|
||||
//if (empty($object->trueWeight)) print ' ('.$langs->trans("Calculated").')';
|
||||
if (!empty($object->trueWeight)) print ')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
@ -1582,7 +1582,7 @@ else if ($id || $ref)
|
||||
print '<td colspan="3">';
|
||||
$calculatedVolume=0;
|
||||
$volumeUnit=0;
|
||||
if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
|
||||
if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
|
||||
{
|
||||
$calculatedVolume=($object->trueWidth * $object->trueHeight * $object->trueDepth);
|
||||
$volumeUnit=$object->size_units * 3;
|
||||
@ -1590,7 +1590,7 @@ else if ($id || $ref)
|
||||
// If sending volume not defined we use sum of products
|
||||
if ($calculatedVolume > 0)
|
||||
{
|
||||
if ($volumeUnit < 50)
|
||||
if ($volumeUnit < 50)
|
||||
{
|
||||
//print $calculatedVolume.' '.measuring_units_string($volumeUnit,"volume");
|
||||
print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
|
||||
@ -1611,14 +1611,14 @@ else if ($id || $ref)
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Sending method
|
||||
@ -1652,7 +1652,7 @@ else if ($id || $ref)
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Tracking Number
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("TrackingNumber",'trackingnumber',$object->tracking_number,$object,$user->rights->expedition->creer).'</td><td colspan="3">';
|
||||
print $form->editfieldval("TrackingNumber",'trackingnumber',$object->tracking_url,$object,$user->rights->expedition->creer,'string',$object->tracking_number);
|
||||
@ -1682,19 +1682,19 @@ else if ($id || $ref)
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Lines of products
|
||||
*/
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -1717,7 +1717,7 @@ else if ($id || $ref)
|
||||
{
|
||||
print '<td align="center">'.$langs->trans("QtyInOtherShipments").'</td>';
|
||||
}
|
||||
|
||||
|
||||
print '<td align="center">'.$langs->trans("CalculatedWeight").'</td>';
|
||||
print '<td align="center">'.$langs->trans("CalculatedVolume").'</td>';
|
||||
//print '<td align="center">'.$langs->trans("Size").'</td>';
|
||||
@ -1778,7 +1778,7 @@ else if ($id || $ref)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
|
||||
while($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -1885,7 +1885,7 @@ else if ($id || $ref)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Weight
|
||||
@ -1945,7 +1945,7 @@ else if ($id || $ref)
|
||||
}
|
||||
print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
@ -1955,7 +1955,7 @@ else if ($id || $ref)
|
||||
}
|
||||
}
|
||||
print "</tr>";
|
||||
|
||||
|
||||
// Display lines extrafields
|
||||
if (is_array($extralabelslines) && count($extralabelslines)>0) {
|
||||
$colspan= empty($conf->productbatch->enabled) ? 5 : 6;
|
||||
@ -1968,9 +1968,9 @@ else if ($id || $ref)
|
||||
|
||||
$var=!$var;
|
||||
}
|
||||
|
||||
|
||||
// TODO Show also lines ordered but not delivered
|
||||
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
}
|
||||
@ -1981,7 +1981,7 @@ else if ($id || $ref)
|
||||
|
||||
$object->fetchObjectLinked($object->id,$object->element);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
@ -2008,14 +2008,14 @@ else if ($id || $ref)
|
||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Validate").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO add alternative status
|
||||
// 0=draft, 1=validated, 2=billed, we miss a status "delivered" (only available on order)
|
||||
if ($object->statut == 2 && $object->billed && $user->rights->expedition->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
|
||||
|
||||
// Send
|
||||
if ($object->statut > 0)
|
||||
{
|
||||
@ -2025,16 +2025,18 @@ else if ($id || $ref)
|
||||
}
|
||||
else print '<a class="butActionRefused" href="#">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
|
||||
// Create bill and Close shipment
|
||||
|
||||
// Create bill
|
||||
if (! empty($conf->facture->enabled) && $object->statut > 0)
|
||||
{
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
// TODO show button only if (! empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))
|
||||
// If we do that, we must also make this option official.
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is just to generate a delivery receipt
|
||||
//var_dump($object->linkedObjectsIds['delivery']);
|
||||
if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && count($object->linkedObjectsIds['delivery']) == 0)
|
||||
@ -2056,14 +2058,14 @@ else if ($id || $ref)
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action='.$paramaction.'">'.$langs->trans($label).'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($user->rights->expedition->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -2071,11 +2073,11 @@ else if ($id || $ref)
|
||||
/*
|
||||
* Documents generated
|
||||
*/
|
||||
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->expedition->dir_output . "/sending/" .$objectref;
|
||||
|
||||
@ -2086,12 +2088,12 @@ else if ($id || $ref)
|
||||
|
||||
print $formfile->showdocuments('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||
|
||||
|
||||
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
@ -2102,11 +2104,11 @@ else if ($id || $ref)
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*/
|
||||
|
||||
|
||||
//Select mail models is same action as presend
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
@ -2167,7 +2169,7 @@ else if ($id || $ref)
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'shi'.$object->id);
|
||||
}
|
||||
}
|
||||
$formmail->withfrom=1;
|
||||
$liste=array();
|
||||
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key=>$value) $liste[$key]=$value;
|
||||
@ -2200,7 +2202,7 @@ else if ($id || $ref)
|
||||
{
|
||||
$contactarr=$objectsrc->liste_contact(-1,'external');
|
||||
}
|
||||
|
||||
|
||||
if (is_array($contactarr) && count($contactarr)>0) {
|
||||
foreach($contactarr as $contact) {
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user