The delivery method is transmited in shipment
This commit is contained in:
parent
4fcff3e2e5
commit
2df2c12cfd
@ -252,7 +252,7 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->fk_shipping_method = GETPOST('fk_shipping_method', 'int');
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->duree_validite = $duration;
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
@ -279,7 +279,7 @@ else if ($action == 'add' && $user->rights->propal->creer) {
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->fk_shipping_method = GETPOST('fk_shipping_method', 'int');
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->duree_validite = GETPOST('duree_validite');
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
@ -1115,7 +1115,7 @@ else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
||||
|
||||
// shipping method
|
||||
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
||||
$result=$object->setShippingMethod(GETPOST('fk_shipping_method', 'int'));
|
||||
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1399,7 +1399,7 @@ if ($action == 'create') {
|
||||
|
||||
// Shipping Method
|
||||
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
|
||||
print $form->selectShippingMethod($fk_shipping_method, 'fk_shipping_method', '', 1);
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Delivery date (or manufacturing)
|
||||
@ -1874,9 +1874,9 @@ if ($action == 'create') {
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editshippingmethod') {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_shipping_method, 'fk_shipping_method', 1);
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_shipping_method, 'none');
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -92,7 +92,7 @@ class Propal extends CommonObject
|
||||
var $fk_address;
|
||||
var $address_type;
|
||||
var $address;
|
||||
var $fk_shipping_method;
|
||||
var $shipping_method_id;
|
||||
var $availability_id;
|
||||
var $availability_code;
|
||||
var $demand_reason_id;
|
||||
@ -746,7 +746,7 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL');
|
||||
$sql.= ", '".$this->db->escape($this->ref_client)."'";
|
||||
$sql.= ", ".($this->date_livraison!=''?"'".$this->db->idate($this->date_livraison)."'":"null");
|
||||
$sql.= ", ".($this->fk_shipping_method>0?$this->fk_shipping_method:'NULL');
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||
$sql.= ", ".$this->availability_id;
|
||||
$sql.= ", ".$this->demand_reason_id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
@ -1110,7 +1110,7 @@ class Propal extends CommonObject
|
||||
$this->datep = $this->db->jdate($obj->dp); // deprecated
|
||||
$this->fin_validite = $this->db->jdate($obj->dfv);
|
||||
$this->date_livraison = $this->db->jdate($obj->date_livraison);
|
||||
$this->fk_shipping_method = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->availability_id = $obj->fk_availability;
|
||||
$this->availability_code = $obj->availability_code;
|
||||
$this->availability = $obj->availability;
|
||||
|
||||
@ -72,7 +72,7 @@ class Commande extends CommonOrder
|
||||
var $date; // Date commande
|
||||
var $date_commande; // Date commande (deprecated)
|
||||
var $date_livraison; // Date livraison souhaitee
|
||||
var $fk_shipping_method;
|
||||
var $shipping_method_id;
|
||||
var $fk_remise_except;
|
||||
var $remise_percent;
|
||||
var $total_ht; // Total net of tax
|
||||
@ -677,7 +677,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".($this->demand_reason_id>0?"'".$this->demand_reason_id."'":"null");
|
||||
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
|
||||
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL');
|
||||
$sql.= ", ".($this->fk_shipping_method>0?$this->fk_shipping_method:'NULL');
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:0);
|
||||
$sql.= ", ".$conf->entity;
|
||||
@ -987,7 +987,7 @@ class Commande extends CommonOrder
|
||||
$this->availability_id = $object->availability_id;
|
||||
$this->demand_reason_id = $object->demand_reason_id;
|
||||
$this->date_livraison = $object->date_livraison;
|
||||
$this->fk_shipping_method = $object->fk_shipping_method;
|
||||
$this->shipping_method_id = $object->shipping_method_id;
|
||||
$this->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
@ -1395,7 +1395,7 @@ class Commande extends CommonOrder
|
||||
$this->demand_reason_id = $obj->fk_input_reason;
|
||||
$this->demand_reason_code = $obj->demand_reason_code;
|
||||
$this->date_livraison = $this->db->jdate($obj->date_livraison);
|
||||
$this->fk_shipping_method = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->fk_delivery_address = $obj->fk_delivery_address;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
@ -229,7 +229,7 @@ else if ($action == 'add' && $user->rights->commande->creer) {
|
||||
$object->availability_id = GETPOST('availability_id');
|
||||
$object->demand_reason_id = GETPOST('demand_reason_id');
|
||||
$object->date_livraison = $datelivraison;
|
||||
$object->fk_shipping_method = GETPOST('fk_shipping_method', 'int');
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->contactid = GETPOST('contactidp');
|
||||
|
||||
@ -494,7 +494,7 @@ else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
|
||||
// shipping method
|
||||
else if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||
$result = $object->setShippingMethod(GETPOST('fk_shipping_method', 'int'));
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
}
|
||||
|
||||
else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
|
||||
@ -1402,7 +1402,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
|
||||
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
|
||||
$fk_shipping_method = (! empty($objectsrc->fk_shipping_method)?$objectsrc->fk_shipping_method:(! empty($soc->fk_shipping_method)?$soc->fk_shipping_method:0));
|
||||
$shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0));
|
||||
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
|
||||
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||
@ -1423,7 +1423,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$mode_reglement_id = $soc->mode_reglement_id;
|
||||
$fk_account = $soc->fk_account;
|
||||
$availability_id = $soc->availability_id;
|
||||
$fk_shipping_method = $soc->fk_shipping_method;
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
@ -1530,7 +1530,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
|
||||
// Shipping Method
|
||||
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
|
||||
print $form->selectShippingMethod($fk_shipping_method, 'fk_shipping_method', '', 1);
|
||||
print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// What trigger creation
|
||||
@ -1998,9 +1998,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editshippingmethod') {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_shipping_method, 'fk_shipping_method', 1);
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_shipping_method, 'none');
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -1046,24 +1046,24 @@ abstract class CommonObject
|
||||
/**
|
||||
* Change the shipping method
|
||||
*
|
||||
* @param int $fk_shipping_method Id of shipping method
|
||||
* @param int $shipping_method_id Id of shipping method
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function setShippingMethod($fk_shipping_method)
|
||||
function setShippingMethod($shipping_method_id)
|
||||
{
|
||||
if (! $this->table_element) {
|
||||
dol_syslog(get_class($this)."::setShippingMethod was called on objet with property table_element not defined",LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if ($fk_shipping_method<0) $fk_shipping_method='NULL';
|
||||
dol_syslog(get_class($this).'::setShippingMethod('.$fk_shipping_method.')');
|
||||
if ($shipping_method_id<0) $shipping_method_id='NULL';
|
||||
dol_syslog(get_class($this).'::setShippingMethod('.$shipping_method_id.')');
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET fk_shipping_method = ".$fk_shipping_method;
|
||||
$sql.= " SET fk_shipping_method = ".$shipping_method_id;
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
if ($this->db->query($sql)) {
|
||||
$this->fk_shipping_method = ($fk_shipping_method=='NULL')?null:$fk_shipping_method;
|
||||
$this->shipping_method_id = ($shipping_method_id=='NULL')?null:$shipping_method_id;
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog(get_class($this).'::setShippingMethod Error ', LOG_DEBUG);
|
||||
|
||||
@ -116,6 +116,13 @@ if ($action == 'setconditions' && $user->rights->commande->creer)
|
||||
if ($result < 0) dol_print_error($db,$commande->error);
|
||||
}
|
||||
|
||||
// shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($id);
|
||||
$result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -262,6 +269,23 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Shipping Method
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $user->rights->expedition->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$commande->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editshippingmethod') {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
@ -607,6 +631,7 @@ if ($id > 0 || ! empty($ref))
|
||||
print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/fiche.php">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="hidden" name="id" value="'.$commande->id.'">';
|
||||
print '<input type="hidden" name="shipping_method_id" value="'.$commande->shipping_method_id.'">';
|
||||
print '<input type="hidden" name="origin" value="commande">';
|
||||
print '<input type="hidden" name="origin_id" value="'.$commande->id.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user