diff --git a/htdocs/compta/bank/account.class.php b/htdocs/compta/bank/account.class.php index dd6f0b34595..ae0de1da08e 100644 --- a/htdocs/compta/bank/account.class.php +++ b/htdocs/compta/bank/account.class.php @@ -86,23 +86,28 @@ class Account $result = $this->db->query($sql); } - /* - * + /** + * \brief Ajoute lien entre ecriture bancaire et sources + * \param line_id Id ecriture bancaire + * \param url_id Id parametre url + * \param url Url + * \param type Type de lien (payment, company, member, ...) + * \return int <0 si ko, id line si ok */ - function add_url_line($line_id, $url_id, $url, $label) + function add_url_line($line_id, $url_id, $url, $label, $type='') { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url (fk_bank, url_id, url, label)"; - $sql .= " VALUES ('$line_id', '$url_id', '$url', '$label')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url (fk_bank, url_id, url, label, type)"; + $sql .= " VALUES ('$line_id', '$url_id', '$url', '$label', '$type')"; if ($this->db->query($sql)) { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url"); - return $rowid; } else { - return ''; + $this->error=$this->db->error(); + return -1; } } diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index c4e2ac50d00..c0ac72fe131 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -412,7 +412,7 @@ function _print_lines($db,$result,$sql,$acct) if ($user->rights->banque->modifier) { print ''; - print ''; + print ''; print img_edit(); print '  '; print ''; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index b31b0ae33f1..22b88cc2dff 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -130,11 +130,13 @@ if ($_POST["action"] == 'add_paiement') $acc->add_url_line($bank_line_id, $paiement_id, DOL_URL_ROOT.'/compta/paiement/fiche.php?id=', - "(paiement)"); + "(paiement)", + 'payment'); $acc->add_url_line($bank_line_id, $fac->client->id, DOL_URL_ROOT.'/compta/fiche.php?socid=', - $fac->client->nom); + $fac->client->nom, + 'company'); } } diff --git a/mysql/migration/1.1.0-2.0.0.sql b/mysql/migration/1.1.0-2.0.0.sql index a81971d8ea3..ff34c8d7170 100644 --- a/mysql/migration/1.1.0-2.0.0.sql +++ b/mysql/migration/1.1.0-2.0.0.sql @@ -705,7 +705,8 @@ update llx_bank set datev=dateo where datev is null; update llx_chargesociales set periode=date_ech where periode is null or periode = '0000-00-00'; -- pour virer les doublons de llx_bank_url (dus à un ancien bug) -ALTER IGNORE TABLE llx_bank_url ADD UNIQUE INDEX(fk_bank,url_id); +alter ignore table llx_bank_url add unique index(fk_bank,url_id); +alter table llx_bank_url add type varchar(16); create table llx_societe_remise ( diff --git a/mysql/tables/llx_bank_url.sql b/mysql/tables/llx_bank_url.sql index 36ef607dfc9..49ba4f307b0 100644 --- a/mysql/tables/llx_bank_url.sql +++ b/mysql/tables/llx_bank_url.sql @@ -26,5 +26,6 @@ create table llx_bank_url fk_bank integer, url_id integer, url varchar(255), - label varchar(255) + label varchar(255), + type varchar(16) )type=innodb;