Skip to content

Commit

Permalink
Fix: Delete bank account
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 19, 2012
1 parent 22d63ca commit 070f157
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
18 changes: 15 additions & 3 deletions htdocs/compta/bank/class/account.class.php
Expand Up @@ -89,13 +89,15 @@ class Account extends CommonObject


/**
* Constructeur
* Constructor
*
* @param DoliDB $db Database handler
*/
function Account($DB)
function Account($db)
{
global $langs;

$this->db = $DB;
$this->db = $db;

$this->clos = 0;
$this->solde = 0;
Expand All @@ -113,6 +115,7 @@ function Account($DB)

/**
* Return if a bank account need to be conciliated
*
* @return int 1 if need to be concialiated, < 0 otherwise.
*/
function canBeConciliated()
Expand All @@ -126,6 +129,7 @@ function canBeConciliated()

/**
* Add a link between bank line record and its source
*
* @param line_id Id ecriture bancaire
* @param url_id Id parametre url
* @param url Url
Expand Down Expand Up @@ -166,6 +170,7 @@ function add_url_line($line_id, $url_id, $url, $label, $type)
/**
* TODO Move this into AccountLine
* Return array with links from llx_bank_url
*
* @param fk_bank To search using bank transaction id
* @param url_id To search using link to
* @param type To search using type
Expand Down Expand Up @@ -218,6 +223,7 @@ function get_url($fk_bank='', $url_id='', $type='')

/**
* Add an entry into table ".MAIN_DB_PREFIX."bank
*
* @param $date Date operation
* @param $oper 1,2,3,4... (deprecated) or TYP,VIR,PRE,LIQ,VAD,CB,CHQ...
* @param $label Descripton
Expand Down Expand Up @@ -336,6 +342,7 @@ function addline($date, $oper, $label, $amount, $num_chq='', $categorie='', $use

/**
* Create bank account into database
*
* @param user Object user making action
* @return int < 0 if KO, > 0 if OK
*/
Expand Down Expand Up @@ -444,6 +451,7 @@ function create($user='')

/**
* Update bank account card
*
* @param user Object user making action
* @return int <0 si ko, >0 si ok
*/
Expand Down Expand Up @@ -508,6 +516,7 @@ function update($user='')

/**
* Update BBAN (RIB) account fields
*
* @param user Object user making update
* @return int <0 if KO, >0 if OK
*/
Expand Down Expand Up @@ -561,6 +570,7 @@ function update_bban($user='')

/**
* Load a bank account into memory from database
*
* @param id Id of bank account to get
* @param ref Ref of bank account to get
* @param ref_ext External ref of bank account to get
Expand Down Expand Up @@ -658,6 +668,7 @@ function fetch($id,$ref='',$ref_ext='')

/**
* Delete bank account from database
*
* @return int <0 if KO, >0 if OK
*/
function delete()
Expand All @@ -682,6 +693,7 @@ function delete()

/**
* Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
*
* @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/
Expand Down
7 changes: 4 additions & 3 deletions htdocs/compta/bank/fiche.php
Expand Up @@ -173,9 +173,10 @@

if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
{
// Modification
$account = new Account($db, $_GET["id"]);
$account->delete($_GET["id"]);
// Delete
$account = new Account($db);
$account->fetch($_GET["id"]);
$account->delete();

header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
exit;
Expand Down

0 comments on commit 070f157

Please sign in to comment.