[CORE] ajout de la gestion incoterm sur les pages commande et à l'objet (#incoterm).
This commit is contained in:
parent
560d836943
commit
24a970a109
@ -55,6 +55,7 @@ $langs->load('propal');
|
||||
$langs->load('deliveries');
|
||||
$langs->load('sendings');
|
||||
$langs->load('products');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -237,7 +238,9 @@ if (empty($reshook))
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->contactid = GETPOST('contactid');
|
||||
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
if (! empty($origin) && ! empty($originid)) {
|
||||
// Parse element/subelement (ex: project_task)
|
||||
@ -499,6 +502,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@ -1437,6 +1446,16 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -1996,7 +2015,30 @@ if ($action == 'create' && $user->rights->commande->creer) {
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -110,6 +110,10 @@ class Commande extends CommonOrder
|
||||
var $nbtodo;
|
||||
var $nbtodolate;
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -677,6 +681,7 @@ class Commande extends CommonOrder
|
||||
$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.= ", fk_incoterms, location_incoterms";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
||||
@ -699,6 +704,8 @@ class Commande extends CommonOrder
|
||||
$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.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -1386,6 +1393,8 @@ class Commande extends CommonOrder
|
||||
$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.= ', c.fk_incoterms, c.location_incoterms';
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', ca.code as availability_code';
|
||||
@ -1395,6 +1404,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
@ -1450,6 +1460,11 @@ class Commande extends CommonOrder
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->fk_delivery_address = $obj->fk_delivery_address;
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user