Merge pull request #4945 from frederic34/shipcust
NEW : Select Preferred Sending Method for a third party
This commit is contained in:
commit
010a4f8929
@ -124,6 +124,14 @@ if (empty($reshook))
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id','int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
{
|
||||
@ -239,8 +247,8 @@ if ($id > 0)
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($object->prefix_comm?$object->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
print ($object->prefix_comm?$object->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
@ -431,6 +439,27 @@ if ($id > 0)
|
||||
print '</div></td></tr>';
|
||||
}
|
||||
|
||||
// Preferred shipping Method
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'shipping_method_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
|
||||
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
|
||||
|
||||
@ -1320,6 +1320,9 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
print '</td>';
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1);
|
||||
|
||||
@ -180,6 +180,7 @@ CREATE TABLE llx_multicurrency_rate
|
||||
|
||||
ALTER TABLE llx_societe ADD COLUMN fk_multicurrency integer;
|
||||
ALTER TABLE llx_societe ADD COLUMN multicurrency_code varchar(255);
|
||||
ALTER TABLE llx_societe ADD COLUMN fk_shipping_method integer AFTER cond_reglement_supplier;
|
||||
|
||||
ALTER TABLE llx_product_price ADD COLUMN fk_multicurrency integer;
|
||||
ALTER TABLE llx_product_price ADD COLUMN multicurrency_code varchar(255);
|
||||
|
||||
@ -85,6 +85,7 @@ create table llx_societe
|
||||
cond_reglement tinyint, -- condition de reglement
|
||||
mode_reglement_supplier tinyint, -- mode de reglement fournisseur
|
||||
cond_reglement_supplier tinyint, -- condition de reglement fournisseur
|
||||
fk_shipping_method integer, -- preferred shipping method id
|
||||
tva_assuj tinyint DEFAULT 1, -- assujeti ou non a la TVA
|
||||
localtax1_assuj tinyint DEFAULT 0, -- assujeti ou non a local tax 1
|
||||
localtax1_value double(6,3),
|
||||
|
||||
@ -1114,6 +1114,7 @@ BrowserIsKO=You are using the web browser %s. This browser is known to be a bad
|
||||
XDebugInstalled=XDebug is loaded.
|
||||
XCacheInstalled=XCache is loaded.
|
||||
AddRefInList=Display customer/supplier ref into list (select list or combobox) and most of hyperlink. Third parties will appears with name "CC12345 - SC45678 - The big company coorp", instead of "The big company coorp".
|
||||
AskForPreferredShippingMethod=Ask for preferred Sending Method for Third Parties.
|
||||
FieldEdition=Edition of field %s
|
||||
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
|
||||
GetBarCode=Get barcode
|
||||
|
||||
@ -225,6 +225,20 @@ if ($action=="setaddrefinlist") {
|
||||
}
|
||||
}
|
||||
|
||||
//Activate Ask For Preferred Shipping Method
|
||||
if ($action=="setaskforshippingmet") {
|
||||
$setaskforshippingmet = GETPOST('value','int');
|
||||
$res = dolibarr_set_const($db, "SOCIETE_ASK_FOR_SHIPPING_METHOD", $setaskforshippingmet,'yesno',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
//Activate ProfId mandatory
|
||||
if ($action == 'setprofidmandatory')
|
||||
@ -777,6 +791,26 @@ print '</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td width="80%">'.$langs->trans("AskForPreferredShippingMethod").'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="center">';
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD))
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=0">';
|
||||
print img_picto($langs->trans("Activated"),'switch_on');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=setaskforshippingmet&value=1">';
|
||||
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||
}
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
/*
|
||||
// COMPANY_USE_SEARCH_TO_SELECT
|
||||
$var=!$var;
|
||||
|
||||
@ -840,6 +840,7 @@ class Societe extends CommonObject
|
||||
$sql .= ",cond_reglement = ".(! empty($this->cond_reglement_id)?"'".$this->db->escape($this->cond_reglement_id)."'":"null");
|
||||
$sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null");
|
||||
$sql .= ",cond_reglement_supplier = ".(! empty($this->cond_reglement_supplier_id)?"'".$this->db->escape($this->cond_reglement_supplier_id)."'":"null");
|
||||
$sql .= ", fk_shipping_method_id = ".(! empty($this->shipping_method_id)?"'".$this->db->escape($this->shipping_method_id)."'":"null");
|
||||
|
||||
$sql .= ",client = " . (! empty($this->client)?$this->client:0);
|
||||
$sql .= ",fournisseur = " . (! empty($this->fournisseur)?$this->fournisseur:0);
|
||||
@ -1018,6 +1019,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode';
|
||||
$sql .= ', s.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.tva_assuj';
|
||||
$sql .= ', s.mode_reglement_supplier, s.cond_reglement_supplier, s.localtax1_assuj, s.localtax1_value, s.localtax2_assuj, s.localtax2_value, s.fk_prospectlevel, s.default_lang, s.logo';
|
||||
$sql .= ', s.fk_shipping_method';
|
||||
$sql .= ', s.outstanding_limit, s.import_key, s.canvas, s.fk_incoterms, s.location_incoterms';
|
||||
$sql .= ', s.fk_multicurrency, s.multicurrency_code';
|
||||
$sql .= ', fj.libelle as forme_juridique';
|
||||
@ -1144,6 +1146,7 @@ class Societe extends CommonObject
|
||||
$this->cond_reglement_id = $obj->cond_reglement;
|
||||
$this->mode_reglement_supplier_id = $obj->mode_reglement_supplier;
|
||||
$this->cond_reglement_supplier_id = $obj->cond_reglement_supplier;
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
|
||||
$this->client = $obj->client;
|
||||
$this->fournisseur = $obj->fournisseur;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user