diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index 256a31fd947..8ead3188ae7 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -46,6 +46,8 @@ if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherent
if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
$langs->load("companies");
+$langs->load('banks');
+
if (! empty($conf->contrat->enabled)) $langs->load("contracts");
if (! empty($conf->commande->enabled)) $langs->load("orders");
if (! empty($conf->expedition->enabled)) $langs->load("sendings");
@@ -124,7 +126,15 @@ if (empty($reshook))
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
- // customer preferred shipping method
+ // Bank account
+ if ($action == 'setbankaccount' && $user->rights->societe->creer)
+ {
+ $object->fetch($id);
+ $result=$object->setBankAccount(GETPOST('fk_account','int'));
+ if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
+ }
+
+ // customer preferred shipping method
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
{
$object->fetch($id);
@@ -337,6 +347,26 @@ if ($id > 0)
print "";
print '';
+ // Compte bancaire par défaut
+ print '
| ';
+ print '';
+ print ' | ';
+ if ($action == 'editbankaccount')
+ {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'fk_account',1);
+ }
+ else
+ {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_account,'none');
+ }
+ print " | ";
+ print '
';
+
+
// Relative discounts (Discounts-Drawbacks-Rebates)
print '';
print '| ';
diff --git a/htdocs/install/mysql/migration/4.0.0-4.1.0.sql b/htdocs/install/mysql/migration/4.0.0-4.1.0.sql
new file mode 100644
index 00000000000..10ca20953c3
--- /dev/null
+++ b/htdocs/install/mysql/migration/4.0.0-4.1.0.sql
@@ -0,0 +1,24 @@
+--
+-- Be carefull to requests order.
+-- This file must be loaded by calling /install/index.php page
+-- when current version is 4.0.0 or higher.
+--
+-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
+-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
+-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
+-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
+-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
+-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
+-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
+-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
+-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
+-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
+-- To make pk to be auto increment (mysql): VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
+-- To make pk to be auto increment (postgres): VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
+-- To set a field as NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
+-- To set a field as default NULL: VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
+-- Note: fields with type BLOB/TEXT can't have default value.
+-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
+-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
+
+ALTER TABLE llx_societe ADD COLUMN fk_account integer;
\ No newline at end of file
diff --git a/htdocs/install/mysql/tables/llx_societe.sql b/htdocs/install/mysql/tables/llx_societe.sql
index 9822272e7c2..20440b692d7 100644
--- a/htdocs/install/mysql/tables/llx_societe.sql
+++ b/htdocs/install/mysql/tables/llx_societe.sql
@@ -47,6 +47,7 @@ create table llx_societe
town varchar(50), -- town
fk_departement integer DEFAULT 0, --
fk_pays integer DEFAULT 0, --
+ fk_account integer DEFAULT 0, --
phone varchar(20), -- phone number
fax varchar(20), -- fax number
url varchar(255), --
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index cb1d783497c..7e06e5171d3 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -1023,7 +1023,7 @@ class Societe extends CommonObject
$sql .= ', s.fk_forme_juridique as forme_juridique_code';
$sql .= ', s.webservices_url, s.webservices_key';
$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.fk_departement, s.fk_pays as country_id, s.fk_stcomm, s.remise_client, s.mode_reglement, s.cond_reglement, s.fk_account, 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';
@@ -1153,7 +1153,8 @@ class Societe extends CommonObject
$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->fk_account = $obj->fk_account;
+
$this->client = $obj->client;
$this->fournisseur = $obj->fournisseur;
|
|