NEW note, contact and lines on card

This commit is contained in:
atm-quentin 2018-10-08 16:54:33 +02:00
parent 095d851e79
commit c6ab79bad3
9 changed files with 195 additions and 290 deletions

View File

@ -962,6 +962,9 @@ abstract class CommonObject
if($this->element=='shipping' && $this->origin_id != 0) { if($this->element=='shipping' && $this->origin_id != 0) {
$id=$this->origin_id; $id=$this->origin_id;
$element='commande'; $element='commande';
} else if($this->element=='reception' && $this->origin_id != 0) {
$id=$this->origin_id;
$element='order_supplier';
} else { } else {
$id=$this->id; $id=$this->id;
$element=$this->element; $element=$this->element;
@ -982,7 +985,7 @@ abstract class CommonObject
$sql.= " AND tc.code = '".$code."'"; $sql.= " AND tc.code = '".$code."'";
$sql.= " AND tc.active = 1"; $sql.= " AND tc.active = 1";
if ($status) $sql.= " AND ec.statut = ".$status; if ($status) $sql.= " AND ec.statut = ".$status;
dol_syslog(get_class($this)."::getIdContact", LOG_DEBUG); dol_syslog(get_class($this)."::getIdContact", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
@ -998,7 +1001,6 @@ abstract class CommonObject
$this->error=$this->db->error(); $this->error=$this->db->error();
return null; return null;
} }
return $result; return $result;
} }
@ -1193,6 +1195,7 @@ abstract class CommonObject
{ {
if ($this->origin == 'shipping') $this->origin = 'expedition'; if ($this->origin == 'shipping') $this->origin = 'expedition';
if ($this->origin == 'delivery') $this->origin = 'livraison'; if ($this->origin == 'delivery') $this->origin = 'livraison';
if ($this->origin == 'order_supplier') $this->origin = 'commandeFournisseur';
$origin = $this->origin; $origin = $this->origin;
@ -3105,9 +3108,13 @@ abstract class CommonObject
{ {
if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is '' if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is ''
$totalToShip+=$line->qty_shipped; // defined for shipment only $totalToShip+=$line->qty_shipped; // defined for shipment only
}else if ($line->element == 'commandefournisseurdispatch' && isset($line->qty))
{
if (empty($totalToShip)) $totalToShip=0;
$totalToShip+=$line->qty; // defined for reception only
} }
// Define qty, weight, volume, weight_units, volume_units // Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') { if ($this->element == 'shipping') {
// for shipments // for shipments
$qty = $line->qty_shipped ? $line->qty_shipped : 0; $qty = $line->qty_shipped ? $line->qty_shipped : 0;

View File

@ -3932,10 +3932,10 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
$dimension = $dimension / 1000; $dimension = $dimension / 1000;
$unit = $unit + 3; $unit = $unit + 3;
} }
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type); $ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
return $ret; return $ret;
} }

View File

