forked from Wavyzz/dolibarr
Fix: Found a dozen of bugs into sub module delivery of module shipment.
This commit is contained in:
@@ -673,11 +673,11 @@ 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';
|
||||||
|
|
||||||
$object = $this->origin;
|
$origin = $this->origin;
|
||||||
|
|
||||||
$classname = ucfirst($object);
|
$classname = ucfirst($origin);
|
||||||
$this->$object = new $classname($this->db);
|
$this->$origin = new $classname($this->db);
|
||||||
$this->$object->fetch($this->origin_id);
|
$this->$origin->fetch($this->origin_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1653,7 +1653,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array.
|
* Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array and this->linkedObjectsIds
|
||||||
*
|
*
|
||||||
* @param int $sourceid Object source id
|
* @param int $sourceid Object source id
|
||||||
* @param string $sourcetype Object source type
|
* @param string $sourcetype Object source type
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function shipping_prepare_head($object)
|
|||||||
{
|
{
|
||||||
// delivery link
|
// delivery link
|
||||||
$object->fetchObjectLinked($object->id,$object->element);
|
$object->fetchObjectLinked($object->id,$object->element);
|
||||||
if (! empty($object->linkedObjectsIds['delivery'][0]))
|
if (! empty($object->linkedObjectsIds['delivery'][0])) // If there is a delivery
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
|
$head[$h][0] = DOL_URL_ROOT."/livraison/fiche.php?id=".$object->linkedObjectsIds['delivery'][0];
|
||||||
$head[$h][1] = $langs->trans("DeliveryCard");
|
$head[$h][1] = $langs->trans("DeliveryCard");
|
||||||
@@ -110,6 +110,17 @@ function delivery_prepare_head($object)
|
|||||||
$head[$h][2] = 'delivery';
|
$head[$h][2] = 'delivery';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
|
/* We are on id of delivery, no shipment
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||||
|
$head[$h][2] = 'contact';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id;
|
||||||
|
$head[$h][1] = $langs->trans("Notes");
|
||||||
|
$head[$h][2] = 'note';
|
||||||
|
$h++;*/
|
||||||
|
|
||||||
// Show more tabs from modules
|
// Show more tabs from modules
|
||||||
// Entries must be declared in modules descriptor with line
|
// Entries must be declared in modules descriptor with line
|
||||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||||
@@ -117,9 +128,11 @@ function delivery_prepare_head($object)
|
|||||||
// complete_head_from_modules use $object->id for this link so we temporary change it
|
// complete_head_from_modules use $object->id for this link so we temporary change it
|
||||||
$tmpObjectId = $object->id;
|
$tmpObjectId = $object->id;
|
||||||
$object->id = $object->origin_id;
|
$object->id = $object->origin_id;
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery');
|
||||||
|
|
||||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery','remove');
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery','remove');
|
||||||
|
|
||||||
$object->id = $tmpObjectId;
|
$object->id = $tmpObjectId;
|
||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -540,9 +540,9 @@ class pdf_rouget extends ModelePdfExpedition
|
|||||||
$Yoff = $Yoff+8;
|
$Yoff = $Yoff+8;
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 100,$Yoff);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 100,$Yoff);
|
||||||
$pdf->MultiCell(100, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
|
$pdf->MultiCell(100, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
|
||||||
$Yoff = $Yoff+4;
|
$Yoff = $Yoff+3;
|
||||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
||||||
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"daytext",false,$outputlangs,true), 0, 'R');
|
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date,"day",false,$outputlangs,true), 0, 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -696,6 +696,41 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
|||||||
|
|
||||||
$posy+=2;
|
$posy+=2;
|
||||||
|
|
||||||
|
// Add list of linked orders on shipment
|
||||||
|
if ($object->origin == 'expedition' || $object->origin == 'shipping')
|
||||||
|
{
|
||||||
|
$Yoff=$posy-5;
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
|
||||||
|
$shipment = new Expedition($this->db);
|
||||||
|
$shipment->fetch($object->origin_id);
|
||||||
|
|
||||||
|
$origin = $shipment->origin;
|
||||||
|
$origin_id = $shipment->origin_id;
|
||||||
|
|
||||||
|
// TODO move to external function
|
||||||
|
if ($conf->$origin->enabled)
|
||||||
|
{
|
||||||
|
$outputlangs->load('orders');
|
||||||
|
|
||||||
|
$classname = ucfirst($origin);
|
||||||
|
$linkedobject = new $classname($this->db);
|
||||||
|
$result=$linkedobject->fetch($origin_id);
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
$pdf->SetFont('','', $default_font_size - 2);
|
||||||
|
$text=$linkedobject->ref;
|
||||||
|
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
|
||||||
|
$Yoff = $Yoff+8;
|
||||||
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 100,$Yoff);
|
||||||
|
$pdf->MultiCell(100, 2, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
|
||||||
|
$Yoff = $Yoff+3;
|
||||||
|
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
||||||
|
$pdf->MultiCell(60, 2, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($linkedobject->date,"day",false,$outputlangs,true), 0, 'R');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Show list of linked objects
|
// Show list of linked objects
|
||||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size);
|
||||||
|
|
||||||
|
|||||||
@@ -1208,7 +1208,7 @@ class Expedition extends CommonObject
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->error();
|
||||||
dol_syslog("Commande::set_date_livraison ".$this->error,LOG_ERR);
|
dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ if ($action == 'add')
|
|||||||
*/
|
*/
|
||||||
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
|
else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
|
||||||
$result = $object->create_delivery($user);
|
$result = $object->create_delivery($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@@ -199,7 +198,6 @@ else if ($action == 'create_delivery' && $conf->livraison_bon->enabled && $user-
|
|||||||
|
|
||||||
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->expedition->valider)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
$result = $object->valid($user);
|
$result = $object->valid($user);
|
||||||
@@ -228,8 +226,6 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
|
|||||||
|
|
||||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
|
||||||
$object->fetch_thirdparty();
|
|
||||||
$result = $object->delete();
|
$result = $object->delete();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
@@ -244,7 +240,6 @@ else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expe
|
|||||||
|
|
||||||
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
else if ($action == 'reopen' && $user->rights->expedition->valider)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
|
||||||
$result = $object->setStatut(0);
|
$result = $object->setStatut(0);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
@@ -275,26 +270,22 @@ else if ($action == 'settrackingnumber' || $action == 'settrackingurl'
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
$shipping = new Expedition($db);
|
if ($action == 'settrackingnumber') $object->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
||||||
$result=$shipping->fetch($id);
|
if ($action == 'settrackingurl') $object->tracking_url = trim(GETPOST('trackingurl','int'));
|
||||||
if ($result < 0) dol_print_error($db,$shipping->error);
|
if ($action == 'settrueWeight') $object->trueWeight = trim(GETPOST('trueWeight','int'));
|
||||||
|
if ($action == 'settrueWidth') $object->trueWidth = trim(GETPOST('trueWidth','int'));
|
||||||
if ($action == 'settrackingnumber') $shipping->tracking_number = trim(GETPOST('trackingnumber','alpha'));
|
if ($action == 'settrueHeight') $object->trueHeight = trim(GETPOST('trueHeight','int'));
|
||||||
if ($action == 'settrackingurl') $shipping->tracking_url = trim(GETPOST('trackingurl','int'));
|
if ($action == 'settrueDepth') $object->trueDepth = trim(GETPOST('trueDepth','int'));
|
||||||
if ($action == 'settrueWeight') $shipping->trueWeight = trim(GETPOST('trueWeight','int'));
|
if ($action == 'setshipping_method_id') $object->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
|
||||||
if ($action == 'settrueWidth') $shipping->trueWidth = trim(GETPOST('trueWidth','int'));
|
|
||||||
if ($action == 'settrueHeight') $shipping->trueHeight = trim(GETPOST('trueHeight','int'));
|
|
||||||
if ($action == 'settrueDepth') $shipping->trueDepth = trim(GETPOST('trueDepth','int'));
|
|
||||||
if ($action == 'setshipping_method_id') $shipping->shipping_method_id = trim(GETPOST('shipping_method_id','int'));
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if ($shipping->update($user) >= 0)
|
if ($object->update($user) >= 0)
|
||||||
{
|
{
|
||||||
header("Location: fiche.php?id=".$shipping->id);
|
header("Location: fiche.php?id=".$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
setEventMessage($shipping->error,'errors');
|
setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
$action="";
|
$action="";
|
||||||
@@ -331,17 +322,12 @@ elseif ($action == 'remove_file')
|
|||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$object = new Expedition($db);
|
|
||||||
if ($object->fetch($id))
|
|
||||||
{
|
|
||||||
$object->fetch_thirdparty();
|
|
||||||
$upload_dir = $conf->expedition->dir_output . "/sending";
|
$upload_dir = $conf->expedition->dir_output . "/sending";
|
||||||
$file = $upload_dir . '/' . GETPOST('file');
|
$file = $upload_dir . '/' . GETPOST('file');
|
||||||
$ret=dol_delete_file($file,0,0,0,$object);
|
$ret=dol_delete_file($file,0,0,0,$object);
|
||||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add file in email form
|
* Add file in email form
|
||||||
@@ -381,11 +367,6 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
|||||||
{
|
{
|
||||||
$langs->load('mails');
|
$langs->load('mails');
|
||||||
|
|
||||||
$result=$object->fetch($id);
|
|
||||||
$result=$object->fetch_thirdparty();
|
|
||||||
|
|
||||||
if ($result > 0)
|
|
||||||
{
|
|
||||||
// $ref = dol_sanitizeFileName($object->ref);
|
// $ref = dol_sanitizeFileName($object->ref);
|
||||||
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
// $file = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
@@ -523,13 +504,6 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
|
|||||||
dol_syslog('Failed to read file: '.$file);
|
dol_syslog('Failed to read file: '.$file);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("other");
|
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorFailedToReadEntity',$langs->trans("Shipping")).'</div>';
|
|
||||||
dol_syslog($langs->trans('ErrorFailedToReadEntity',$langs->trans("Shipping")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ($action == 'classifybilled')
|
else if ($action == 'classifybilled')
|
||||||
{
|
{
|
||||||
@@ -923,14 +897,6 @@ else
|
|||||||
/* */
|
/* */
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
{
|
{
|
||||||
if (! empty($id) || ! empty($ref))
|
|
||||||
{
|
|
||||||
$result = $object->fetch($id,$ref);
|
|
||||||
if ($result < 0)
|
|
||||||
{
|
|
||||||
dol_print_error($db,$object->error);
|
|
||||||
exit -1;
|
|
||||||
}
|
|
||||||
$lines = $object->lines;
|
$lines = $object->lines;
|
||||||
$num_prod = count($lines);
|
$num_prod = count($lines);
|
||||||
|
|
||||||
@@ -953,6 +919,7 @@ else
|
|||||||
|
|
||||||
dol_htmloutput_mesg($mesg);
|
dol_htmloutput_mesg($mesg);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Confirmation de la suppression
|
* Confirmation de la suppression
|
||||||
*/
|
*/
|
||||||
@@ -1086,7 +1053,7 @@ else
|
|||||||
print '<td colspan="3">'.dol_print_date($object->date_creation,"day")."</td>\n";
|
print '<td colspan="3">'.dol_print_date($object->date_creation,"day")."</td>\n";
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Delivery date planed
|
// Delivery date planned
|
||||||
print '<tr><td height="10">';
|
print '<tr><td height="10">';
|
||||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print $langs->trans('DateDeliveryPlanned');
|
print $langs->trans('DateDeliveryPlanned');
|
||||||
@@ -1359,6 +1326,9 @@ else
|
|||||||
print "\n</div>\n";
|
print "\n</div>\n";
|
||||||
|
|
||||||
|
|
||||||
|
$object->fetchObjectLinked($object->id,$object->element);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
@@ -1405,9 +1375,9 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is just to generate a delivery receipt
|
// This is just to generate a delivery receipt
|
||||||
if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds))
|
if ($conf->livraison_bon->enabled && ($object->statut == 1 || $object->statut == 2) && $user->rights->expedition->livraison->creer && empty($object->linkedObjectsIds['delivery'][0]))
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create_delivery">'.$langs->trans("DeliveryOrder").'</a>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=create_delivery">'.$langs->trans("CreateDeliveryOrder").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
@@ -1431,14 +1401,14 @@ else
|
|||||||
print "<br>\n";
|
print "<br>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Documents generated
|
* Documents generated
|
||||||
*/
|
*/
|
||||||
if ($action != 'presend')
|
if ($action != 'presend')
|
||||||
{
|
{
|
||||||
|
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
|
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
$filedir = $conf->expedition->dir_output . "/sending/" .$objectref;
|
$filedir = $conf->expedition->dir_output . "/sending/" .$objectref;
|
||||||
|
|
||||||
@@ -1446,8 +1416,6 @@ else
|
|||||||
|
|
||||||
$genallowed=$user->rights->expedition->lire;
|
$genallowed=$user->rights->expedition->lire;
|
||||||
$delallowed=$user->rights->expedition->supprimer;
|
$delallowed=$user->rights->expedition->supprimer;
|
||||||
//$genallowed=1;
|
|
||||||
//$delallowed=0;
|
|
||||||
|
|
||||||
$somethingshown=$formfile->show_documents('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
$somethingshown=$formfile->show_documents('expedition',$objectref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||||
|
|
||||||
@@ -1587,7 +1555,6 @@ else
|
|||||||
show_list_sending_receive($object->origin,$object->origin_id);
|
show_list_sending_receive($object->origin,$object->origin_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@@ -384,3 +384,5 @@ ALTER TABLE llx_societe_address CHANGE COLUMN tel phone varchar(20);
|
|||||||
|
|
||||||
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','TPS and TVQ rate',1);
|
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (143, 14,'5','0','9.975','1','TPS and TVQ rate',1);
|
||||||
|
|
||||||
|
DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery';
|
||||||
|
DELETE FROM llx_document_model WHERE nom ='' AND type='delivery';
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ UPDATE llx_product SET canvas = NULL where canvas = 'service@product';
|
|||||||
DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def);
|
DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def);
|
||||||
|
|
||||||
DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery';
|
DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery';
|
||||||
|
DELETE FROM llx_document_model WHERE nom ='' AND type='delivery';
|
||||||
|
|
||||||
-- Fix: It seems this is missing for some users
|
-- Fix: It seems this is missing for some users
|
||||||
insert into llx_c_actioncomm (id, code, type, libelle, module, position) values ( 1, 'AC_TEL', 'system', 'Phone call' ,NULL, 2);
|
insert into llx_c_actioncomm (id, code, type, libelle, module, position) values ( 1, 'AC_TEL', 'system', 'Phone call' ,NULL, 2);
|
||||||
|
|||||||
@@ -902,6 +902,41 @@ class Livraison extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the planned delivery date
|
||||||
|
*
|
||||||
|
* @param User $user Objet utilisateur qui modifie
|
||||||
|
* @param timestamp $date_livraison Date de livraison
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
function set_date_livraison($user, $date_livraison)
|
||||||
|
{
|
||||||
|
if ($user->rights->expedition->creer)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."livraison";
|
||||||
|
$sql.= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null');
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::set_date_livraison sql=".$sql,LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->date_delivery = $date_livraison;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
dol_syslog(get_class($this)."::set_date_livraison ".$this->error,LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ if (! empty($conf->stock->enabled))
|
|||||||
$langs->load("sendings");
|
$langs->load("sendings");
|
||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load('deliveries');
|
$langs->load('deliveries');
|
||||||
|
$langs->load('orders');
|
||||||
|
|
||||||
$action=GETPOST('action', 'alpha');
|
$action=GETPOST('action', 'alpha');
|
||||||
$confirm=GETPOST('confirm', 'alpha');
|
$confirm=GETPOST('confirm', 'alpha');
|
||||||
@@ -157,6 +158,23 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action == 'setdate_livraison' && $user->rights->expedition->livraison->creer)
|
||||||
|
{
|
||||||
|
$object = new Livraison($db);
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
|
//print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year'];
|
||||||
|
$datedelivery=dol_mktime(GETPOST('liv_hour','int'), GETPOST('liv_min','int'), 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'), GETPOST('liv_year','int'));
|
||||||
|
|
||||||
|
$object->fetch($id);
|
||||||
|
$result=$object->set_date_livraison($user,$datedelivery);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$mesg='<div class="error">'.$object->error.'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build document
|
* Build document
|
||||||
*/
|
*/
|
||||||
@@ -534,9 +552,28 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Date delivery real / Received
|
// Date delivery real / Received
|
||||||
// TODO Can edit this date, even if delivery validated.
|
print '<tr><td height="10">';
|
||||||
print '<tr><td>'.$langs->trans("DateReceived").'</td>';
|
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||||
print '<td colspan="3">'.dol_print_date($delivery->date_delivery,'daytext')."</td>\n";
|
print $langs->trans('DateReceived');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
if ($action != 'editdate_livraison') print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&id='.$delivery->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
|
||||||
|
print '</tr></table>';
|
||||||
|
print '</td><td colspan="2">';
|
||||||
|
if ($action == 'editdate_livraison')
|
||||||
|
{
|
||||||
|
print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$delivery->id.'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="setdate_livraison">';
|
||||||
|
$form->select_date($delivery->date_delivery?$delivery->date_delivery:-1,'liv_',1,1,'',"setdate_livraison");
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $delivery->date_delivery ? dol_print_date($delivery->date_delivery,'dayhourtext') : ' ';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Note Public
|
// Note Public
|
||||||
@@ -712,6 +749,18 @@ else
|
|||||||
$delallowed=$user->rights->expedition->livraison->supprimer;
|
$delallowed=$user->rights->expedition->livraison->supprimer;
|
||||||
|
|
||||||
$somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
$somethingshown=$formfile->show_documents('livraison',$deliveryref,$filedir,$urlsource,$genallowed,$delallowed,$delivery->modelpdf,1,0,0,28,0,'','','',$soc->default_lang);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Linked object block (of linked shipment)
|
||||||
|
*/
|
||||||
|
if ($delivery->origin == 'expedition')
|
||||||
|
{
|
||||||
|
$shipment = new Expedition($db);
|
||||||
|
$shipment->fetch($delivery->origin_id);
|
||||||
|
|
||||||
|
$somethingshown=$shipment->showLinkedObjectBlock();
|
||||||
|
}
|
||||||
|
|
||||||
if ($genallowed && ! $somethingshown) $somethingshown=1;
|
if ($genallowed && ! $somethingshown) $somethingshown=1;
|
||||||
|
|
||||||
print '</td><td valign="top" width="50%">';
|
print '</td><td valign="top" width="50%">';
|
||||||
|
|||||||
Reference in New Issue
Block a user