From 0d150b1d32af89ce1b277c5bb6dc5282a3fbe8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Tue, 10 Feb 2015 10:25:59 +0100 Subject: [PATCH] Removed unused code, misc corrections and corrected PHPDoc problems. --- htdocs/accountancy/admin/fiscalyear.php | 1 - htdocs/accountancy/admin/fiscalyear_card.php | 4 ++-- .../class/accountancysystem.class.php | 4 ++-- .../class/accountingaccount.class.php | 21 +++++++------------ .../accountancy/class/bookkeeping.class.php | 21 +++++++------------ .../class/html.formventilation.class.php | 10 +++------ htdocs/accountancy/journal/bankjournal.php | 20 ++++++++---------- htdocs/accountancy/journal/sellsjournal.php | 2 -- htdocs/comm/action/class/ical.class.php | 2 +- htdocs/core/lib/accounting.lib.php | 8 +++---- htdocs/core/lib/fiscalyear.lib.php | 4 ++-- 11 files changed, 38 insertions(+), 59 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 4dd005fca85..e269bafae6c 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -94,7 +94,6 @@ if ($result) while ($i < $num && $i < $max) { $obj = $db->fetch_object($result); - $fiscalyearstatic->ref=$obj->rowid; $fiscalyearstatic->id=$obj->rowid; print ''; print ''.img_object($langs->trans("ShowFiscalYear"),"technic").' '.$obj->rowid.''; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 423ac88b490..30cd7ae8777 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -226,7 +226,7 @@ else if ($id) // Ref print ""; print ''.$langs->trans("Ref").''; - print $object->ref; + print $object->rowid; print ''; // Label @@ -278,7 +278,7 @@ else if ($id) // Ref print ''.$langs->trans("Ref").''; - print $object->ref; + print $object->rowid; print ''; print $linkback; print ''; diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 7ce2134d0d2..ab0765ff115 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -66,8 +66,8 @@ class AccountancySystem $id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system"); if ($id > 0) { - $this->id = $id; - $result = $this->id; + $this->rowid = $id; + $result = $this->rowid; } else { $result = - 2; $this->error = "AccountancySystem::Create Erreur $result"; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 24031b683b4..293338c3b73 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -123,7 +123,7 @@ class AccountingAccount */ function create($user, $notrigger = 0) { - global $conf, $langs; + global $conf; $error = 0; $now=dol_now(); @@ -190,7 +190,7 @@ class AccountingAccount if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accountingaccount"); - if (! $notrigger) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -200,7 +200,7 @@ class AccountingAccount // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } +// } } // Commit or rollback @@ -225,8 +225,6 @@ class AccountingAccount */ function update($user) { - global $langs; - $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount "; @@ -294,7 +292,6 @@ class AccountingAccount */ function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $result = $this->checkUsage(); @@ -303,8 +300,8 @@ class AccountingAccount $this->db->begin(); - if (! $error) { - if (! $notrigger) { +// if (! $error) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -314,8 +311,8 @@ class AccountingAccount // $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } - } +// } +// } if (! $error) { $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accountingaccount"; @@ -392,8 +389,6 @@ class AccountingAccount */ function account_desactivate($id) { - global $langs; - $result = $this->checkUsage(); if ($result > 0) { @@ -427,8 +422,6 @@ class AccountingAccount */ function account_activate($id) { - global $langs; - $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accountingaccount "; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a3a760b0570..9dcba514ae1 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -225,8 +225,6 @@ class BookKeeping */ function create($user='') { - global $conf, $user, $langs; - $this->piece_num = 0; // first check if line not yet in bookkeeping @@ -355,7 +353,6 @@ class BookKeeping */ function create_std($user, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -445,7 +442,7 @@ class BookKeeping if (! $error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_bookkeeping"); - if (! $notrigger) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -455,7 +452,7 @@ class BookKeeping // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } +// } } // Commit or rollback @@ -481,7 +478,6 @@ class BookKeeping */ function update($user = 0, $notrigger = 0) { - global $conf, $langs; $error = 0; // Clean parameters @@ -550,8 +546,8 @@ class BookKeeping $this->errors[] = "Error " . $this->db->lasterror(); } - if (! $error) { - if (! $notrigger) { +// if (! $error) { +// if (! $notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -561,8 +557,8 @@ class BookKeeping // $result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); // if ($result < 0) { $error++; $this->errors=$interface->errors; } // // End call triggers - } - } +// } +// } // Commit or rollback if ($error) { @@ -587,7 +583,6 @@ class BookKeeping */ function delete($user, $notrigger = 0) { - global $conf, $langs; $error = 0; $this->db->begin(); @@ -642,10 +637,10 @@ class BookKeeping $sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping"; + dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG); + $resql = $this->db->query($sql); - dol_syslog(get_class($this) . "::export_bookkeping sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); if ($resql) { $this->linesexport = array (); diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 4e833862bd8..f2b6ba6346c 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -50,10 +50,6 @@ class FormVentilation extends Form */ function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey='') { - global $langs; - - $date_array = array (); - $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; $sql .= ' ORDER BY import_key DESC'; @@ -100,7 +96,7 @@ class FormVentilation extends Form */ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array()) { - global $conf, $user, $langs; + global $conf; $out = ''; @@ -161,7 +157,7 @@ class FormVentilation extends Form */ function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) { - global $conf, $user, $langs; + global $conf; $out = ''; @@ -217,7 +213,7 @@ class FormVentilation extends Form */ function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) { - global $conf, $user, $langs; + global $conf; $out = ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 5fc98690933..b9d3b9209f9 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -553,17 +553,15 @@ else // Bank foreach ( $tabbq[$key] as $k => $mt ) { - if (1) { - print ""; - print "" . $date . ""; - print "" . $reflabel . ""; - print "" . length_accountg($k) . ""; - print "" . $langs->trans('Bank') . ""; - print "" . $val["type_payment"] . ""; - print "" . ($mt >= 0 ? price($mt) : '') . ""; - print "" . ($mt < 0 ? price(- $mt) : '') . ""; - print ""; - } + print ""; + print "" . $date . ""; + print "" . $reflabel . ""; + print "" . length_accountg($k) . ""; + print "" . $langs->trans('Bank') . ""; + print "" . $val["type_payment"] . ""; + print "" . ($mt >= 0 ? price($mt) : '') . ""; + print "" . ($mt < 0 ? price(- $mt) : '') . ""; + print ""; } // Third party diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 4c260f9fa99..d80e8f36562 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -230,7 +230,6 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = $val["fk_facturedet"]; - $bookkeeping->fk_compte = $compte->id; $bookkeeping->code_tiers = ''; $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $langs->trans("VAT"); @@ -420,7 +419,6 @@ if ($action == 'export_csv') { $invoicestatic->id = $key; $invoicestatic->ref = $val["ref"]; $invoicestatic->type = $val["type"]; - $invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32)); $date = dol_print_date($db->jdate($val["date"]), 'day'); diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 2dd6ea2b125..da062176d13 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -261,7 +261,7 @@ class ICal */ function ical_rrule($value) { - $result=aray(); + $result=array(); $rrule = explode(';',$value); foreach ($rrule as $line) { diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index ea098ba10bb..6896912ae7d 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -26,10 +26,10 @@ /** * Prepare array with list of admin tabs * - * @param Object $object Object instance we show card + * @param AccountingAccount $object Object instance we show card * @return array Array of tabs to show */ -function admin_accounting_prepare_head($object=null) +function admin_accounting_prepare_head(AccountingAccount $object=null) { global $langs, $conf; @@ -65,10 +65,10 @@ function admin_accounting_prepare_head($object=null) /** * Prepare array with list of tabs * - * @param Object $object Accounting account + * @param AccountingAccount $object Accounting account * @return array Array of tabs to show */ -function accounting_prepare_head($object) +function accounting_prepare_head(AccountingAccount $object) { global $langs, $conf; diff --git a/htdocs/core/lib/fiscalyear.lib.php b/htdocs/core/lib/fiscalyear.lib.php index 5d27760b41f..37266b51495 100644 --- a/htdocs/core/lib/fiscalyear.lib.php +++ b/htdocs/core/lib/fiscalyear.lib.php @@ -24,10 +24,10 @@ /** * Prepare array with list of tabs * - * @param Object $object Object related to tabs + * @param Fiscalyear $object Object related to tabs * @return array Array of tabs to show */ -function fiscalyear_prepare_head($object) +function fiscalyear_prepare_head(Fiscalyear $object) { global $langs, $conf;