This commit is contained in:
Anthony Berton 2021-01-17 02:09:21 +01:00
parent daf472b781
commit 89ac5e8803
4 changed files with 31 additions and 19 deletions

View File

@ -101,6 +101,17 @@ $now = dol_now();
/*
* Actions
*/
$contactstatic = new Contact($db);
$userstatic = new User($db);
$form = new Form($db);
$formcompany = new FormCompany($db);
if ($id > 0 && empty($object->id))
{
// Load data of third party
$res = $object->fetch($id);
if ($object->id < 0) dol_print_error($db, $object->error, $object->errors);
}
$parameters = array('id' => $id, 'socid' => $id);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some
@ -230,7 +241,7 @@ if (empty($reshook))
// warehouse
if ($action == 'setwarehouse' && $user->rights->societe->creer)
{
$result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
$result = $object->setWarehouse(GETPOST('fk_warehouse', 'int'));
}
}
@ -239,18 +250,6 @@ if (empty($reshook))
* View
*/
$contactstatic = new Contact($db);
$userstatic = new User($db);
$form = new Form($db);
$formcompany = new FormCompany($db);
if ($id > 0 && empty($object->id))
{
// Load data of third party
$res = $object->fetch($id);
if ($object->id < 0) dol_print_error($db, $object->error, $object->errors);
}
$title = $langs->trans("CustomerCard");
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name;
$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
@ -497,9 +496,9 @@ if ($object->id > 0)
print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->rights->societe->creer);
print '</td><td>';
if ($action == 'editwarehouse') {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
} else {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none');
}
print '</td>';
print '</tr>';

View File

@ -105,3 +105,7 @@ ALTER TABLE llx_propal ADD INDEX idx_propal_fk_warehouse(fk_warehouse);
ALTER TABLE llx_product_customer_price ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_product_customer_price_log ADD COLUMN ref_customer varchar(30);
ALTER TABLE llx_societe CHANGE fk_entrepot fk_warehouse INT NULL DEFAULT '0';
ALTER TABLE llx_societe ADD CONSTRAINT llx_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid);
ALTER TABLE llx_societe DROP INDEX idx_societe_entrepot;
ALTER TABLE llx_societe ADD INDEX idx_societe_warehouse(fk_warehouse);

View File

@ -33,7 +33,7 @@ ALTER TABLE llx_societe ADD INDEX idx_societe_prospectlevel(fk_prospectlevel);
ALTER TABLE llx_societe ADD INDEX idx_societe_typent(fk_typent);
ALTER TABLE llx_societe ADD INDEX idx_societe_forme_juridique(fk_forme_juridique);
ALTER TABLE llx_societe ADD INDEX idx_societe_shipping_method(fk_shipping_method);
ALTER TABLE llx_societe ADD INDEX idx_societe_entrepot(fk_entrepot);
ALTER TABLE llx_societe ADD INDEX idx_societe_warehouse(fk_warehouse);
-- ALTER TABLE llx_societe ADD FOREIGN KEY fk_prospectlevel llx_c_prospectlevel(code);
ALTER TABLE llx_societe ADD CONSTRAINT llx_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid);

View File

@ -214,7 +214,7 @@ class Societe extends CommonObject
'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>-1, 'position'=>440),
'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Multicurrency code', 'enabled'=>1, 'visible'=>-1, 'position'=>445),
'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>1, 'visible'=>-1, 'position'=>450),
'fk_entrepot' =>array('type'=>'integer', 'label'=>'Fk entrepot', 'enabled'=>1, 'visible'=>-1, 'position'=>455),
'fk_warehouse' =>array('type'=>'integer', 'label'=>'warehouse', 'enabled'=>1, 'visible'=>-1, 'position'=>455),
'logo' =>array('type'=>'varchar(255)', 'label'=>'Logo', 'enabled'=>1, 'visible'=>-1, 'position'=>400),
'logo_squarred' =>array('type'=>'varchar(255)', 'label'=>'Logo squarred', 'enabled'=>1, 'visible'=>-1, 'position'=>401),
'status' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'position'=>500),
@ -709,6 +709,12 @@ class Societe extends CommonObject
*/
public $fk_multicurrency;
// Warehouse
/**
* @var int ID
*/
public $fk_warehouse;
/**
* @var string Multicurrency code
*/
@ -1551,7 +1557,7 @@ class Societe extends CommonObject
}
$sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.address, s.datec as date_creation, s.prefix_comm';
$sql .= ', s.status';
$sql .= ', s.status, s.fk_warehouse';
$sql .= ', s.price_level';
$sql .= ', s.tms as date_modification, s.fk_user_creat, s.fk_user_modif';
$sql .= ', s.phone, s.fax, s.email';
@ -1757,6 +1763,9 @@ class Societe extends CommonObject
// multiprix
$this->price_level = $obj->price_level;
// warehouse
$this->fk_warehouse = $obj->fk_warehouse;
$this->import_key = $obj->import_key;