Select delivery method for order
This commit is contained in:
parent
f0a7cc3268
commit
4fcff3e2e5
@ -1868,7 +1868,7 @@ if ($action == 'create') {
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $user->rights->propal->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
|
||||
@ -72,6 +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 $fk_remise_except;
|
||||
var $remise_percent;
|
||||
var $total_ht; // Total net of tax
|
||||
@ -656,6 +657,7 @@ class Commande extends CommonOrder
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
|
||||
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_client, ref_int";
|
||||
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql.= ", fk_shipping_method";
|
||||
$sql.= ", remise_absolue, remise_percent";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
@ -675,6 +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->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:0);
|
||||
$sql.= ", ".$conf->entity;
|
||||
@ -984,6 +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->fk_delivery_address = $object->fk_delivery_address;
|
||||
$this->contact_id = $object->contactid;
|
||||
$this->ref_client = $object->ref_client;
|
||||
@ -1327,6 +1331,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ', c.fk_account';
|
||||
$sql.= ', c.date_commande';
|
||||
$sql.= ', c.date_livraison';
|
||||
$sql.= ", c.fk_shipping_method";
|
||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
@ -1390,6 +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->fk_delivery_address = $obj->fk_delivery_address;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
@ -229,6 +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->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->contactid = GETPOST('contactidp');
|
||||
|
||||
@ -491,6 +492,11 @@ else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
// shipping method
|
||||
else if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
|
||||
$result = $object->setShippingMethod(GETPOST('fk_shipping_method', 'int'));
|
||||
}
|
||||
|
||||
else if ($action == 'setremisepercent' && $user->rights->commande->creer) {
|
||||
$result = $object->set_remise($user, GETPOST('remise_percent'));
|
||||
}
|
||||
@ -1396,6 +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));
|
||||
$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));
|
||||
@ -1416,6 +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;
|
||||
$demand_reason_id = $soc->demand_reason_id;
|
||||
$remise_percent = $soc->remise_percent;
|
||||
$remise_absolue = 0;
|
||||
@ -1520,6 +1528,11 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Shipping Method
|
||||
print '<tr><td>' . $langs->trans('SendingMethod') . '</td><td colspan="2">';
|
||||
print $form->selectShippingMethod($fk_shipping_method, 'fk_shipping_method', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// What trigger creation
|
||||
print '<tr><td>' . $langs->trans('Source') . '</td><td colspan="2">';
|
||||
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1);
|
||||
@ -1975,6 +1988,23 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Shipping Method
|
||||
print '<tr><td height="10">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $user->rights->commande->creer)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->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='.$object->id, $object->fk_shipping_method, 'fk_shipping_method', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_shipping_method, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Terms of payment
|
||||
print '<tr><td height="10">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
|
||||
@ -124,4 +124,5 @@ create table llx_accounting_fiscalyear
|
||||
ALTER TABLE llx_contrat ADD COLUMN ref_ext varchar(30) after ref;
|
||||
|
||||
ALTER TABLE llx_propal ADD COLUMN fk_shipping_method integer AFTER date_livraison;
|
||||
ALTER TABLE llx_commande ADD COLUMN fk_shipping_method integer AFTER date_livraison;
|
||||
|
||||
|
||||
@ -61,6 +61,7 @@ create table llx_commande
|
||||
fk_mode_reglement integer, -- mode de reglement
|
||||
|
||||
date_livraison date default NULL,
|
||||
fk_shipping_method integer, -- shipping method id
|
||||
fk_availability integer NULL,
|
||||
fk_input_reason integer,
|
||||
fk_delivery_address integer, -- delivery address (deprecated)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user