[CORE] ajout de l'incoterm sur les pages propal et à l'objet (#incoterm).
This commit is contained in:
parent
2a1a5e74c6
commit
36304234d2
@ -53,6 +53,7 @@ $langs->load('orders');
|
||||
$langs->load('products');
|
||||
$langs->load("deliveries");
|
||||
$langs->load('sendings');
|
||||
if ($conf->incoterm->enabled) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -240,6 +241,12 @@ if (empty($reshook))
|
||||
{
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && $conf->incoterm->enabled)
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
@ -296,6 +303,8 @@ if (empty($reshook))
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->statut = 0;
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$id = $object->create_from($user);
|
||||
} else {
|
||||
@ -319,6 +328,8 @@ if (empty($reshook))
|
||||
$object->modelpdf = GETPOST('model');
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$object->origin = GETPOST('origin');
|
||||
$object->origin_id = GETPOST('originid');
|
||||
@ -1388,6 +1399,16 @@ if ($action == 'create')
|
||||
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
|
||||
print "</td></tr>";
|
||||
|
||||
// Incoterms
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
@ -1948,6 +1969,29 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if ($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->societe->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal.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';
|
||||
@ -1964,7 +2008,7 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Amount VAT
|
||||
print '<tr><td height="10">' . $langs->trans('AmountVAT') . '</td>';
|
||||
print '<td align="right" class="nowrap">' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</td>';
|
||||
|
||||
@ -121,6 +121,11 @@ class Propal extends CommonObject
|
||||
var $nbtodolate;
|
||||
|
||||
var $specimen;
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
|
||||
/**
|
||||
@ -745,6 +750,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", fk_availability";
|
||||
$sql.= ", fk_input_reason";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_incoterms";
|
||||
$sql.= ", location_incoterms";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
@ -772,6 +779,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".$this->availability_id;
|
||||
$sql.= ", ".$this->demand_reason_id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -1088,6 +1097,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fk_mode_reglement";
|
||||
$sql.= ', p.fk_account';
|
||||
$sql.= ", p.fk_shipping_method";
|
||||
$sql.= ", p.fk_incoterms, p.location_incoterms";
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ", c.label as statut_label";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
@ -1098,6 +1109,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
@ -1165,6 +1177,11 @@ class Propal extends CommonObject
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
$this->user_close_id = $obj->fk_user_cloture;
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($obj->fk_statut == 0)
|
||||
{
|
||||
$this->brouillon = 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user