Use more explicit name for class and functions

This commit is contained in:
aspangaro
2014-03-11 06:26:18 +01:00
parent 61a5735300
commit 12ffb19cec
9 changed files with 62 additions and 61 deletions

View File

@@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@@ -142,7 +142,7 @@ $memberstatic=new Adherent($db);
$paymentstatic=new Paiement($db);
$paymentsupplierstatic=new PaiementFourn($db);
$paymentvatstatic=new TVA($db);
$paymentsalstatic=new Salaries($db);
$paymentsalstatic=new PaymentSalary($db);
$bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
@@ -466,9 +466,9 @@ if ($id > 0 || ! empty($ref))
// VAT
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='payment_vat'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."tva as t ON bu2.url_id = t.rowid";
// Salaries
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_sal'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."salaries as sal ON bu3.url_id = sal.rowid";
// Salary payment
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment_salary'";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as sal ON bu3.url_id = sal.rowid";
}
if ($mode_search && ! empty($conf->adherent->enabled))
{
@@ -586,7 +586,7 @@ if ($id > 0 || ! empty($ref))
$paymentvatstatic->ref=$links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2);
}
elseif ($links[$key]['type']=='payment_sal')
elseif ($links[$key]['type']=='payment_salary')
{
$paymentsalstatic->id=$links[$key]['url_id'];
$paymentsalstatic->ref=$links[$key]['url_id'];

View File

@@ -28,7 +28,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("compta");
@@ -61,7 +61,7 @@ if (! $sortorder) $sortorder="DESC";
$tva_static = new Tva($db);
$socialcontrib=new ChargeSociales($db);
$payment_sc_static=new PaymentSocialContribution($db);
$sal_static = new Salaries($db);
$sal_static = new PaymentSalary($db);
llxHeader('',$langs->trans("TaxAndDividendsArea"));
@@ -83,15 +83,15 @@ if (GETPOST("mode") != 'sconly')
print "<br>";
}
// Salaries
// Payment Salary
if (empty($_GET["mode"]) || $_GET["mode"] != 'sconly')
{
$sal = new Salaries($db);
$sal = new PaymentSalary($db);
print_fiche_titre($langs->trans("SalPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."salaries as s";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " WHERE s.entity = ".$conf->entity;
if ($year > 0)
{

View File

@@ -16,9 +16,9 @@
*/
/**
* \file htdocs/compta/salaries/class/salaries.class.php
* \file htdocs/compta/salaries/class/paymentsalary.class.php
* \ingroup tax
* \brief Class for tax module salaries
* \brief Class for tax module salary payment
*/
// Put here all includes required by your class file
@@ -28,10 +28,10 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
/**
* Put here description of your class
*/
class Salaries extends CommonObject
class PaymentSalary extends CommonObject
{
//public $element='salaries'; //!< Id that identify managed objects
//public $table_element='salaries'; //!< Name of table without prefix where object is stored
//public $element='payment_salary'; //!< Id that identify managed objects
//public $table_element='payment_salary'; //!< Name of table without prefix where object is stored
var $id;
var $ref;
@@ -59,8 +59,8 @@ class Salaries extends CommonObject
function __construct($db)
{
$this->db = $db;
$this->element = 'salaries';
$this->table_element = 'salaries';
$this->element = 'payment_salary';
$this->table_element = 'payment_salary';
return 1;
}
@@ -90,7 +90,7 @@ class Salaries extends CommonObject
// Put here code to add control on parameters values
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."salaries(";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary(";
$sql.= "tms,";
$sql.= "fk_user,";
$sql.= "datep,";
@@ -125,12 +125,12 @@ class Salaries extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salaries");
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary");
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SALARIES_CREATE',$this,$user,$langs,$conf);
$result=$interface->run_triggers('PAYMENT_SALARY_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
@@ -174,7 +174,7 @@ class Salaries extends CommonObject
}
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."salaries SET";
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_salary SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " fk_user='".$this->fk_user."',";
@@ -205,7 +205,7 @@ class Salaries extends CommonObject
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SALARIES_MODIFY',$this,$user,$langs,$conf);
$result=$interface->run_triggers('PAYMENT_SALARY_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
@@ -243,7 +243,7 @@ class Salaries extends CommonObject
$sql.= " b.fk_type,";
$sql.= " b.rappro";
$sql.= " FROM ".MAIN_DB_PREFIX."salaries as s";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON s.fk_bank = b.rowid";
$sql.= " WHERE s.rowid = ".$id;
@@ -298,7 +298,7 @@ class Salaries extends CommonObject
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."salaries";
$sql = "DELETE FROM ".MAIN_DB_PREFIX."payment_salary";
$sql.= " WHERE rowid=".$this->id;
dol_syslog(get_class($this)."::delete sql=".$sql);
@@ -313,7 +313,7 @@ class Salaries extends CommonObject
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SALARIES_DELETE',$this,$user,$langs,$conf);
$result=$interface->run_triggers('PAYMENT_SALARY_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
@@ -389,7 +389,7 @@ class Salaries extends CommonObject
}
// Insertion dans table des paiement salaires
$sql = "INSERT INTO ".MAIN_DB_PREFIX."salaries (fk_user";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_user";
$sql.= ", datep";
$sql.= ", datev";
$sql.= ", amount";
@@ -419,12 +419,12 @@ class Salaries extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."salaries"); // TODO devrait s'appeler payment_sal
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_salary"); // TODO devrait s'appeler payment_salary
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('SALARIES_ADDPAYMENT',$this,$user,$langs,$conf);
$result=$interface->run_triggers('PAYMENT_SALARY_ADDPAYMENT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
@@ -441,7 +441,7 @@ class Salaries extends CommonObject
if ($result <= 0) dol_print_error($this->db);
// Insert payment into llx_bank
// Add link 'payment_sal' in bank_url between payment and bank transaction
// Add link 'payment_salary' in bank_url between payment and bank transaction
$bank_line_id = $acc->addline(
$this->datep,
$this->paymenttype,
@@ -464,10 +464,10 @@ class Salaries extends CommonObject
$ok=0;
}
// Add link 'payment_sal' in bank_url between payment and bank transaction
// Add link 'payment_salary' in bank_url between payment and bank transaction
$url=DOL_URL_ROOT.'/compta/salaries/fiche.php?id=';
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalPayment)", "payment_sal");
$result=$acc->add_url_line($bank_line_id, $this->id, $url, "(SalaryPayment)", "payment_salary");
if ($result <= 0)
{
$this->error=$acc->error;
@@ -478,7 +478,7 @@ class Salaries extends CommonObject
$linkaddedforthirdparty=array();
foreach ($this->amounts as $key => $value)
{
$sal = new Salaries ($this->db);
$sal = new PaymentSalary ($this->db);
$sal->fetch($key);
$sal->fetch_user($this->fk_user);
@@ -534,7 +534,7 @@ class Salaries extends CommonObject
*/
function update_fk_bank($id_bank)
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.'salaries SET fk_bank = '.$id_bank;
$sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank;
$sql.= ' WHERE rowid = '.$this->id;
$result = $this->db->query($sql);
if ($result)
@@ -566,7 +566,7 @@ class Salaries extends CommonObject
$lienfin='</a>';
$picto='payment';
$label=$langs->trans("ShowSalPayment").': '.$this->ref;
$label=$langs->trans("ShowSalaryPayment").': '.$this->ref;
if ($withpicto) $result.=($lien.img_object($label,$picto).$lienfin);
if ($withpicto && $withpicto != 2) $result.=' ';

View File

@@ -23,7 +23,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("compta");
@@ -38,10 +38,10 @@ $socid = isset($_GET["socid"])?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'tax', '', '', 'charges');
$sal = new Salaries($db);
$sal = new PaymentSalary($db);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('taxsalcard'));
$hookmanager->initHooks(array('taxsalarycard'));
@@ -144,7 +144,7 @@ $form = new Form($db);
if ($id)
{
$salpayment = new Salaries($db);
$salpayment = new PaymentSalary($db);
$result = $salpayment->fetch($id);
if ($result <= 0)
{
@@ -177,7 +177,7 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print_fiche_titre($langs->trans("NewSalPayment"));
print_fiche_titre($langs->trans("NewSalaryPayment"));
print '<table class="border" width="100%">';
@@ -196,7 +196,7 @@ if ($action == 'create')
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalPayment")).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="label" size="40" value="'.($_POST["label"]?$_POST["label"]:$langs->trans("SalaryPayment")).'"></td></tr>';
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("DateStartPeriod").'</td><td>';
@@ -252,7 +252,7 @@ if ($id)
$head[$h][2] = 'card';
$h++;
dol_fiche_head($head, 'card', $langs->trans("SalPayment"), 0, 'payment');
dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), 0, 'payment');
print '<table class="border" width="100%">';

View File

@@ -22,7 +22,7 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/salaries.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
$langs->load("compta");
@@ -39,14 +39,14 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
llxHeader();
$salstatic = new Salaries($db);
$salstatic = new PaymentSalary($db);
$userstatic = new User($db);
print_fiche_titre($langs->trans("SalPayments"));
print_fiche_titre($langs->trans("SalariesPayments"));
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."salaries as s, ".MAIN_DB_PREFIX."user as u";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE u.rowid = s.fk_user";
$sql.= " AND s.entity = ".$conf->entity;
$sql.= " ORDER BY dm DESC";

View File

@@ -1039,7 +1039,7 @@ CREATE TABLE IF NOT EXISTS `llx_expeditiondet_batch` (
) ENGINE=InnoDB;
--Salary payment in tax module
CREATE TABLE IF NOT EXISTS `llx_salaries` (
CREATE TABLE IF NOT EXISTS `llx_payment_salary` (
`rowid` integer AUTO_INCREMENT PRIMARY KEY,
`tms` timestamp,
`fk_user` integer NOT NULL,

View File

@@ -16,7 +16,7 @@
--
-- ===================================================================
create table llx_salaries
create table llx_payment_salary
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
tms timestamp,

View File

@@ -41,7 +41,7 @@ VATToCollect=VAT purchases
VATSummary=VAT Balance
LT2SummaryES=IRPF Balance
VATPaid=VAT paid
SalPaid=Salary paid
SalaryPaid=Salary paid
LT2PaidES=IRPF Paid
LT2CustomerES=IRPF sales
LT2SupplierES=IRPF purchases
@@ -65,7 +65,7 @@ PaymentCustomerInvoice=Customer invoice payment
PaymentSupplierInvoice=Supplier invoice payment
PaymentSocialContribution=Social contribution payment
PaymentVat=VAT payment
PaymentSal=Salary payment
PaymentSalary=Salary payment
ListPayment=List of payments
ListOfPayments=List of payments
ListOfCustomerPayments=List of customer payments
@@ -74,17 +74,17 @@ DatePayment=Payment date
DateStartPeriod=Date start period
DateEndPeriod=Date end period
NewVATPayment=New VAT payment
NewSalPayment=New Salary payment
NewSalaryPayment=New salary payment
newLT2PaymentES=New IRPF payment
LT2PaymentES=IRPF Payment
LT2PaymentsES=IRPF Payments
VATPayment=VAT Payment
VATPayments=VAT Payments
SalPayment=Salary payment
SalPayments=Saalries payments
SalaryPayment=Salary payment
SalariesPayments=Salaries payments
SocialContributionsPayments=Social contributions payments
ShowVatPayment=Show VAT payment
ShowSalPayment=Show salary payment
ShowSalaryPayment=Show salary payment
TotalToPay=Total to pay
TotalVATReceived=Total VAT received
CustomerAccountancyCode=Customer accountancy code

View File

@@ -41,6 +41,7 @@ VATToCollect=TVA achats
VATSummary=Balance de TVA
LT2SummaryES=Balance de IRPF
VATPaid=TVA payée
SalaryPaid=Salaire payé
LT2PaidES=IRPF Payée
LT2CustomerES=IRPF ventes
LT2SupplierES=IRPF achats
@@ -64,7 +65,7 @@ PaymentCustomerInvoice=Règlement facture client
PaymentSupplierInvoice=Règlement facture fournisseur
PaymentSocialContribution=Règlement charge sociale
PaymentVat=Règlement TVA
PaymentSal=Règlement salaire
PaymentSalary=Règlement salaire
ListPayment=Liste des règlements
ListOfPayments=Liste des règlements
ListOfCustomerPayments=Liste des règlements clients
@@ -73,17 +74,17 @@ DatePayment=Date de règlement
DateStartPeriod=Date de début période
DateEndPeriod=Date de fin période
NewVATPayment=Nouveau règlement de TVA
NewSalPayment=Nouveau règlement de salaire
NewSalaryPayment=Nouveau règlement de salaire
newLT2PaymentES=Nouveau règlement de IRPF
LT2PaymentES=Règlement IRPF
LT2PaymentsES=Règlements IRPF
VATPayment=Règlement TVA
VATPayments=Règlements TVA
SalPayment=Règlement salaire
SalPayments=Règlements des salaires
SalaryPayment=Règlement salaire
SalariesPayments=Règlements des salaires
SocialContributionsPayments=Règlements charges sociales
ShowVatPayment=Affiche paiement TVA
ShowSalPayment=Affiche paiement salaire
ShowVatPayment=Afficher paiement TVA
ShowSalaryPayment=Afficher paiement salaire
TotalToPay=Total à payer
TotalVATReceived=Total TVA perçue
CustomerAccountancyCode=Compte comptable client