@ -126,7 +126,7 @@ class pdf_squille extends ModelePdfReception
$outputlangs->load("products"); $outputlangs->load("products");
$outputlangs->load("propal"); $outputlangs->load("propal");
$outputlangs->load("deliveries"); $outputlangs->load("deliveries");
$outputlangs->load("sendings"); $outputlangs->load("receptions");
$outputlangs->load("productbatch"); $outputlangs->load("productbatch");
$nblignes = count($object->lines); $nblignes = count($object->lines);
@ -182,13 +182,13 @@ class pdf_squille extends ModelePdfReception
// Definition de $dir et $file // Definition de $dir et $file
if ($object->specimen) if ($object->specimen)
{ {
$dir = $conf->reception->dir_output."/sending"; $dir = $conf->reception->dir_output;
$file = $dir . "/SPECIMEN.pdf"; $file = $dir . "/SPECIMEN.pdf";
} }
else else
{ {
$expref = dol_sanitizeFileName($object->ref); $expref = dol_sanitizeFileName($object->ref);
$dir = $conf->reception->dir_output."/sending/" . $expref; $dir = $conf->reception->dir_output."/" . $expref;
$file = $dir . "/" . $expref . ".pdf"; $file = $dir . "/" . $expref . ".pdf";
} }
@ -309,10 +309,10 @@ class pdf_squille extends ModelePdfReception
if ($object->reception_method_id > 0) if ($object->reception_method_id > 0)
{ {
// Get code using getLabelFromKey // Get code using getLabelFromKey
$code=$outputlangs->getLabelFromKey($this->db,$object->reception_method_id,'c_shipment_mode','rowid','code'); $code=$outputlangs->getLabelFromKey($this->db,$object->shipment_method_id,'c_shipment_mode','rowid','code');
$label=''; $label='';
if ($object->tracking_url != $object->tracking_number) $label.=$outputlangs->trans("LinkToTrackYourPackage")."<br>"; if ($object->tracking_url != $object->tracking_number) $label.=$outputlangs->trans("LinkToTrackYourPackage")."<br>";
$label.=$outputlangs->trans("SendingMethod").": ".$outputlangs->trans("SendingMethod".strtoupper($code)); $label.=$outputlangs->trans("ReceptionMethod").": ".$outputlangs->trans("ReceptionMethod".strtoupper($code));
//var_dump($object->tracking_url != $object->tracking_number);exit; //var_dump($object->tracking_url != $object->tracking_number);exit;
if ($object->tracking_url != $object->tracking_number) if ($object->tracking_url != $object->tracking_number)
{ {
@ -405,6 +405,7 @@ class pdf_squille extends ModelePdfReception
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
$pageposafter=$pdf->getPage(); $pageposafter=$pdf->getPage();
@ -453,14 +454,14 @@ class pdf_squille extends ModelePdfReception
$pdf->SetXY($this->posxweightvol, $curY); $pdf->SetXY($this->posxweightvol, $curY);
$weighttxt=''; $weighttxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->weight) if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->weight)
{ {
$weighttxt=round($object->lines[$i]->weight * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->weight_units,"weight"); $weighttxt=round($object->lines[$i]->product->weight * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->weight_units,"weight");
} }
$voltxt=''; $voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume) if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->product->volume)
{ {
$voltxt=round($object->lines[$i]->volume * $object->lines[$i]->qty_shipped, 5).' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0,"volume"); $voltxt=round($object->lines[$i]->product->volume * $object->lines[$i]->qty, 5).' '.measuring_units_string($object->lines[$i]->product->volume_units?$object->lines[$i]->product->volume_units:0,"volume");
} }
$pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C'); $pdf->writeHTMLCell($this->posxqtyordered - $this->posxweightvol + 2, 3, $this->posxweightvol - 1, $curY, $weighttxt.(($weighttxt && $voltxt)?'<br>':'').$voltxt, 0, 0, false, true, 'C');
@ -473,7 +474,7 @@ class pdf_squille extends ModelePdfReception
} }
$pdf->SetXY($this->posxqtytoship, $curY); $pdf->SetXY($this->posxqtytoship, $curY);
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty_shipped,'','C'); $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 3, $object->lines[$i]->qty,'','C');
if(!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) if(!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT))
{ {
@ -622,18 +623,20 @@ class pdf_squille extends ModelePdfReception
$totalVolume=$tmparray['volume']; $totalVolume=$tmparray['volume'];
$totalOrdered=$tmparray['ordered']; $totalOrdered=$tmparray['ordered'];
$totalToShip=$tmparray['toship']; $totalToShip=$tmparray['toship'];
// Set trueVolume and volume_units not currently stored into database // Set trueVolume and volume_units not currently stored into database
if ($object->trueWidth && $object->trueHeight && $object->trueDepth) if ($object->trueWidth && $object->trueHeight && $object->trueDepth)
{ {
$object->trueVolume=price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0); $object->trueVolume=price(($object->trueWidth * $object->trueHeight * $object->trueDepth), 0, $outputlangs, 0, 0);
$object->volume_units=$object->size_units * 3; $object->volume_units=$object->size_units * 3;
} }
if ($totalWeight!='') $totalWeighttoshow=showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs); if ($totalWeight!='') $totalWeighttoshow=showDimensionInBestUnit($totalWeight, 0, "weight", $outputlangs);
if ($totalVolume!='') $totalVolumetoshow=showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs); if ($totalVolume!='') $totalVolumetoshow=showDimensionInBestUnit($totalVolume, 0, "volume", $outputlangs);
if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs); if ($object->trueWeight) $totalWeighttoshow=showDimensionInBestUnit($object->trueWeight, $object->weight_units, "weight", $outputlangs);
if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs); if ($object->trueVolume) $totalVolumetoshow=showDimensionInBestUnit($object->trueVolume, $object->volume_units, "volume", $outputlangs);
$pdf->SetFillColor(255,255,255); $pdf->SetFillColor(255,255,255);
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("Total"), 0, 'L', 1);
@ -740,7 +743,7 @@ class pdf_squille extends ModelePdfReception
if (empty($hidetop)) if (empty($hidetop))
{ {
$pdf->SetXY($this->posxqtytoship, $tab_top+1); $pdf->SetXY($this->posxqtytoship, $tab_top+1);
$pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToShip"),'','C'); $pdf->MultiCell(($this->posxpuht - $this->posxqtytoship), 2, $outputlangs->transnoentities("QtyToReceive"),'','C');
} }
if(!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) { if(!empty($conf->global->MAIN_PDF_RECEPTION_DISPLAY_AMOUNT_HT)) {
@ -834,7 +837,7 @@ class pdf_squille extends ModelePdfReception
//$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
if (! empty($conf->barcode->enabled)) if (! empty($conf->barcode->enabled))
{ {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref // TODO Build code bar with function writeBarCode of barcode module for reception ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24); //$pdf->Image($logo,10, 5, 0, 24);
} }
@ -842,7 +845,7 @@ class pdf_squille extends ModelePdfReception
$pdf->SetDrawColor(128,128,128); $pdf->SetDrawColor(128,128,128);
if (! empty($conf->barcode->enabled)) if (! empty($conf->barcode->enabled))
{ {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref // TODO Build code bar with function writeBarCode of barcode module for reception ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3); //$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24); //$pdf->Image($logo,10, 5, 0, 24);
} }
@ -854,7 +857,7 @@ class pdf_squille extends ModelePdfReception
$pdf->SetFont('','B', $default_font_size + 2); $pdf->SetFont('','B', $default_font_size + 2);
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$title=$outputlangs->transnoentities("SendingSheet"); $title=$outputlangs->transnoentities("ReceptionSheet");
$pdf->MultiCell($w, 4, $title, '', 'R'); $pdf->MultiCell($w, 4, $title, '', 'R');
$pdf->SetFont('','', $default_font_size + 1); $pdf->SetFont('','', $default_font_size + 1);
@ -863,7 +866,7 @@ class pdf_squille extends ModelePdfReception
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefSending") ." : ".$object->ref, '', 'R'); $pdf->MultiCell($w, 4, $outputlangs->transnoentities("RefReception") ." : ".$object->ref, '', 'R');
// Date planned delivery // Date planned delivery
if (! empty($object->date_delivery)) if (! empty($object->date_delivery))
@ -874,12 +877,12 @@ class pdf_squille extends ModelePdfReception
$pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R'); $pdf->MultiCell($w, 4, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_delivery,"day",false,$outputlangs,true), '', 'R');
} }
if (! empty($object->thirdparty->code_client)) if (! empty($object->thirdparty->code_fournisseur))
{ {
$posy+=4; $posy+=4;
$pdf->SetXY($posx,$posy); $pdf->SetXY($posx,$posy);
$pdf->SetTextColor(0,0,60); $pdf->SetTextColor(0,0,60);
$pdf->MultiCell($w, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("SupplierCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_fournisseur), '', 'R');
} }
@ -891,11 +894,11 @@ class pdf_squille extends ModelePdfReception
$origin_id = $object->origin_id; $origin_id = $object->origin_id;
// TODO move to external function // TODO move to external function
if (! empty($conf->$origin->enabled)) // commonly $origin='commande' if (! empty($conf->fournisseur->enabled)) // commonly $origin='commande'
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
$classname = ucfirst($origin); $classname = 'CommandeFournisseur';
$linkedobject = new $classname($this->db); $linkedobject = new $classname($this->db);
$result=$linkedobject->fetch($origin_id); $result=$linkedobject->fetch($origin_id);
if ($result >= 0) if ($result >= 0)
@ -962,7 +965,8 @@ class pdf_squille extends ModelePdfReception
// If RECEPTION contact defined, we use it // If RECEPTION contact defined, we use it
$usecontact=false; $usecontact=false;
$arrayidcontact=$object->$origin->getIdContact('external','RECEPTION'); $arrayidcontact=$object->$origin->getIdContact('external','SHIPPING');
if (count($arrayidcontact) > 0) if (count($arrayidcontact) > 0)
{ {
$usecontact=true; $usecontact=true;

View File

@ -34,6 +34,7 @@ elseif ($module == 'order_supplier') { $permission=$user->rights->fournisseur->c
elseif ($module == 'project') { $permission=$user->rights->projet->creer; } elseif ($module == 'project') { $permission=$user->rights->projet->creer; }
elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; } elseif ($module == 'action') { $permission=$user->rights->agenda->myactions->create; }
elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; } elseif ($module == 'shipping') { $permission=$user->rights->expedition->creer; }
elseif ($module == 'reception') { $permission=$user->rights->reception->creer; }
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; } elseif ($module == 'project_task') { $permission=$user->rights->projet->creer; }
elseif (! isset($permission) && isset($user->rights->$module->creer)) elseif (! isset($permission) && isset($user->rights->$module->creer))
{ {
@ -86,7 +87,7 @@ if ($permission) {
<div class="tagtd maxwidthonsmartphone"> <div class="tagtd maxwidthonsmartphone">
<?php <?php
$tmpobject=$object; $tmpobject=$object;
if ($object->element == 'shipping' && is_object($objectsrc)) $tmpobject=$objectsrc; if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal'); echo $formcompany->selectTypeContact($tmpobject, '', 'type','internal');
?></div> ?></div>
<div class="tagtd">&nbsp;</div> <div class="tagtd">&nbsp;</div>
@ -125,7 +126,7 @@ if ($permission) {
<div class="tagtd maxwidthonsmartphone noborderbottom"> <div class="tagtd maxwidthonsmartphone noborderbottom">
<?php <?php
$tmpobject=$object; $tmpobject=$object;
if ($object->element == 'shipping' && is_object($objectsrc)) $tmpobject=$objectsrc; if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
$formcompany->selectTypeContact($tmpobject, '', 'type','external'); ?> $formcompany->selectTypeContact($tmpobject, '', 'type','external'); ?>
</div> </div>
<div class="tagtd noborderbottom">&nbsp;</div> <div class="tagtd noborderbottom">&nbsp;</div>
@ -155,7 +156,7 @@ if ($permission) {
foreach($arrayofsource as $source) { foreach($arrayofsource as $source) {
$tmpobject=$object; $tmpobject=$object;
if ($object->element == 'shipping' && is_object($objectsrc)) $tmpobject=$objectsrc; if (($object->element == 'shipping'|| $object->element == 'reception') && is_object($objectsrc)) $tmpobject=$objectsrc;
$tab = $tmpobject->liste_contact(-1,$source); $tab = $tmpobject->liste_contact(-1,$source);
$num=count($tab); $num=count($tab);

View File

@ -333,16 +333,23 @@ class CommandeFournisseurDispatch extends CommonObject
if (! $error) if (! $error)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
if(empty($this->id) && !empty($this->rowid))$this->id=$this->rowid;
$result=$this->insertExtraFields();
if ($result < 0)
{
$error++;
}
}
if (! $notrigger) if (! $notrigger)
{ {
// Uncomment this and change MYOBJECT to your own tag if you // Call trigger
// want this action calls a trigger. $result=$this->call_trigger('LINERECEPTION_UPDATE',$user);
if ($result < 0) $error++;
//// Call triggers // End call triggers
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user); }
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
//// End call triggers
}
} }
// Commit or rollback // Commit or rollback

View File

@ -166,17 +166,17 @@ if (empty($reshook))
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
} }
if ($action == 'setref_customer') if ($action == 'setref_supplier')
{ {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
$result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'RECEPTION_MODIFY'); $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier','alpha'), '', null, 'text', '', $user, 'RECEPTION_MODIFY');
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = 'editref_customer'; $action = 'editref_supplier';
} else { } else {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit; exit;
@ -622,202 +622,77 @@ if (empty($reshook))
else if ($action == 'updateline' && $user->rights->reception->creer && GETPOST('save')) else if ($action == 'updateline' && $user->rights->reception->creer && GETPOST('save'))
{ {
// Clean parameters // Clean parameters
$qty=0; $qty = 0;
$entrepot_id = 0; $entrepot_id = 0;
$batch_id = 0; $batch_id = 0;
$lines = $object->lines; $lines = $object->lines;
$num_prod = count($lines); $num_prod = count($lines);
for ($i = 0 ; $i < $num_prod ; $i++) for ($i = 0; $i < $num_prod; $i++)
{ {
if ($lines[$i]->id == $line_id) // we have found line to update if ($lines[$i]->id == $line_id) // we have found line to update
{ {
$line = new CommandeFournisseurDispatch($db); $line = new CommandeFournisseurDispatch($db);
$line->fetch($line_id);
// Extrafields Lines // Extrafields Lines
$extrafieldsline = new ExtraFields($db); $extrafieldsline = new ExtraFields($db);
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line); $extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
$line->array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline); $line->array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield POST Data
if (is_array($extralabelsline)) {
foreach ($extralabelsline as $key => $value) {
unset($_POST["options_" . $key]);
}
}
$line->fk_product = $lines[$i]->fk_product; $line->fk_product = $lines[$i]->fk_product;
if (is_array($lines[$i]->detail_batch) && count($lines[$i]->detail_batch) > 0)
if ($lines[$i]->fk_product > 0)
{ {
// line with lot
foreach ($lines[$i]->detail_batch as $detail_batch) // single warehouse reception line
{ $stockLocation = "entl".$line_id;
$lotStock = new Productbatch($db); $qty = "qtyl".$line_id;
$batch="batchl".$detail_batch->fk_receptiondet."_".$detail_batch->fk_origin_stock;
$qty = "qtyl".$detail_batch->fk_receptiondet.'_'.$detail_batch->id;
$batch_id = GETPOST($batch,'int'); $line->id = $line_id;
$batch_qty = GETPOST($qty, 'int'); $line->fk_entrepot = GETPOST($stockLocation, 'int');
if (! empty($batch_id) && ($batch_id != $detail_batch->fk_origin_stock || $batch_qty != $detail_batch->dluo_qty)) $line->qty = GETPOST($qty, 'int');
{
if ($lotStock->fetch($batch_id) > 0 && $line->fetch($detail_batch->fk_receptiondet) > 0) // $line is ReceptionLine if(!empty($conf->productbatch->enabled)){
{ $batch = "batch".$line_id;
if ($lines[$i]->entrepot_id != 0) $dlc = "dlc".$line_id;
{ $dluo = "dluo".$line_id;
// allow update line entrepot_id if not multi warehouse reception $eatby = GETPOST($dlc, 'alpha');
$line->entrepot_id = $lotStock->warehouseid; $eatbydate = str_replace('/','-',$eatby);
} $sellby = GETPOST($dluo, 'alpha');
$sellbydate = str_replace('/','-',$sellby);
// detail_batch can be an object with keys, or an array of ReceptionLineBatch $line->batch = GETPOST($batch, 'alpha');
if (empty($line->detail_batch)) $line->detail_batch=new stdClass(); $line->eatby = strtotime($eatbydate);
$line->sellby = strtotime($sellbydate);
$line->detail_batch->fk_origin_stock = $batch_id;
$line->detail_batch->batch = $lotStock->batch;
$line->detail_batch->id = $detail_batch->id;
$line->detail_batch->entrepot_id = $lotStock->warehouseid;
$line->detail_batch->dluo_qty = $batch_qty;
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
}
else
{
setEventMessages($lotStock->error, $lotStock->errors, 'errors');
$error++;
}
}
unset($_POST[$batch]);
unset($_POST[$qty]);
} }
// add new batch
$lotStock = new Productbatch($db);
$batch="batchl".$line_id."_0";
$qty = "qtyl".$line_id."_0"; if ($line->update($user) < 0)
$batch_id = GETPOST($batch,'int');
$batch_qty = GETPOST($qty, 'int');
$lineIdToAddLot = 0;
if ($batch_qty > 0 && ! empty($batch_id))
{ {
if ($lotStock->fetch($batch_id) > 0) setEventMessages($line->error, $line->errors, 'errors');
{ $error++;
// check if lotStock warehouse id is same as line warehouse id
if ($lines[$i]->entrepot_id > 0)
{
// single warehouse reception line
if ($lines[i]->entrepot_id == $lotStock->warehouseid)
{
$lineIdToAddLot = $line_id;
}
}
else if (count($lines[$i]->details_entrepot) > 1)
{
// multi warehouse reception lines
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
{
if ($detail_entrepot->entrepot_id == $lotStock->warehouseid)
{
$lineIdToAddLot = $detail_entrepot->line_id;
}
}
}
if ($lineIdToAddLot)
{
// add lot to existing line
if ($line->fetch($lineIdToAddLot) > 0)
{
$line->detail_batch->fk_origin_stock = $batch_id;
$line->detail_batch->batch = $lotStock->batch;
$line->detail_batch->entrepot_id = $lotStock->warehouseid;
$line->detail_batch->dluo_qty = $batch_qty;
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
}
else
{
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
}
else
{
// create new line with new lot
$line->origin_line_id = $lines[$i]->origin_line_id;
$line->entrepot_id = $lotStock->warehouseid;
$line->detail_batch[0] = new ReceptionLineBatch($db);
$line->detail_batch[0]->fk_origin_stock = $batch_id;
$line->detail_batch[0]->batch = $lotStock->batch;
$line->detail_batch[0]->entrepot_id = $lotStock->warehouseid;
$line->detail_batch[0]->dluo_qty = $batch_qty;
if ($object->create_line_batch($line, $line->array_options) < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$error++;
}
}
}
else
{
setEventMessages($lotStock->error, $lotStock->errors, 'errors');
$error++;
}
} }
} }
else else // Product no predefined
{ {
if ($lines[$i]->fk_product > 0) $qty = "qtyl".$line_id;
$line->id = $line_id;
$line->qty = GETPOST($qty, 'int');
$line->fk_entrepot = 0;
if ($line->update($user) < 0)
{ {
// line without lot setEventMessages($line->error, $line->errors, 'errors');
if ($lines[$i]->entrepot_id > 0) $error++;
{
// single warehouse reception line
$stockLocation="entl".$line_id;
$qty = "qtyl".$line_id;
$line->id = $line_id;
$line->entrepot_id = GETPOST($stockLocation,'int');
$line->qty = GETPOST($qty, 'int');
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
unset($_POST[$stockLocation]);
unset($_POST[$qty]);
}
else if (count($lines[$i]->details_entrepot) > 1)
{
// multi warehouse reception lines
foreach ($lines[$i]->details_entrepot as $detail_entrepot)
{
if (! $error) {
$stockLocation="entl".$detail_entrepot->line_id;
$qty = "qtyl".$detail_entrepot->line_id;
$warehouse = GETPOST($stockLocation,'int');
if (!empty ($warehouse))
{
$line->id = $detail_entrepot->line_id;
$line->entrepot_id = $warehouse;
$line->qty = GETPOST($qty, 'int');
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
}
unset($_POST[$stockLocation]);
unset($_POST[$qty]);
}
}
}
}
else // Product no predefined
{
$qty = "qtyl".$line_id;
$line->id = $line_id;
$line->qty = GETPOST($qty, 'int');
$line->entrepot_id = 0;
if ($line->update($user) < 0) {
setEventMessages($line->error, $line->errors, 'errors');
$error++;
}
unset($_POST[$qty]);
} }
unset($_POST[$qty]);
} }
} }
} }
@ -1953,7 +1828,7 @@ else if ($id || $ref)
if ($obj) if ($obj)
{ {
// $obj->rowid is rowid in $origin."det" table // $obj->rowid is rowid in $origin."det" table
$alreadysent[$obj->rowid][$obj->receptionline_id]=array('reception_ref'=>$obj->reception_ref, 'reception_id'=>$obj->reception_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty, 'date_valid'=>$obj->date_valid, 'date_delivery'=>$obj->date_delivery); $alreadysent[$obj->rowid][$obj->receptionline_id]=array('reception_ref'=>$obj->reception_ref, 'reception_id'=>$obj->reception_id, 'warehouse'=>$obj->fk_entrepot, 'qty'=>$obj->qty, 'date_valid'=>$obj->date_valid, 'date_delivery'=>$obj->date_delivery);
} }
$i++; $i++;
} }
@ -1981,20 +1856,16 @@ else if ($id || $ref)
{ {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($lines[$i]->fk_product); $prod->fetch($lines[$i]->fk_product);
$label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product->product_label; $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product->label;
} }
else else
$label = (! empty($lines[$i]->product->label)?$lines[$i]->product->label:$lines[$i]->product->product_label); $label = (! empty($lines[$i]->product->label)?$lines[$i]->product->label:$lines[$i]->product->product_label);
print '<td>'; print '<td>';
// Show product and description
$product_static->type=$lines[$i]->product->fk_product_type;
$product_static->id=$lines[$i]->product->fk_product;
$product_static->ref=$lines[$i]->product->ref;
$product_static->status_batch=$lines[$i]->product->product_tobatch;
$text=$product_static->getNomUrl(1);
$text=$lines[$i]->product->getNomUrl(1);
$text.= ' - '.$label; $text.= ' - '.$label;
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->product->description)); $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($lines[$i]->product->description));
print $form->textwithtooltip($text,$description,3,'','',$i); print $form->textwithtooltip($text,$description,3,'','',$i);
@ -2042,7 +1913,7 @@ else if ($id || $ref)
if ($j > 1) print '<br>'; if ($j > 1) print '<br>';
$reception_static->fetch($receptionline_var['reception_id']); $reception_static->fetch($receptionline_var['reception_id']);
print $reception_static->getNomUrl(1); print $reception_static->getNomUrl(1);
print ' - '.$receptionline_var['qty_shipped']; print ' - '.$receptionline_var['qty'];
$htmltext=$langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($receptionline_var['date_valid'], 'dayhour')); $htmltext=$langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($receptionline_var['date_valid'], 'dayhour'));
if (! empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) if (! empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0)
@ -2068,11 +1939,18 @@ else if ($id || $ref)
print '<!-- case edit 1 -->'; print '<!-- case edit 1 -->';
print '<tr>'; print '<tr>';
// Qty to ship or shipped // Qty to ship or shipped
print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">' . '</td>'; print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty.'">' . '</td>';
// Warehouse source // Warehouse source
print '<td>' . $formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). '</td>'; print '<td>' . $formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1). '</td>';
//@TODO Batch number managment // Batch number managment
if($conf->productbatch->enabled)print '<td> - ' . $langs->trans("NA") . '</td>'; if($conf->productbatch->enabled){
print '<td> <input name="batch'.$line_id.'" id="batch'.$line_id.'" type="text" value="'.$lines[$i]->batch.'"> </br>';
print $langs->trans('EatByDate').' : ';
print $form->select_date($lines[$i]->eatby,'dlc' .$line_id , '', '', 1, ""). '</br>';
print $langs->trans('SellByDate').' : ';
print $form->select_date($lines[$i]->sellby,'dluo' .$line_id , '', '', 1, "");
print '</td>';
}
print '</tr>'; print '</tr>';
} }
@ -2081,7 +1959,7 @@ else if ($id || $ref)
print '<!-- case edit 2 -->'; print '<!-- case edit 2 -->';
print '<tr>'; print '<tr>';
// Qty to ship or shipped // Qty to ship or shipped
print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty_shipped.'">' . '</td>'; print '<td>' . '<input name="qtyl'.$line_id.'" id="qtyl'.$line_id.'" type="text" size="4" value="'.$lines[$i]->qty.'">' . '</td>';
// Warehouse source // Warehouse source
print '<td>' . '</td>'; print '<td>' . '</td>';
// Batch number managment // Batch number managment
@ -2196,7 +2074,7 @@ else if ($id || $ref)
// Display lines extrafields // Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines)>0) { if (is_array($extralabelslines) && count($extralabelslines)>0) {
$colspan= empty($conf->productbatch->enabled) ? 5 : 6; $colspan= empty($conf->productbatch->enabled) ? 8 : 9;
$line = new CommandeFournisseurDispatch($db); $line = new CommandeFournisseurDispatch($db);
$line->fetch_optionals($lines[$i]->id,$extralabelslines); $line->fetch_optionals($lines[$i]->id,$extralabelslines);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -2339,7 +2217,7 @@ else if ($id || $ref)
$genallowed=$user->rights->reception->lire; $genallowed=$user->rights->reception->lire;
$delallowed=$user->rights->reception->creer; $delallowed=$user->rights->reception->creer;
print $formfile->showdocuments('reception',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang); print $formfile->showdocuments('reception',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
@ -2359,7 +2237,7 @@ else if ($id || $ref)
{ {
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->reception->dir_output . '/reception/' . $ref, preg_quote($ref, '/').'[^\-]+'); $fileparams = dol_most_recent_file($conf->reception->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file=$fileparams['fullname']; $file=$fileparams['fullname'];
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;

View File

@ -1194,18 +1194,22 @@ class Reception extends CommonObject
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id; $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id;
$resql = $db->query($sql); $resql = $db->query($sql);
if(!empty($resql)){ if(!empty($resql)){
$this->lines = array();
while ($obj = $resql->fetch_object()){ while ($obj = $resql->fetch_object()){
$line = new CommandeFournisseurDispatch($db); $line = new CommandeFournisseurDispatch($db);
$line->fetch($obj->rowid); $line->fetch($obj->rowid);
$line->fetch_product(); $line->fetch_product();
$sql_qtyasked = 'SELECT qty FROM llx_commande_fournisseurdet WHERE rowid='.$line->fk_commandefourndet; $sql_qtyasked = 'SELECT qty, description, label FROM llx_commande_fournisseurdet WHERE rowid='.$line->fk_commandefourndet;
$resql_qtyasked = $db->query($sql_qtyasked); $resql_qtyasked = $db->query($sql_qtyasked);
if(!empty($resql_qtyasked)){ if(!empty($resql_qtyasked)){
$obj = $db->fetch_object($resql_qtyasked); $obj = $db->fetch_object($resql_qtyasked);
$line->qty_asked = $obj->qty; $line->qty_asked = $obj->qty;
$line->description = $obj->description;
$line->label = $obj->label;
}else { }else {
$line->qty_asked = 0; $line->qty_asked = 0;
$line->description = '';
$line->label = $obj->label;
} }
$this->lines[]=$line; $this->lines[]=$line;
} }
@ -2059,7 +2063,7 @@ class Reception extends CommonObject
if (! dol_strlen($modele)) { if (! dol_strlen($modele)) {
$modele = 'rouget'; $modele = 'squille';
if ($this->modelpdf) { if ($this->modelpdf) {
$modele = $this->modelpdf; $modele = $this->modelpdf;
@ -2071,7 +2075,7 @@ class Reception extends CommonObject
$modelpath = "core/modules/reception/doc/"; $modelpath = "core/modules/reception/doc/";
$this->fetch_origin(); $this->fetch_origin();
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }

View File

@ -18,15 +18,16 @@
*/ */
/** /**
* \file htdocs/expedition/contact.php * \file htdocs/reception/contact.php
* \ingroup expedition * \ingroup reception
* \brief Onglet de gestion des contacts de expedition * \brief Onglet de gestion des contacts de reception
*/ */
require '../main.inc.php'; 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.'/fourn/class/fournisseur.commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
@ -35,7 +36,7 @@ if (! empty($conf->projet->enabled)) {
} }
$langs->load("orders"); $langs->load("orders");
$langs->load("sendings"); $langs->load("receptions");
$langs->load("companies"); $langs->load("companies");
$id=GETPOST('id','int'); $id=GETPOST('id','int');
@ -44,25 +45,27 @@ $action=GETPOST('action','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expedition', $id,''); $result = restrictedArea($user, 'reception', $id,'');
$object = new Expedition($db); $object = new Reception($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$object->fetch($id, $ref); $object->fetch($id, $ref);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
if (!empty($object->origin)) if (!empty($object->origin))
{ {
$typeobject = $object->origin;
$origin = $object->origin; $origin = $object->origin;
$object->fetch_origin(); $object->fetch_origin();
$typeobject = $object->origin;
} }
// Linked documents // Linked documents
if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) if ($origin == 'order_supplier' && $object->$typeobject->id && ! empty($conf->fournisseur->enabled))
{ {
$objectsrc=new Commande($db); $objectsrc=new CommandeFournisseur($db);
$objectsrc->fetch($object->$typeobject->id); $objectsrc->fetch($object->$typeobject->id);
} }
if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled)) if ($typeobject == 'propal' && $object->$typeobject->id && ! empty($conf->propal->enabled))
@ -77,7 +80,7 @@ if ($id > 0 || ! empty($ref))
* Actions * Actions
*/ */
if ($action == 'addcontact' && $user->rights->expedition->creer) if ($action == 'addcontact' && $user->rights->reception->creer)
{ {
if ($result > 0 && $id > 0) if ($result > 0 && $id > 0)
{ {
@ -104,13 +107,13 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
} }
// bascule du statut d'un contact // bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->expedition->creer) else if ($action == 'swapstatut' && $user->rights->reception->creer)
{ {
$result=$objectsrc->swapContactStatus(GETPOST('ligne')); $result=$objectsrc->swapContactStatus(GETPOST('ligne'));
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->expedition->creer) else if ($action == 'deletecontact' && $user->rights->reception->creer)
{ {
$result = $objectsrc->delete_contact(GETPOST("lineid")); $result = $objectsrc->delete_contact(GETPOST("lineid"));
@ -124,7 +127,7 @@ else if ($action == 'deletecontact' && $user->rights->expedition->creer)
} }
} }
/* /*
else if ($action == 'setaddress' && $user->rights->expedition->creer) else if ($action == 'setaddress' && $user->rights->reception->creer)
{ {
$object->fetch($id); $object->fetch($id);
$result=$object->setDeliveryAddress($_POST['fk_address']); $result=$object->setDeliveryAddress($_POST['fk_address']);
@ -136,7 +139,7 @@ else if ($action == 'setaddress' && $user->rights->expedition->creer)
* View * View
*/ */
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:expeditions_Clients|ES:Pedidos de clientes'); llxHeader('',$langs->trans('Reception'),'EN:Customers_Orders|FR:receptions_Clients|ES:Pedidos de clientes');
$form = new Form($db); $form = new Form($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
@ -155,24 +158,24 @@ if ($id > 0 || ! empty($ref))
{ {
$langs->trans("OrderCard"); $langs->trans("OrderCard");
$head = shipping_prepare_head($object); $head = reception_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans("Shipment"), -1, 'sending'); dol_fiche_head($head, 'contact', $langs->trans("Reception"), -1, 'sending');
// Shipment card // Reception card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer reception
$morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project // Project
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>' . $langs->trans('Project') . ' '; $morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
if (0) { // Do not change on shipment if (0) { // Do not change on reception
if ($action != 'classify') { if ($action != 'classify') {
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
} }
@ -188,8 +191,8 @@ if ($id > 0 || ! empty($ref))
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
} }
} else { } else {
// We don't have project on shipment, so we will use the project or source object instead // We don't have project on reception, so we will use the project or source object instead
// TODO Add project on shipment // TODO Add project on reception
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
if (! empty($objectsrc->fk_project)) { if (! empty($objectsrc->fk_project)) {
$proj = new Project($db); $proj = new Project($db);
@ -204,7 +207,7 @@ if ($id > 0 || ! empty($ref))
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$object->picto = 'sending';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
@ -213,12 +216,11 @@ if ($id > 0 || ! empty($ref))
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Linked documents // Linked documents
if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled)) if ($origin == 'order_supplier' && $object->$typeobject->id && ! empty($conf->fournisseur->enabled))
{ {
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
$objectsrc=new Commande($db); $objectsrc=new CommandeFournisseur($db);
$objectsrc->fetch($object->$typeobject->id); $objectsrc->fetch($object->$typeobject->id);
print $langs->trans("RefOrder").'</td>'; print $langs->trans("RefOrder").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
@ -233,7 +235,7 @@ if ($id > 0 || ! empty($ref))
$objectsrc->fetch($object->$typeobject->id); $objectsrc->fetch($object->$typeobject->id);
print $langs->trans("RefProposal").'</td>'; print $langs->trans("RefProposal").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $objectsrc->getNomUrl(1,'expedition'); print $objectsrc->getNomUrl(1,'reception');
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';
} }
@ -261,11 +263,12 @@ if ($id > 0 || ! empty($ref))
// Contacts lines (modules that overwrite templates must declare this into descriptor) // Contacts lines (modules that overwrite templates must declare this into descriptor)
$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl')); $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl'));
foreach($dirtpls as $reldir) foreach($dirtpls as $reldir)
{ {
$res=@include dol_buildpath($reldir.'/contacts.tpl.php'); $res=@include dol_buildpath($reldir.'/contacts.tpl.php');
if ($res) break; if ($res) break;
} }
} }

View File

@ -19,20 +19,21 @@
*/ */
/** /**
* \file htdocs/expedition/note.php * \file htdocs/reception/nosendingte.php
* \ingroup expedition * \ingroup receptionsending
* \brief Note card expedition * \brief Note card reception
*/ */
require '../main.inc.php'; 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/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/reception.lib.php';
dol_include_once('/fourn/class/fournisseur.commande.class.php');
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
} }
$langs->load("sendings"); $langs->load("receptions");
$langs->load("companies"); $langs->load("companies");
$langs->load("bills"); $langs->load("bills");
$langs->load('deliveries'); $langs->load('deliveries');
@ -50,7 +51,7 @@ $socid='';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user, $origin, $origin_id); $result=restrictedArea($user, $origin, $origin_id);
$object = new Expedition($db); $object = new Reception($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$object->fetch($id, $ref); $object->fetch($id, $ref);
@ -76,7 +77,7 @@ if ($id > 0 || ! empty($ref))
} }
} }
$permissionnote=$user->rights->expedition->creer; // Used by the include of actions_setnotes.inc.php $permissionnote=$user->rights->reception->creer; // Used by the include of actions_setnotes.inc.php
/* /*
@ -90,31 +91,31 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View * View
*/ */
llxHeader(); llxHeader('','Reception');
$form = new Form($db); $form = new Form($db);
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$head=shipping_prepare_head($object); $head=reception_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans("Shipment"), -1, 'sending'); dol_fiche_head($head, 'note', $langs->trans("Reception"), -1, 'sending');
// Shipment card // Reception card
$linkback = '<a href="'.DOL_URL_ROOT.'/expedition/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/reception/list.php">'.$langs->trans("BackToList").'</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer shipment // Ref customer reception
$morehtmlref.=$form->editfieldkey("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("RefCustomer", '', $object->ref_customer, $object, $user->rights->expedition->creer, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("RefSupplier", '', $object->ref_supplier, $object, $user->rights->reception->creer, 'string', '', null, null, '', 1);
// Thirdparty // Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project // Project
if (! empty($conf->projet->enabled)) { if (! empty($conf->projet->enabled)) {
$langs->load("projects"); $langs->load("projects");
$morehtmlref .= '<br>' . $langs->trans('Project') . ' '; $morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
if (0) { // Do not change on shipment if (0) { // Do not change on reception
if ($action != 'classify') { if ($action != 'classify') {
$morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : '; $morehtmlref .= '<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
} }
@ -130,8 +131,8 @@ if ($id > 0 || ! empty($ref))
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
} }
} else { } else {
// We don't have project on shipment, so we will use the project or source object instead // We don't have project on reception, so we will use the project or source object instead
// TODO Add project on shipment // TODO Add project on reception
$morehtmlref .= ' : '; $morehtmlref .= ' : ';
if (! empty($objectsrc->fk_project)) { if (! empty($objectsrc->fk_project)) {
$proj = new Project($db); $proj = new Project($db);
@ -146,7 +147,7 @@ if ($id > 0 || ! empty($ref))
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
$object->picto = 'sending';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);