Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
3926d102b9
@ -97,6 +97,14 @@ if ($object->id > 0) {
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -226,6 +234,12 @@ if (empty($reshook))
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
// warehouse
|
||||
if ($action == 'setwarehouse' && $user->rights->societe->creer)
|
||||
{
|
||||
$result = $object->setWarehouse(GETPOST('fk_warehouse', 'int'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -238,13 +252,6 @@ $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';
|
||||
@ -480,7 +487,24 @@ if ($object->id > 0)
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Warehouse
|
||||
if (!empty($conf->stock->enabled))
|
||||
{
|
||||
$langs->load('stocks');
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
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->fk_warehouse, 'fk_warehouse', 1);
|
||||
} else {
|
||||
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none');
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Preferred shipping Method
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
|
||||
@ -129,9 +129,6 @@ $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
//if ($thirdparty->fk_warehouse > 0) $object->warehouse_id = $thirdparty->fk_warehouse;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -1495,6 +1492,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
//Warehouse default if null
|
||||
if ($soc->fk_warehouse > 0) $warehouse_id = $soc->fk_warehouse;
|
||||
if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
|
||||
{
|
||||
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;
|
||||
|
||||
@ -1534,6 +1534,7 @@ if ($action == 'create' && $usercancreate)
|
||||
}
|
||||
|
||||
//Warehouse default if null
|
||||
if ($soc->fk_warehouse > 0) $warehouse_id = $soc->fk_warehouse;
|
||||
if (!empty($conf->stock->enabled) && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
|
||||
{
|
||||
if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE;
|
||||
|
||||
@ -56,6 +56,11 @@ ALTER TABLE llx_website ADD COLUMN pageviews_month BIGINT UNSIGNED DEFAULT 0;
|
||||
ALTER TABLE llx_website ADD COLUMN pageviews_total BIGINT UNSIGNED DEFAULT 0;
|
||||
|
||||
|
||||
-- Drop foreign key with bad name or not required
|
||||
ALTER TABLE DROP FOREIGN KEY llx_workstation_workstation_fk_user_creat;
|
||||
ALTER TABLE DROP FOREIGN KEY llx_propal_fk_warehouse;
|
||||
|
||||
|
||||
CREATE TABLE llx_workstation_workstation(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
@ -79,7 +84,7 @@ CREATE TABLE llx_workstation_workstation(
|
||||
|
||||
ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_rowid (rowid);
|
||||
ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_ref (ref);
|
||||
ALTER TABLE llx_workstation_workstation ADD CONSTRAINT llx_workstation_workstation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
|
||||
ALTER TABLE llx_workstation_workstation ADD CONSTRAINT fk_workstation_workstation_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
|
||||
ALTER TABLE llx_workstation_workstation ADD INDEX idx_workstation_workstation_status (status);
|
||||
|
||||
CREATE TABLE llx_workstation_workstation_resource(
|
||||
@ -97,11 +102,15 @@ CREATE TABLE llx_workstation_workstation_usergroup(
|
||||
) ENGINE=innodb;
|
||||
|
||||
|
||||
ALTER TABLE llx_propal ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method;
|
||||
ALTER TABLE llx_propal ADD CONSTRAINT llx_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid);
|
||||
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_propal ADD COLUMN fk_warehouse integer DEFAULT NULL AFTER fk_shipping_method;
|
||||
--ALTER TABLE llx_propal ADD CONSTRAINT fk_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid);
|
||||
ALTER TABLE llx_propal ADD INDEX idx_propal_fk_warehouse(fk_warehouse);
|
||||
|
||||
ALTER TABLE llx_societe DROP INDEX idx_societe_entrepot;
|
||||
ALTER TABLE llx_societe CHANGE fk_entrepot fk_warehouse INTEGER DEFAULT NULL;
|
||||
--ALTER TABLE llx_societe ADD CONSTRAINT fk_propal_fk_warehouse FOREIGN KEY (fk_warehouse) REFERENCES llx_entrepot(rowid);
|
||||
ALTER TABLE llx_societe ADD INDEX idx_societe_warehouse(fk_warehouse);
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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';
|
||||
@ -1758,6 +1764,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;
|
||||
|
||||
//Incoterms
|
||||
|
||||
Loading…
Reference in New Issue
Block a user