';
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index d849496d965..b3d1e6ce7f8 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -31,37 +31,37 @@
* \brief Page with bank journal
*/
require '../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
-require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
-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 . '/don/class/don.class.php';
-require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php';
-require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.class.php';
-require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
-require_once DOL_DOCUMENT_ROOT . '/societe/class/client.class.php';
-require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
-require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php';
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/paymentvarious.class.php';
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
-require_once DOL_DOCUMENT_ROOT . '/loan/class/loan.class.php';
-require_once DOL_DOCUMENT_ROOT . '/loan/class/paymentloan.class.php';
-require_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
+require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
+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.'/don/class/don.class.php';
+require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
+require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
+require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
+require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
+require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
+require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php';
+require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","other","compta","banks","bills","donations","loan","accountancy","trips","salaries","hrm","members"));
+$langs->loadLangs(array("companies", "other", "compta", "banks", "bills", "donations", "loan", "accountancy", "trips", "salaries", "hrm", "members"));
// Multi journal
$id_journal = GETPOST('id_journal', 'int');
@@ -95,13 +95,13 @@ $pastmonth = strftime("%m", dol_now()) - 1;
$pastmonthyear = $year_current;
if ($pastmonth == 0) {
$pastmonth = 12;
- $pastmonthyear --;
+ $pastmonthyear--;
}
$date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear);
$date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
-if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
+if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))) // We define date_start and date_end, only if we did not submit the form
{
$date_start = dol_get_first_day($pastmonthyear, $pastmonth, false);
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
@@ -112,26 +112,26 @@ $sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_jour
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,";
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
-$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as soc on bu1.url_id=soc.rowid";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as u on bu2.url_id=u.rowid";
-$sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
-$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
+$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
+$sql .= " JOIN ".MAIN_DB_PREFIX."bank_account as ba on b.fk_account=ba.rowid";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu1 ON bu1.fk_bank = b.rowid AND bu1.type='company'";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu2 ON bu2.fk_bank = b.rowid AND bu2.type='user'";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu3 ON bu3.fk_bank = b.rowid AND bu3.type='payment'";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu4 ON bu4.fk_bank = b.rowid AND bu4.type='payment_supplier'";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc on bu1.url_id=soc.rowid";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
+$sql .= " WHERE ba.fk_accountancy_journal=".$id_journal;
+$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
if ($date_start && $date_end)
- $sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
+ $sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
// Already in bookkeeping or not
if ($in_bookkeeping == 'already')
{
- $sql .= " AND (b.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
+ $sql .= " AND (b.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
}
if ($in_bookkeeping == 'notyet')
{
- $sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
+ $sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
}
$sql .= " ORDER BY b.datev";
//print $sql;
@@ -149,7 +149,7 @@ $paymentsalstatic = new PaymentSalary($db);
$paymentexpensereportstatic = new PaymentExpenseReport($db);
$paymentvariousstatic = new PaymentVarious($db);
$paymentloanstatic = new PaymentLoan($db);
-$accountLinestatic=new AccountLine($db);
+$accountLinestatic = new AccountLine($db);
$paymentsubscriptionstatic = new Subscription($db);
$tmppayment = new Paiement($db);
@@ -171,20 +171,20 @@ if ($result) {
//print $sql;
// Variables
- $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
- $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
- $account_employee = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
- $account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
- $account_pay_donation = (! empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
- $account_pay_subscription = (! empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
- $account_transfer = (! empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
+ $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
+ $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
+ $account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
+ $account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
+ $account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
+ $account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
+ $account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
$tabcompany = array();
$tabuser = array();
- $tabpay = array ();
- $tabbq = array ();
- $tabtp = array ();
- $tabtype = array ();
+ $tabpay = array();
+ $tabbq = array();
+ $tabtp = array();
+ $tabtype = array();
$tabmoreinfo = array();
// Loop on each line into llx_bank table. For each line, we should get:
@@ -199,8 +199,8 @@ if ($result) {
$lineisapurchase = -1;
$lineisasale = -1;
// Old method to detect if it's a sale or purchase
- if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase=1;
- if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale=1;
+ if ($obj->label == '(SupplierInvoicePayment)' || $obj->label == '(SupplierInvoicePaymentBack)') $lineisapurchase = 1;
+ if ($obj->label == '(CustomerInvoicePayment)' || $obj->label == '(CustomerInvoicePaymentBack)') $lineisasale = 1;
// Try a more reliable method to detect if record is a supplier payment or a customer payment
if ($lineisapurchase < 0)
{
@@ -221,9 +221,9 @@ if ($result) {
if ($lineisapurchase > 0)
$compta_soc = (($obj->code_compta_fournisseur != "") ? $obj->code_compta_fournisseur : $account_supplier);
if ($lineisasale > 0)
- $compta_soc = (! empty($obj->code_compta) ? $obj->code_compta : $account_customer);
+ $compta_soc = (!empty($obj->code_compta) ? $obj->code_compta : $account_customer);
- $tabcompany[$obj->rowid] = array (
+ $tabcompany[$obj->rowid] = array(
'id' => $obj->socid,
'name' => $obj->name,
'code_compta' => $compta_soc,
@@ -231,9 +231,9 @@ if ($result) {
);
// Set accountancy code for user
- $compta_user = (! empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
+ $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee);
- $tabuser[$obj->rowid] = array (
+ $tabuser[$obj->rowid] = array(
'id' => $obj->userid,
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
'lastname' => $obj->lastname,
@@ -244,8 +244,8 @@ if ($result) {
// Variable bookkeeping ($obj->rowid is Bank Id)
$tabpay[$obj->rowid]["date"] = $obj->do;
- $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
- $tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
+ $tabpay[$obj->rowid]["type_payment"] = $obj->fk_type; // CHQ, VIR, LIQ, CB, ...
+ $tabpay[$obj->rowid]["ref"] = $obj->label; // By default. Not unique. May be changed later
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
@@ -254,14 +254,14 @@ if ($result) {
} else {
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
}
- $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
+ $links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
//var_dump($i);
//var_dump($tabpay);
//var_dump($tabcompany);
// By default
- $tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
+ $tabpay[$obj->rowid]['type'] = 'unknown'; // Can be SOLD, miscellaneous entry, payment of patient, or any old record with no links in bank_url.
$tabtype[$obj->rowid] = 'unknown';
$tabmoreinfo[$obj->rowid] = array();
@@ -287,18 +287,18 @@ if ($result) {
}
if ($links[$key]['type'] == 'withdraw') {
- $tabmoreinfo[$obj->rowid]['withdraw']=1;
+ $tabmoreinfo[$obj->rowid]['withdraw'] = 1;
}
if ($links[$key]['type'] == 'payment') {
$paymentstatic->id = $links[$key]['url_id'];
$paymentstatic->ref = $links[$key]['url_id'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this
$tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id;
} elseif ($links[$key]['type'] == 'payment_supplier') {
$paymentsupplierstatic->id = $links[$key]['url_id'];
$paymentsupplierstatic->ref = $links[$key]['url_id'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsupplierstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id;
} elseif ($links[$key]['type'] == 'company') {
$societestatic->id = $links[$key]['url_id'];
@@ -313,13 +313,13 @@ if ($result) {
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
- else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
+ else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
} elseif ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
$chargestatic->ref = $links[$key]['url_id'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $chargestatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$chargestatic->getNomUrl(2);
if (preg_match('/^\((.*)\)$/i', $links[$key]['label'], $reg)) {
if ($reg[1] == 'socialcontribution')
$reg[1] = 'SocialContribution';
@@ -332,13 +332,13 @@ if ($result) {
$tabpay[$obj->rowid]["paymentscid"] = $chargestatic->id;
$sqlmid = 'SELECT cchgsoc.accountancy_code';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "c_chargesociales cchgsoc ";
- $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
- $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
- $sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
- $sqlmid .= " WHERE bkurl.fk_bank=" . $obj->rowid;
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."c_chargesociales cchgsoc ";
+ $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."chargesociales as chgsoc ON chgsoc.fk_type=cchgsoc.id";
+ $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."paiementcharge as paycharg ON paycharg.fk_charge=chgsoc.rowid";
+ $sqlmid .= " INNER JOIN ".MAIN_DB_PREFIX."bank_url as bkurl ON bkurl.url_id=paycharg.rowid";
+ $sqlmid .= " WHERE bkurl.fk_bank=".$obj->rowid;
- dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
+ dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
@@ -348,14 +348,14 @@ if ($result) {
$paymentdonstatic->id = $links[$key]['url_id'];
$paymentdonstatic->ref = $links[$key]['url_id'];
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
} elseif ($links[$key]['type'] == 'member') {
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
$paymentsubscriptionstatic->label = $links[$key]['label'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsubscriptionstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
@@ -363,14 +363,14 @@ if ($result) {
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
$paymentsalstatic->label = $links[$key]['label'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentsalstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
} elseif ($links[$key]['type'] == 'payment_expensereport') {
$paymentexpensereportstatic->id = $links[$key]['url_id'];
@@ -380,25 +380,25 @@ if ($result) {
$paymentvariousstatic->id = $links[$key]['url_id'];
$paymentvariousstatic->ref = $links[$key]['url_id'];
$paymentvariousstatic->label = $links[$key]['label'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvariousstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentvariousstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
$paymentvariousstatic->fetch($paymentvariousstatic->id);
- $account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
- $account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
+ $account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
+ $account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
} elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id'];
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
- $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentloanstatic->getNomUrl(2);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
- $sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
- $sqlmid.= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid;
+ $sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
+ $sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid;
- dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
+ dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
@@ -408,7 +408,7 @@ if ($result) {
}
} elseif ($links[$key]['type'] == 'banktransfert') {
$accountLinestatic->fetch($links[$key]['url_id']);
- $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- ' .$accountLinestatic ->getNomUrl(1);
+ $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
@@ -420,14 +420,14 @@ if ($result) {
// If no links were found to know the amount on thirdparty, we try to guess it.
// This may happens on bank entries without the links lines to 'company'.
- if (empty($tabtp[$obj->rowid]) && ! empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record
+ if (empty($tabtp[$obj->rowid]) && !empty($tabmoreinfo[$obj->rowid]['withdraw'])) // If we dont find 'company' link because it is an old 'withdraw' record
{
foreach ($links as $key => $val) {
if ($links[$key]['type'] == 'payment') {
// Get thirdparty
$tmppayment->fetch($links[$key]['url_id']);
$arrayofamounts = $tmppayment->getAmountsArray();
- foreach($arrayofamounts as $invoiceid => $amount)
+ foreach ($arrayofamounts as $invoiceid => $amount)
{
$tmpinvoice->fetch($invoiceid);
$tmpinvoice->fetch_thirdparty();
@@ -478,7 +478,7 @@ var_dump($tabtp);
var_dump($tabtype);*/
// Write bookkeeping
-if (! $error && $action == 'writebookkeeping') {
+if (!$error && $action == 'writebookkeeping') {
$now = dol_now();
$error = 0;
@@ -501,7 +501,7 @@ if (! $error && $action == 'writebookkeeping') {
var_dump($tabbq);exit;*/
// Bank
- if (! $errorforline && is_array($tabbq[$key]))
+ if (!$errorforline && is_array($tabbq[$key]))
{
// Line into bank account
foreach ($tabbq[$key] as $k => $mt)
@@ -509,9 +509,9 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
- $reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
- if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
+ $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
+ if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@@ -528,7 +528,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
- $bookkeeping->credit = ($mt < 0 ? - $mt : 0);
+ $bookkeeping->credit = ($mt < 0 ? -$mt : 0);
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
@@ -562,7 +562,7 @@ if (! $error && $action == 'writebookkeeping') {
}
// Third party
- if (! $errorforline)
+ if (!$errorforline)
{
if (is_array($tabtp[$key]))
{
@@ -571,14 +571,14 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert')
{
- $reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
+ $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
}
else
{
- $reflabel.= dol_string_nohtmltag($val['soclib']);
+ $reflabel .= dol_string_nohtmltag($val['soclib']);
}
$bookkeeping = new BookKeeping($db);
@@ -590,7 +590,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->label_operation = $reflabel;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
- $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
+ $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
@@ -598,15 +598,15 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
- $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
- $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
+ $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
+ $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label;
} elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice
- $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
- $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
+ $bookkeeping->subledger_account = $k; // For payment, the subledger account is stored as $key of $tabtp
+ $bookkeeping->subledger_label = $tabcompany[$key]['name']; // $tabcompany is defined only if we are sure there is 1 thirdparty for the bank transaction
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
@@ -715,8 +715,8 @@ if (! $error && $action == 'writebookkeeping') {
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
- $reflabel.= dol_string_nohtmltag('WaitingAccount');
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
+ $reflabel .= dol_string_nohtmltag('WaitingAccount');
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
@@ -726,7 +726,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
- $bookkeeping->debit = ($mt < 0 ? - $mt : 0);
+ $bookkeeping->debit = ($mt < 0 ? -$mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
@@ -767,7 +767,7 @@ if (! $error && $action == 'writebookkeeping') {
setEventMessages('Try to insert a non balanced transaction in book for '.$ref.'. Canceled. Surely a bug.', null, 'errors');
}
- if (! $errorforline)
+ if (!$errorforline)
{
$db->commit();
}
@@ -776,11 +776,11 @@ if (! $error && $action == 'writebookkeeping') {
//print 'KO for line '.$key.' '.$error.'
';
$db->rollback();
- $MAXNBERRORS=5;
+ $MAXNBERRORS = 5;
if ($error >= $MAXNBERRORS)
{
setEventMessages($langs->trans("ErrorTooManyErrorsProcessStopped").' (>'.$MAXNBERRORS.')', null, 'errors');
- break; // Break in the foreach
+ break; // Break in the foreach
}
}
}
@@ -802,15 +802,15 @@ if (! $error && $action == 'writebookkeeping') {
// Must reload data, so we make a redirect
if (count($tabpay) != $error)
{
- $param='id_journal='.$id_journal;
- $param.='&date_startday='.$date_startday;
- $param.='&date_startmonth='.$date_startmonth;
- $param.='&date_startyear='.$date_startyear;
- $param.='&date_endday='.$date_endday;
- $param.='&date_endmonth='.$date_endmonth;
- $param.='&date_endyear='.$date_endyear;
- $param.='&in_bookkeeping='.$in_bookkeeping;
- header("Location: ".$_SERVER['PHP_SELF'].($param?'?'.$param:''));
+ $param = 'id_journal='.$id_journal;
+ $param .= '&date_startday='.$date_startday;
+ $param .= '&date_startmonth='.$date_startmonth;
+ $param .= '&date_startyear='.$date_startyear;
+ $param .= '&date_endday='.$date_endday;
+ $param .= '&date_endmonth='.$date_endmonth;
+ $param .= '&date_endyear='.$date_endyear;
+ $param .= '&in_bookkeeping='.$in_bookkeeping;
+ header("Location: ".$_SERVER['PHP_SELF'].($param ? '?'.$param : ''));
exit;
}
}
@@ -823,20 +823,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$filename = 'journal';
$type_export = 'journal';
- include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
+ include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
// CSV header line
- print '"' . $langs->transnoentitiesnoconv("BankId").'"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("PaymentMode") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("LedgerAccount") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("SubledgerAccount") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("Label"). '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("Journal") . '"' . $sep;
- print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep;
+ print '"'.$langs->transnoentitiesnoconv("BankId").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("Date").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("PaymentMode").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("AccountAccounting").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("LedgerAccount").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("SubledgerAccount").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("Label").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("Debit").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("Credit").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("Journal").'"'.$sep;
+ print '"'.$langs->transnoentitiesnoconv("Note").'"'.$sep;
print "\n";
foreach ($tabpay as $key => $val)
@@ -850,21 +850,21 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
- $reflabel.= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
- if (! empty($val['soclib'])) $reflabel .= " - " . dol_string_nohtmltag($val['soclib']);
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
+ $reflabel .= $langs->trans("Bank").' '.dol_string_nohtmltag($val['bank_account_ref']);
+ if (!empty($val['soclib'])) $reflabel .= " - ".dol_string_nohtmltag($val['soclib']);
- print '"' . $key . '"' . $sep;
- print '"' . $date . '"' . $sep;
- print '"' . $val["type_payment"] . '"' . $sep;
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print " " . $sep;
- print '"' . $reflabel . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
- print '"' . $journal . '"' . $sep;
- print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
+ print '"'.$key.'"'.$sep;
+ print '"'.$date.'"'.$sep;
+ print '"'.$val["type_payment"].'"'.$sep;
+ print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
+ print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
+ print " ".$sep;
+ print '"'.$reflabel.'"'.$sep;
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
+ print '"'.$journal.'"'.$sep;
+ print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n";
}
}
@@ -875,37 +875,37 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . ($val['soclib']?" - ":"");
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']).($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert')
{
- $reflabel.= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
+ $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
}
else
{
- $reflabel.= dol_string_nohtmltag($val['soclib']);
+ $reflabel .= dol_string_nohtmltag($val['soclib']);
}
- print '"' . $key . '"' . $sep;
- print '"' . $date . '"' . $sep;
- print '"' . $val["type_payment"] . '"' . $sep;
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
+ print '"'.$key.'"'.$sep;
+ print '"'.$date.'"'.$sep;
+ print '"'.$val["type_payment"].'"'.$sep;
+ print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
if ($tabtype[$key] == 'payment_supplier') {
- print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
- } elseif($tabtype[$key] == 'payment') {
- print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
- } elseif($tabtype[$key] == 'payment_expensereport') {
- print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
- } elseif($tabtype[$key] == 'payment_salary') {
- print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep;
+ print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep;
+ } elseif ($tabtype[$key] == 'payment') {
+ print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep;
+ } elseif ($tabtype[$key] == 'payment_expensereport') {
+ print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
+ } elseif ($tabtype[$key] == 'payment_salary') {
+ print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep;
} else {
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
+ print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
}
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
- print '"' . $reflabel . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . $journal . '"' . $sep;
- print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
+ print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
+ print '"'.$reflabel.'"'.$sep;
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
+ print '"'.$journal.'"'.$sep;
+ print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n";
}
}
@@ -914,20 +914,20 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib']) . " - ";
- $reflabel.= dol_string_nohtmltag('WaitingAccount');
+ if (!empty($val['lib'])) $reflabel .= dol_string_nohtmltag($val['lib'])." - ";
+ $reflabel .= dol_string_nohtmltag('WaitingAccount');
- print '"' . $key . '"' . $sep;
- print '"' . $date . '"' . $sep;
- print '"' . $val["type_payment"] . '"' . $sep;
- print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
- print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
- print "" . $sep;
- print '"' . $reflabel . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . $journal . '"' . $sep;
- print '"' . dol_string_nohtmltag($ref) . '"' . $sep;
+ print '"'.$key.'"'.$sep;
+ print '"'.$date.'"'.$sep;
+ print '"'.$val["type_payment"].'"'.$sep;
+ print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
+ print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep;
+ print "".$sep;
+ print '"'.$reflabel.'"'.$sep;
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
+ print '"'.$journal.'"'.$sep;
+ print '"'.dol_string_nohtmltag($ref).'"'.$sep;
print "\n";
}
}
@@ -954,16 +954,16 @@ if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("FinanceJournal"));
- $nom = $langs->trans("FinanceJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
- $builddate=dol_now();
+ $nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
+ $builddate = dol_now();
//$description = $langs->trans("DescFinanceJournal") . '
';
- $listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
- $period = $form->selectDate($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0) . ' - ' . $form->selectDate($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0);
- $period .= ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
+ $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
+ $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
+ $period .= ' - '.$langs->trans("JournalizationInLedgerStatus").' '.$form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
- $varlink = 'id_journal=' . $id_journal;
+ $varlink = 'id_journal='.$id_journal;
journalHead($nom, '', $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
@@ -994,15 +994,15 @@ if (empty($action) || $action == 'view') {
print '
';
print "
";
print "";
- print "" . $langs->trans("Date") . " ";
- print "" . $langs->trans("Piece") . ' (' . $langs->trans("ObjectsRef") . ") ";
- print "" . $langs->trans("AccountAccounting") . " ";
- print "" . $langs->trans("SubledgerAccount") . " ";
- print "" . $langs->trans("LabelOperation") . " ";
- print '' . $langs->trans("PaymentMode") . " ";
- print '' . $langs->trans("Debit") . " ";
- print '' . $langs->trans("Credit") . " ";
+ print "".$langs->trans("Date")." ";
+ print "".$langs->trans("Piece").' ('.$langs->trans("ObjectsRef").") ";
+ print "".$langs->trans("AccountAccounting")." ";
+ print "".$langs->trans("SubledgerAccount")." ";
+ print "".$langs->trans("LabelOperation")." ";
+ print ''.$langs->trans("PaymentMode")." ";
+ print ''.$langs->trans("Debit")." ";
+ print ''.$langs->trans("Credit")." ";
print " \n";
$r = '';
@@ -1057,15 +1057,15 @@ if (empty($action) || $action == 'view') {
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
- $reflabel.= $langs->trans("Bank").' '.$val['bank_account_ref'];
- if (! empty($val['soclib'])) $reflabel .= " - " . $val['soclib'];
+ if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
+ $reflabel .= $langs->trans("Bank").' '.$val['bank_account_ref'];
+ if (!empty($val['soclib'])) $reflabel .= " - ".$val['soclib'];
//var_dump($tabpay[$key]);
print '';
print '';
- print "" . $date . " ";
- print "" . $ref . " ";
+ print "".$date." ";
+ print "".$ref." ";
// Ledger account
print "";
$accounttoshow = length_accountg($k);
@@ -1087,9 +1087,9 @@ if (empty($action) || $action == 'view') {
print " ";
print $reflabel;
print " ";
- print '' . $val["type_payment"] . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
+ print ''.$val["type_payment"]." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
print " ";
}
}
@@ -1100,20 +1100,20 @@ if (empty($action) || $action == 'view') {
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= $val['lib'] . ($val['soclib']?" - ":"");
+ if (!empty($val['lib'])) $reflabel .= $val['lib'].($val['soclib'] ? " - " : "");
if ($tabtype[$key] == 'banktransfert')
{
- $reflabel.= $langs->trans('TransitionalAccount').' '.$account_transfer;
+ $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
}
else
{
- $reflabel.= $val['soclib'];
+ $reflabel .= $val['soclib'];
}
print '';
print '';
- print "" . $date . " ";
- print "" . $ref . " ";
+ print "".$date." ";
+ print "".$ref." ";
// Ledger account
print "";
$account_ledger = $k;
@@ -1137,19 +1137,19 @@ if (empty($action) || $action == 'view') {
}
else
{
- print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).' '; // We will use a waiting account
+ print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).' '; // We will use a waiting account
}
}
else
{
// We will refuse writing
- $errorstring='UnknownAccountForThirdpartyBlocking';
- if ($tabtype[$key] == 'payment') $errorstring='MainAccountForCustomersNotDefined';
- if ($tabtype[$key] == 'payment_supplier') $errorstring='MainAccountForSuppliersNotDefined';
- if ($tabtype[$key] == 'payment_expensereport') $errorstring='MainAccountForUsersNotDefined';
- if ($tabtype[$key] == 'payment_salary') $errorstring='MainAccountForUsersNotDefined';
- if ($tabtype[$key] == 'payment_vat') $errorstring='MainAccountForVatPaymentNotDefined';
- if ($tabtype[$key] == 'member') $errorstring='MainAccountForSubscriptionPaymentNotDefined';
+ $errorstring = 'UnknownAccountForThirdpartyBlocking';
+ if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined';
+ if ($tabtype[$key] == 'payment_supplier') $errorstring = 'MainAccountForSuppliersNotDefined';
+ if ($tabtype[$key] == 'payment_expensereport') $errorstring = 'MainAccountForUsersNotDefined';
+ if ($tabtype[$key] == 'payment_salary') $errorstring = 'MainAccountForUsersNotDefined';
+ if ($tabtype[$key] == 'payment_vat') $errorstring = 'MainAccountForVatPaymentNotDefined';
+ if ($tabtype[$key] == 'member') $errorstring = 'MainAccountForSubscriptionPaymentNotDefined';
print ''.$langs->trans($errorstring).' ';
}
}
@@ -1169,7 +1169,7 @@ if (empty($action) || $action == 'view') {
var_dump($tabtype[$key]);
var_dump($tabbq[$key]);*/
//print ''.$langs->trans("ThirdpartyAccountNotDefined").' ';
- if (! empty($tabcompany[$key]['code_compta']))
+ if (!empty($tabcompany[$key]['code_compta']))
{
if (in_array($tabtype[$key], array('payment_various'))) {
// For such case, if subledger is not defined, we won't use subledger accounts.
@@ -1187,10 +1187,10 @@ if (empty($action) || $action == 'view') {
}
}
print " ";
- print "" . $reflabel . " ";
- print '' . $val["type_payment"] . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
+ print "".$reflabel." ";
+ print ''.$val["type_payment"]." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
print " ";
}
}
@@ -1199,13 +1199,13 @@ if (empty($action) || $action == 'view') {
if ($mt)
{
$reflabel = '';
- if (! empty($val['lib'])) $reflabel .= $val['lib'] . " - ";
- $reflabel.= 'WaitingAccount';
+ if (!empty($val['lib'])) $reflabel .= $val['lib']." - ";
+ $reflabel .= 'WaitingAccount';
print '';
print '';
- print "" . $date . " ";
- print "" . $ref . " ";
+ print "".$date." ";
+ print "".$ref." ";
// Ledger account
print "";
/*if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
@@ -1223,10 +1223,10 @@ if (empty($action) || $action == 'view') {
else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE);
*/
print " ";
- print "" . $reflabel . " ";
- print '' . $val["type_payment"] . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
+ print "".$reflabel." ";
+ print ''.$val["type_payment"]." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
print " ";
}
}
@@ -1287,63 +1287,63 @@ function getSourceDocRef($val, $typerecord)
{
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
- $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
+ $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=".$val["paymentid"];
$ref = $langs->transnoentitiesnoconv("Invoice");
}
elseif ($typerecord == 'payment_supplier')
{
$sqlmid = 'SELECT payfac.fk_facturefourn as id, f.ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
- $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=" . $val["paymentsupplierid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementfourn_facturefourn as payfac, ".MAIN_DB_PREFIX."facture_fourn as f";
+ $sqlmid .= " WHERE payfac.fk_facturefourn = f.rowid AND payfac.fk_paiementfourn=".$val["paymentsupplierid"];
$ref = $langs->transnoentitiesnoconv("SupplierInvoice");
}
elseif ($typerecord == 'payment_expensereport')
{
$sqlmid = 'SELECT e.rowid as id, e.ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_expensereport as pe, " . MAIN_DB_PREFIX . "expensereport as e";
- $sqlmid .= " WHERE pe.rowid=" . $val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_expensereport as pe, ".MAIN_DB_PREFIX."expensereport as e";
+ $sqlmid .= " WHERE pe.rowid=".$val["paymentexpensereport"]." AND pe.fk_expensereport = e.rowid";
$ref = $langs->transnoentitiesnoconv("ExpenseReport");
}
elseif ($typerecord == 'payment_salary')
{
$sqlmid = 'SELECT s.rowid as ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_salary as s";
- $sqlmid .= " WHERE s.rowid=" . $val["paymentsalid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
+ $sqlmid .= " WHERE s.rowid=".$val["paymentsalid"];
$ref = $langs->transnoentitiesnoconv("SalaryPayment");
}
elseif ($typerecord == 'sc')
{
$sqlmid = 'SELECT sc.rowid as ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "paiementcharge as sc";
- $sqlmid .= " WHERE sc.rowid=" . $val["paymentscid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiementcharge as sc";
+ $sqlmid .= " WHERE sc.rowid=".$val["paymentscid"];
$ref = $langs->transnoentitiesnoconv("SocialContribution");
}
elseif ($typerecord == 'payment_vat')
{
$sqlmid = 'SELECT v.rowid as ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "tva as v";
- $sqlmid .= " WHERE v.rowid=" . $val["paymentvatid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."tva as v";
+ $sqlmid .= " WHERE v.rowid=".$val["paymentvatid"];
$ref = $langs->transnoentitiesnoconv("PaymentVat");
}
elseif ($typerecord == 'payment_donation')
{
$sqlmid = 'SELECT payd.fk_donation as ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_donation as payd";
- $sqlmid .= " WHERE payd.fk_donation=" . $val["paymentdonationid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_donation as payd";
+ $sqlmid .= " WHERE payd.fk_donation=".$val["paymentdonationid"];
$ref = $langs->transnoentitiesnoconv("Donation");
}
elseif ($typerecord == 'payment_loan')
{
$sqlmid = 'SELECT l.rowid as ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_loan as l";
- $sqlmid .= " WHERE l.rowid=" . $val["paymentloanid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_loan as l";
+ $sqlmid .= " WHERE l.rowid=".$val["paymentloanid"];
$ref = $langs->transnoentitiesnoconv("LoanPayment");
}
elseif ($typerecord == 'payment_various')
{
$sqlmid = 'SELECT v.rowid as ref';
- $sqlmid .= " FROM " . MAIN_DB_PREFIX . "payment_various as v";
- $sqlmid .= " WHERE v.rowid=" . $val["paymentvariousid"];
+ $sqlmid .= " FROM ".MAIN_DB_PREFIX."payment_various as v";
+ $sqlmid .= " WHERE v.rowid=".$val["paymentvariousid"];
$ref = $langs->transnoentitiesnoconv("VariousPayment");
}
// Add warning
@@ -1354,18 +1354,18 @@ function getSourceDocRef($val, $typerecord)
if ($sqlmid)
{
- dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
+ dol_syslog("accountancy/journal/bankjournal.php::sqlmid=".$sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid)
{
while ($objmid = $db->fetch_object($resultmid))
{
- $ref.=' '.$objmid->ref;
+ $ref .= ' '.$objmid->ref;
}
}
else dol_print_error($db);
}
- $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
+ $ref = dol_trunc($langs->transnoentitiesnoconv("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
return $ref;
}
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index 29131274c7a..d0a84c1236c 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %';
+ $bookkeeping->label_operation = $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %';
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@@ -448,36 +448,36 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true);
if ($mt) {
- print '"' . $date . '"' . $sep;
- print '"' . $val["ref"] . '"' . $sep;
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
+ print '"'.$date.'"'.$sep;
+ print '"'.$val["ref"].'"'.$sep;
+ print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
+ print '"'.dol_trunc($accountingaccount->label, 32).'"'.$sep;
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
+ print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// VAT
foreach ($tabtva[$key] as $k => $mt) {
if ($mt) {
- print '"' . $date . '"' . $sep;
- print '"' . $val["ref"] . '"' . $sep;
- print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
- print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
+ print '"'.$date.'"'.$sep;
+ print '"'.$val["ref"].'"'.$sep;
+ print '"'.length_accountg(html_entity_decode($k)).'"'.$sep;
+ print '"'.dol_trunc($langs->trans("VAT")).'"'.$sep;
+ print '"'.($mt >= 0 ? price($mt) : '').'"'.$sep;
+ print '"'.($mt < 0 ? price(-$mt) : '').'"';
print "\n";
}
}
// Third party
foreach ($tabttc[$key] as $k => $mt) {
- print '"' . $date . '"' . $sep;
- print '"' . $val["ref"] . '"' . $sep;
- print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
- print '"' . dol_trunc($userstatic->name) . '"' . $sep;
- print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
- print '"' . ($mt >= 0 ? price($mt) : '') . '"';
+ print '"'.$date.'"'.$sep;
+ print '"'.$val["ref"].'"'.$sep;
+ print '"'.length_accounta(html_entity_decode($k)).'"'.$sep;
+ print '"'.dol_trunc($userstatic->name).'"'.$sep;
+ print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep;
+ print '"'.($mt >= 0 ? price($mt) : '').'"';
}
print "\n";
}
@@ -641,8 +641,8 @@ if (empty($action) || $action == 'view') {
if ($mt) {
print '';
print "";
- print "" . $date . " ";
- print "" . $expensereportstatic->getNomUrl(1) . " ";
+ print "".$date." ";
+ print "".$expensereportstatic->getNomUrl(1)." ";
// Account
print "";
$accountoshow = length_accountg($k);
@@ -655,10 +655,10 @@ if (empty($action) || $action == 'view') {
// Subledger account
print " ";
print ' ';
- print "" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
+ print " ".$userstatic->getNomUrl(0, 'user', 16).' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
print " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
print " ";
}
}
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index c7fb4c06304..dd7dc1ca9e1 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -301,7 +301,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
- $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
+ $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
@@ -310,7 +310,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
@@ -329,14 +329,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='alreadyjournalized';
+ $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='other';
+ $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@@ -344,7 +344,7 @@ if ($action == 'writebookkeeping') {
}
// Product / Service
- if (! $errorforline)
+ if (!$errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
@@ -356,13 +356,13 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
- $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
+ $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@@ -381,14 +381,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='alreadyjournalized';
+ $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='other';
+ $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@@ -398,10 +398,10 @@ if ($action == 'writebookkeeping') {
// VAT
// var_dump($tabtva);
- if (! $errorforline)
+ if (!$errorforline)
{
- $listoftax=array(0, 1, 2);
- foreach($listoftax as $numtax)
+ $listoftax = array(0, 1, 2);
+ foreach ($listoftax as $numtax)
{
$arrayofvat = $tabtva;
if ($numtax == 1) $arrayofvat = $tablocaltax1;
@@ -416,7 +416,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
- $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
+ $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
@@ -425,7 +425,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@@ -444,14 +444,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='alreadyjournalized';
+ $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='other';
+ $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@@ -462,7 +462,7 @@ if ($action == 'writebookkeeping') {
// Counterpart of VAT for VAT NPR
// var_dump($tabother);
- if (! $errorforline && is_array($tabother[$key]))
+ if (!$errorforline && is_array($tabother[$key]))
{
foreach ($tabother[$key] as $k => $mt) {
if ($mt) {
@@ -478,7 +478,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("VAT").' NPR';
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("VAT").' NPR';
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
@@ -513,7 +513,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on lines before
- if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
+ if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{
$error++;
$errorforline++;
@@ -863,8 +863,8 @@ if (empty($action) || $action == 'view') {
foreach ($tabttc[$key] as $k => $mt) {
print '';
print "";
- print "" . $date . " ";
- print "" . $invoicestatic->getNomUrl(1) . " ";
+ print "".$date." ";
+ print "".$invoicestatic->getNomUrl(1)." ";
// Account
print "";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
@@ -883,9 +883,9 @@ if (empty($action) || $action == 'view') {
}
else print $accountoshow;
print ' ';
- print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . " ";
- print ''. ($mt < 0 ? price(- $mt) : '') . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
+ print "".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$langs->trans("SubledgerAccount")." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
print " ";
}
@@ -896,8 +896,8 @@ if (empty($action) || $action == 'view') {
print '';
print "";
- print "" . $date . " ";
- print "" . $invoicestatic->getNomUrl(1) . " ";
+ print "".$date." ";
+ print "".$invoicestatic->getNomUrl(1)." ";
// Account
print "";
$accountoshow = length_accountg($k);
@@ -912,9 +912,9 @@ if (empty($action) || $action == 'view') {
print ' ';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
- print "" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
+ print "".$companystatic->getNomUrl(0, 'supplier', 16).' - '.$invoicestatic->ref_supplier.' - '.$accountingaccount->label." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
print " ";
}
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 878270d3687..80603106cb3 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -99,31 +99,31 @@ $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_r
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
-$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
-$sql .= " JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
+$sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
+$sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture";
+$sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
$sql .= " WHERE fd.fk_code_ventilation > 0";
-$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
+$sql .= " AND f.entity IN (".getEntity('invoice', 0).')'; // We don't share object for accountancy, we use source object sharing
$sql .= " AND f.fk_statut > 0";
-if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
+if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Non common setup
+ $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")";
} else {
- $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
+ $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")";
}
$sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end)
- $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
+ $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
// Already in bookkeeping or not
if ($in_bookkeeping == 'already')
{
- $sql .= " AND f.rowid IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
+ $sql .= " AND f.rowid IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
}
if ($in_bookkeeping == 'notyet')
{
- $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
+ $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
}
$sql .= " ORDER BY f.datef";
@@ -312,7 +312,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
- $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
+ $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
@@ -321,7 +321,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
@@ -340,14 +340,14 @@ if ($action == 'writebookkeeping') {
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='alreadyjournalized';
+ $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
- $errorforinvoice[$key]='other';
+ $errorforinvoice[$key] = 'other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
@@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') {
}
// Product / Service
- if (! $errorforline)
+ if (!$errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
@@ -373,7 +373,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@@ -408,10 +408,10 @@ if ($action == 'writebookkeeping') {
}
// VAT
- if (! $errorforline)
+ if (!$errorforline)
{
- $listoftax=array(0, 1, 2);
- foreach($listoftax as $numtax)
+ $listoftax = array(0, 1, 2);
+ foreach ($listoftax as $numtax)
{
$arrayofvat = $tabtva;
if ($numtax == 1) $arrayofvat = $tablocaltax1;
@@ -426,7 +426,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
- $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
+ $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
@@ -435,7 +435,7 @@ if ($action == 'writebookkeeping') {
$accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label;
- $bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]) .' %' . ($numtax?' - Localtax '.$numtax:'');
+ $bookkeeping->label_operation = dol_trunc($companystatic->name, 16).' - '.$invoicestatic->ref.' - '.$langs->trans("VAT").' '.join(', ', $def_tva[$key][$k]).' %'.($numtax ? ' - Localtax '.$numtax : '');
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
@@ -471,7 +471,7 @@ if ($action == 'writebookkeeping') {
}
// Protection against a bug on lines before
- if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
+ if (!$errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')))
{
$error++;
$errorforline++;
@@ -799,8 +799,8 @@ if (empty($action) || $action == 'view') {
{
print '';
print "";
- print "" . $date . " ";
- print "" . $invoicestatic->getNomUrl(1) . " ";
+ print "".$date." ";
+ print "".$invoicestatic->getNomUrl(1)." ";
// Account
print "";
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
@@ -819,9 +819,9 @@ if (empty($action) || $action == 'view') {
}
else print $accountoshow;
print ' ';
- print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
+ print "".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$langs->trans("SubledgerAccount")." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
print " ";
}
@@ -833,8 +833,8 @@ if (empty($action) || $action == 'view') {
print '';
print "";
- print "" . $date . " ";
- print "" . $invoicestatic->getNomUrl(1) . " ";
+ print "".$date." ";
+ print "".$invoicestatic->getNomUrl(1)." ";
// Account
print "";
$accountoshow = length_accountg($k);
@@ -849,9 +849,9 @@ if (empty($action) || $action == 'view') {
print ' ';
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
- print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . " ";
- print '' . ($mt < 0 ? price(- $mt) : '') . " ";
- print '' . ($mt >= 0 ? price($mt) : '') . " ";
+ print "".$companystatic->getNomUrl(0, 'customer', 16).' - '.$invoicestatic->ref.' - '.$accountingaccount->label." ";
+ print ''.($mt < 0 ? price(-$mt) : '')." ";
+ print ''.($mt >= 0 ? price($mt) : '')." ";
print " ";
}
diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php
index 72c1e078ba0..6b2d432fe46 100644
--- a/htdocs/adherents/admin/adherent.php
+++ b/htdocs/adherents/admin/adherent.php
@@ -34,12 +34,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("admin","members"));
+$langs->loadLangs(array("admin", "members"));
-if (! $user->admin) accessforbidden();
+if (!$user->admin) accessforbidden();
-$type=array('yesno','texte','chaine');
+$type = array('yesno', 'texte', 'chaine');
$action = GETPOST('action', 'alpha');
@@ -52,19 +52,19 @@ $action = GETPOST('action', 'alpha');
if ($action == 'updateall')
{
$db->begin();
- $res1=$res2=$res3=$res4=$res5=$res6=0;
- $res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha')?0:1, 'chaine', 0, '', $conf->entity);
- $res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
- $res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
- $res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
+ $res1 = dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha') ? 0 : 1, 'chaine', 0, '', $conf->entity);
+ $res2 = dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res3 = dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res4 = dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation
if ($conf->facture->enabled)
{
- $res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
- $res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
- if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
+ $res4 = dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res5 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
+ if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
{
- $res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res6 = dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
}
}
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
@@ -82,23 +82,23 @@ if ($action == 'updateall')
// Action to update or add a constant
if ($action == 'update' || $action == 'add')
{
- $constname=GETPOST('constname', 'alpha');
- $constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
+ $constname = GETPOST('constname', 'alpha');
+ $constvalue = (GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
- if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue='';
- if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
+ if (($constname == 'ADHERENT_CARD_TYPE' || $constname == 'ADHERENT_ETIQUETTE_TYPE' || $constname == 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue = '';
+ if ($constname == 'ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{
- if ($constvalue) $constvalue=0;
- else $constvalue=1;
+ if ($constvalue) $constvalue = 0;
+ else $constvalue = 1;
}
- $consttype=GETPOST('consttype', 'alpha');
- $constnote=GETPOST('constnote');
- $res=dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
+ $consttype = GETPOST('consttype', 'alpha');
+ $constnote = GETPOST('constnote');
+ $res = dolibarr_set_const($db, $constname, $constvalue, $type[$consttype], 0, $constnote, $conf->entity);
- if (! $res > 0) $error++;
+ if (!$res > 0) $error++;
- if (! $error)
+ if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@@ -111,7 +111,7 @@ if ($action == 'update' || $action == 'add')
// Action to enable of a submodule of the adherent module
if ($action == 'set')
{
- $result=dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
+ $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0)
{
print $db->error();
@@ -121,7 +121,7 @@ if ($action == 'set')
// Action to disable a submodule of the adherent module
if ($action == 'unset')
{
- $result=dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
+ $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0)
{
print $db->error();
@@ -136,12 +136,12 @@ if ($action == 'unset')
$form = new Form($db);
-$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
+$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url);
-$linkback=''.$langs->trans("BackToModuleList").' ';
+$linkback = ''.$langs->trans("BackToModuleList").' ';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@@ -162,25 +162,25 @@ print "\n";
// Login/Pass required for members
print ''.$langs->trans("AdherentLoginRequired").' ';
-print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1), 1);
+print $form->selectyesno('ADHERENT_LOGIN_NOT_REQUIRED', (!empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED) ? 0 : 1), 1);
print " \n";
// Mail required for members
print ''.$langs->trans("AdherentMailRequired").' ';
-print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0), 1);
+print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (!empty($conf->global->ADHERENT_MAIL_REQUIRED) ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
print " \n";
// Send mail information is on by default
print ''.$langs->trans("MemberSendInformationByMailByDefault").' ';
-print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0), 1);
+print $form->selectyesno('ADHERENT_DEFAULT_SENDINFOBYMAIL', (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? $conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL : 0), 1);
print " \n";
// Insert subscription into bank account
print ''.$langs->trans("MoreActionsOnSubscription").' ';
-$arraychoices=array('0'=>$langs->trans("None"));
-if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect");
-if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly");
-if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice");
+$arraychoices = array('0'=>$langs->trans("None"));
+if (!empty($conf->banque->enabled)) $arraychoices['bankdirect'] = $langs->trans("MoreActionBankDirect");
+if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['invoiceonly'] = $langs->trans("MoreActionInvoiceOnly");
+if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty($conf->facture->enabled)) $arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
print '';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice')
@@ -194,10 +194,10 @@ print " \n";
if ($conf->facture->enabled)
{
print ''.$langs->trans("VATToUseForSubscriptions").' ';
- if (! empty($conf->banque->enabled))
+ if (!empty($conf->banque->enabled))
{
print '';
- print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"),'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS)?'0':$conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
+ print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0);
print ' ';
}
else
@@ -208,7 +208,7 @@ if ($conf->facture->enabled)
}
print " \n";
- if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
+ if (!empty($conf->product->enabled) || !empty($conf->service->enabled))
{
print ''.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").' ';
print '';
@@ -232,7 +232,7 @@ print ' ';
/*
* Edit info of model document
*/
-$constantes=array(
+$constantes = array(
'ADHERENT_CARD_TYPE',
// 'ADHERENT_CARD_BACKGROUND',
'ADHERENT_CARD_HEADER_TEXT',
@@ -243,10 +243,10 @@ $constantes=array(
print load_fiche_titre($langs->trans("MembersCards"), '', '');
-$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").' ';
-$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
-$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
-$helptext.='__YEAR__, __MONTH__, __DAY__';
+$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").' ';
+$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
+$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
+$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
@@ -256,14 +256,14 @@ print ' ';
/*
* Edit info of model document
*/
-$constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT');
+$constantes = array('ADHERENT_ETIQUETTE_TYPE', 'ADHERENT_ETIQUETTE_TEXT');
print load_fiche_titre($langs->trans("MembersTickets"), '', '');
-$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").' ';
-$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
-$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
-$helptext.='__YEAR__, __MONTH__, __DAY__';
+$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").' ';
+$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
+$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
+$helptext .= '__YEAR__, __MONTH__, __DAY__';
form_constantes($constantes, 0, $helptext);
diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php
index 9fef348315b..e0675a6124a 100644
--- a/htdocs/adherents/admin/adherent_emails.php
+++ b/htdocs/adherents/admin/adherent_emails.php
@@ -34,25 +34,25 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
// Load translation files required by the page
-$langs->loadLangs(array("admin","members"));
+$langs->loadLangs(array("admin", "members"));
-if (! $user->admin) accessforbidden();
+if (!$user->admin) accessforbidden();
-$oldtypetonewone=array('texte'=>'text','chaine'=>'string'); // old type to new ones
+$oldtypetonewone = array('texte'=>'text', 'chaine'=>'string'); // old type to new ones
$action = GETPOST('action', 'alpha');
$error = 0;
// Editing global variables not related to a specific theme
-$constantes=array(
+$constantes = array(
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
- 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
- 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
- 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
- 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
+ 'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
+ 'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
+ 'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
+ 'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
@@ -68,8 +68,8 @@ $constantes=array(
if ($action == 'updateall')
{
$db->begin();
- $res1=$res2=$res3=$res4=$res5=$res6=0;
- $res1=dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
+ $res1 = $res2 = $res3 = $res4 = $res5 = $res6 = 0;
+ $res1 = dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
{
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
@@ -86,19 +86,19 @@ if ($action == 'updateall')
if ($action == 'update' || $action == 'add')
{
$constlineid = GETPOST('rowid', 'int');
- $constname=GETPOST('constname', 'alpha');
+ $constname = GETPOST('constname', 'alpha');
- $constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
- $consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
- $constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
+ $constvalue = (GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
+ $consttype = (GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
+ $constnote = (GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
- $res=dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
+ $res = dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
- if (! $res > 0) $error++;
+ if (!$res > 0) $error++;
- if (! $error)
+ if (!$error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
@@ -111,7 +111,7 @@ if ($action == 'update' || $action == 'add')
// Action to enable a submodule of the adherent module
if ($action == 'set')
{
- $result=dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
+ $result = dolibarr_set_const($db, GETPOST('name', 'alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0)
{
print $db->error();
@@ -121,7 +121,7 @@ if ($action == 'set')
// Action to disable a submodule of the adherent module
if ($action == 'unset')
{
- $result=dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
+ $result = dolibarr_del_const($db, GETPOST('name', 'alpha'), $conf->entity);
if ($result < 0)
{
print $db->error();
@@ -136,12 +136,12 @@ if ($action == 'unset')
$form = new Form($db);
-$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
+$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url);
-$linkback=''.$langs->trans("BackToModuleList").' ';
+$linkback = ''.$langs->trans("BackToModuleList").' ';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@@ -154,9 +154,9 @@ dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
//print ' ';
//print ' ';
-$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").' ';
-$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
-$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
+$helptext = '*'.$langs->trans("FollowingConstantsWillBeSubstituted").' ';
+$helptext .= '__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
+$helptext .= '__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
//$helptext.='__YEAR__, __MONTH__, __DAY__'; // Not supported
form_constantes($constantes, 0, $helptext);
diff --git a/htdocs/adherents/admin/adherent_extrafields.php b/htdocs/adherents/admin/adherent_extrafields.php
index 6f2b899dc5c..73e1a519c59 100644
--- a/htdocs/adherents/admin/adherent_extrafields.php
+++ b/htdocs/adherents/admin/adherent_extrafields.php
@@ -29,19 +29,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("admin","members"));
+$langs->loadLangs(array("admin", "members"));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
-$tmptype2label=ExtraFields::$type2label;
-$type2label=array('');
-foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
+$tmptype2label = ExtraFields::$type2label;
+$type2label = array('');
+foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
-$action=GETPOST('action', 'alpha');
-$attrname=GETPOST('attrname', 'alpha');
-$elementtype='adherent'; //Must be the $table_element of the class that manage extrafield
+$action = GETPOST('action', 'alpha');
+$attrname = GETPOST('attrname', 'alpha');
+$elementtype = 'adherent'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
@@ -60,11 +60,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
$textobject = $langs->transnoentitiesnoconv("Members");
-$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
+$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url);
-$linkback=''.$langs->trans("BackToModuleList").' ';
+$linkback = ''.$langs->trans("BackToModuleList").' ';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@@ -105,7 +105,7 @@ if ($action == 'create')
/* Edition of an optional field */
/* */
/* ************************************************************************** */
-if ($action == 'edit' && ! empty($attrname))
+if ($action == 'edit' && !empty($attrname))
{
print '
';
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
diff --git a/htdocs/adherents/admin/adherent_type_extrafields.php b/htdocs/adherents/admin/adherent_type_extrafields.php
index cd73320d02d..7864505f2e1 100644
--- a/htdocs/adherents/admin/adherent_type_extrafields.php
+++ b/htdocs/adherents/admin/adherent_type_extrafields.php
@@ -32,19 +32,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("admin","members"));
+$langs->loadLangs(array("admin", "members"));
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
-$tmptype2label=ExtraFields::$type2label;
-$type2label=array('');
-foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->transnoentitiesnoconv($val);
+$tmptype2label = ExtraFields::$type2label;
+$type2label = array('');
+foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
-$action=GETPOST('action', 'alpha');
-$attrname=GETPOST('attrname', 'alpha');
-$elementtype='adherent_type'; //Must be the $table_element of the class that manage extrafield
+$action = GETPOST('action', 'alpha');
+$attrname = GETPOST('attrname', 'alpha');
+$elementtype = 'adherent_type'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
@@ -61,13 +61,13 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
* View
*/
-$textobject=$langs->transnoentitiesnoconv("MembersTypes");
+$textobject = $langs->transnoentitiesnoconv("MembersTypes");
-$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
+$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url);
-$linkback=''.$langs->trans("BackToModuleList").' ';
+$linkback = ''.$langs->trans("BackToModuleList").' ';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
@@ -108,7 +108,7 @@ if ($action == 'create')
/* Edition of an optional field */
/* */
/* ************************************************************************** */
-if ($action == 'edit' && ! empty($attrname))
+if ($action == 'edit' && !empty($attrname))
{
print " ";
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php
index a2eead267af..a8cdc06784e 100644
--- a/htdocs/adherents/admin/website.php
+++ b/htdocs/adherents/admin/website.php
@@ -178,34 +178,34 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC))
$listofval = array();
$listofval += $adht->liste_array();
$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1;
- print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval)>1?1:0);
+ print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listofval) > 1 ? 1 : 0);
print " \n";
// Amount
print '';
print $langs->trans("DefaultAmount");
print ' ';
- print ' ';
+ print ' ';
print " \n";
// Can edit
print '';
print $langs->trans("CanEditAmount");
print ' ';
- print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0), 1);
+ print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT", (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) ? $conf->global->MEMBER_NEWFORM_EDITAMOUNT : 0), 1);
print " \n";
// Jump to an online payment page
print '';
print $langs->trans("MEMBER_NEWFORM_PAYONLINE");
print ' ';
- $listofval=array();
- $listofval['-1']=$langs->trans('No');
- $listofval['all']=$langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
- if (! empty($conf->paybox->enabled)) $listofval['paybox']='Paybox';
- if (! empty($conf->paypal->enabled)) $listofval['paypal']='PayPal';
- if (! empty($conf->stripe->enabled)) $listofval['stripe']='Stripe';
- print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (! empty($conf->global->MEMBER_NEWFORM_PAYONLINE)?$conf->global->MEMBER_NEWFORM_PAYONLINE:''), 0);
+ $listofval = array();
+ $listofval['-1'] = $langs->trans('No');
+ $listofval['all'] = $langs->trans('Yes').' ('.$langs->trans("VisitorCanChooseItsPaymentMode").')';
+ if (!empty($conf->paybox->enabled)) $listofval['paybox'] = 'Paybox';
+ if (!empty($conf->paypal->enabled)) $listofval['paypal'] = 'PayPal';
+ if (!empty($conf->stripe->enabled)) $listofval['stripe'] = 'Stripe';
+ print $form->selectarray("MEMBER_NEWFORM_PAYONLINE", $listofval, (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) ? $conf->global->MEMBER_NEWFORM_PAYONLINE : ''), 0);
print " \n";
print '
';
diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php
index 019f35f2908..20d712e6179 100644
--- a/htdocs/adherents/agenda.php
+++ b/htdocs/adherents/agenda.php
@@ -149,24 +149,24 @@ if ($object->id > 0)
$newcardbutton = '';
- if (! empty($conf->agenda->enabled))
+ if (!empty($conf->agenda->enabled))
{
- $newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
+ $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&backtopage=1&origin=member&originid='.$id);
}
- if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
+ if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
{
print '
';
- $param='&id='.$id;
- if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
- if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
+ $param = '&id='.$id;
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $newcardbutton, '', 0, 1, 1);
// List of all actions
- $filters=array();
- $filters['search_agenda_label']=$search_agenda_label;
+ $filters = array();
+ $filters['search_agenda_label'] = $search_agenda_label;
// TODO Replace this with same code than into list.php
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
index 0f954ecf201..eeee48e2138 100644
--- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php
+++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php
@@ -45,7 +45,7 @@ abstract class ActionsAdherentCardCommon
/**
* @var string Error code (or message)
*/
- public $error='';
+ public $error = '';
/**
* @var string[] Error codes (or messages)
@@ -70,7 +70,7 @@ abstract class ActionsAdherentCardCommon
else
{*/
$object = new Adherent($this->db);
- if (! empty($id)) $object->fetch($id);
+ if (!empty($id)) $object->fetch($id);
$this->object = $object;
//}
}
@@ -91,13 +91,13 @@ abstract class ActionsAdherentCardCommon
if ($action == 'add' || $action == 'update') $this->assign_post();
- foreach($this->object as $key => $value)
+ foreach ($this->object as $key => $value)
{
$this->tpl[$key] = $value;
}
- $this->tpl['error']=$this->error;
- $this->tpl['errors']=$this->errors;
+ $this->tpl['error'] = $this->error;
+ $this->tpl['errors'] = $this->errors;
if ($action == 'create' || $action == 'edit')
{
@@ -139,10 +139,10 @@ abstract class ActionsAdherentCardCommon
}
// Zip
- $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town','selectcountry_id','state_id'), 6);
+ $this->tpl['select_zip'] = $formcompany->select_ziptown($this->object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6);
// Town
- $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode','selectcountry_id','state_id'));
+ $this->tpl['select_town'] = $formcompany->select_ziptown($this->object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
if (dol_strlen(trim($this->object->country_id)) == 0) $this->object->country_id = $objsoc->country_id;
@@ -157,14 +157,14 @@ abstract class ActionsAdherentCardCommon
else $this->tpl['select_state'] = $countrynotdefined;
// Physical or Moral
- $selectarray=array('0'=>$langs->trans("Physical"),'1'=>$langs->trans("Moral"));
+ $selectarray = array('0'=>$langs->trans("Physical"), '1'=>$langs->trans("Moral"));
$this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0);
}
if ($action == 'view' || $action == 'edit' || $action == 'delete')
{
// Emailing
- if (! empty($conf->mailing->enabled))
+ if (!empty($conf->mailing->enabled))
{
$langs->load("mails");
$this->tpl['nb_emailing'] = $this->object->getNbOfEMailings();
@@ -173,8 +173,8 @@ abstract class ActionsAdherentCardCommon
// Dolibarr user
if ($this->object->user_id)
{
- $dolibarr_user=new User($this->db);
- $result=$dolibarr_user->fetch($this->object->user_id);
+ $dolibarr_user = new User($this->db);
+ $result = $dolibarr_user->fetch($this->object->user_id);
$this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1);
}
else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess");
@@ -200,14 +200,14 @@ abstract class ActionsAdherentCardCommon
$this->tpl['address'] = dol_nl2br($this->object->address);
- $this->tpl['zip'] = ($this->object->zip?$this->object->zip.' ':'');
+ $this->tpl['zip'] = ($this->object->zip ? $this->object->zip.' ' : '');
- $img=picto_from_langcode($this->object->country_code);
- $this->tpl['country'] = ($img?$img.' ':'').$this->object->country;
+ $img = picto_from_langcode($this->object->country_code);
+ $this->tpl['country'] = ($img ? $img.' ' : '').$this->object->country;
- $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
- $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
- $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
+ $this->tpl['phone_perso'] = dol_print_phone($this->object->phone_perso, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
+ $this->tpl['phone_mobile'] = dol_print_phone($this->object->phone_mobile, $this->object->country_code, 0, $this->object->id, 'AC_TEL');
+ $this->tpl['email'] = dol_print_email($this->object->email, 0, $this->object->id, 'AC_EMAIL');
$this->tpl['visibility'] = $this->object->getmorphylib($this->object->morphy);
@@ -219,13 +219,13 @@ abstract class ActionsAdherentCardCommon
// Full firstname and lastname separated with a dot : firstname.lastname
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
- $login=dol_buildlogin($this->object->lastname, $this->object->firstname);
+ $login = dol_buildlogin($this->object->lastname, $this->object->firstname);
- $generated_password=getRandomPassword(false);
- $password=$generated_password;
+ $generated_password = getRandomPassword(false);
+ $password = $generated_password;
// Create a form array
- $formquestion=array(
+ $formquestion = array(
array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login),
array('label' => $langs->trans("Password"), 'type' => 'text', 'name' => 'password', 'value' => $password));
@@ -244,35 +244,35 @@ abstract class ActionsAdherentCardCommon
// phpcs:enable
global $langs, $mysoc;
- $this->object->old_name = $_POST["old_name"];
- $this->object->old_firstname = $_POST["old_firstname"];
+ $this->object->old_name = $_POST["old_name"];
+ $this->object->old_firstname = $_POST["old_firstname"];
- $this->object->fk_soc = $_POST["fk_soc"];
+ $this->object->fk_soc = $_POST["fk_soc"];
$this->object->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"];
- $this->object->civility_id = $_POST["civility_id"];
- $this->object->address = $_POST["address"];
- $this->object->zip = $_POST["zipcode"];
- $this->object->town = $_POST["town"];
- $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
- $this->object->state_id = $_POST["state_id"];
- $this->object->phone_perso = $_POST["phone_perso"];
- $this->object->phone_mobile = $_POST["phone_mobile"];
+ $this->object->civility_id = $_POST["civility_id"];
+ $this->object->address = $_POST["address"];
+ $this->object->zip = $_POST["zipcode"];
+ $this->object->town = $_POST["town"];
+ $this->object->country_id = $_POST["country_id"] ? $_POST["country_id"] : $mysoc->country_id;
+ $this->object->state_id = $_POST["state_id"];
+ $this->object->phone_perso = $_POST["phone_perso"];
+ $this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"];
$this->object->note = $_POST["note"];
- $this->object->canvas = $_POST["canvas"];
+ $this->object->canvas = $_POST["canvas"];
// We set country_id, and country_code label of the chosen country
if ($this->object->country_id)
{
$sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id;
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
$obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code;
- $this->object->country = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
+ $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle;
}
else
{
diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
index eb295431e8d..60bb2ecd034 100644
--- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
+++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php
@@ -42,7 +42,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{
$this->db = $db;
- $this->dirmodule = $dirmodule;
+ $this->dirmodule = $dirmodule;
$this->targetmodule = $targetmodule;
$this->canvas = $canvas;
$this->card = $card;
@@ -56,13 +56,13 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
*/
private function getTitle($action)
{
- global $langs,$conf;
+ global $langs, $conf;
- $out='';
+ $out = '';
- if ($action == 'view') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
- if ($action == 'edit') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
- if ($action == 'create') $out.= (! empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
+ if ($action == 'view') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("Adherent") : $langs->trans("ContactAddress"));
+ if ($action == 'edit') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("EditAdherent") : $langs->trans("EditAdherentAddress"));
+ if ($action == 'create') $out .= (!empty($conf->global->ADHERENT_ADDRESSES_MANAGEMENT) ? $langs->trans("NewAdherent") : $langs->trans("NewAdherentAddress"));
return $out;
}
@@ -88,7 +88,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$this->tpl['title'] = $this->getTitle($action);
$this->tpl['error'] = $this->error;
- $this->tpl['errors']= $this->errors;
+ $this->tpl['errors'] = $this->errors;
if ($action == 'view')
{
@@ -96,15 +96,15 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
$head = member_prepare_head($this->object);
$title = $this->getTitle($action);
- $this->tpl['showhead']=dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
- $this->tpl['showend']=dol_get_fiche_end();
+ $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', $title, 0, 'adherent');
+ $this->tpl['showend'] = dol_get_fiche_end();
$objsoc = new Societe($db);
$objsoc->fetch($this->object->socid);
- $this->tpl['actionstodo']=show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
+ $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1);
- $this->tpl['actionsdone']=show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
+ $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1);
}
else
{
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
index dcab3116f53..92f1e11d7a2 100644
--- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
+++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php
@@ -17,7 +17,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -30,9 +30,9 @@ if (empty($conf) || ! is_object($conf))
control->tpl['title']);
-dol_htmloutput_errors((is_numeric($object->error)?'':$object->error), $object->errors);
+dol_htmloutput_errors((is_numeric($object->error) ? '' : $object->error), $object->errors);
-dol_htmloutput_errors((is_numeric($GLOBALS['error'])?'':$GLOBALS['error']), $GLOBALS['errors']);
+dol_htmloutput_errors((is_numeric($GLOBALS['error']) ? '' : $GLOBALS['error']), $GLOBALS['errors']);
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
index d49d43825bb..36e2deab14c 100644
--- a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
+++ b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php
@@ -17,7 +17,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -48,7 +48,7 @@ echo $this->control->tpl['ajax_selectcountry'];
-control->tpl['company_id'])) { ?>
+control->tpl['company_id'])) { ?>
diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
index 51f121ad903..b738f549247 100644
--- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
+++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php
@@ -17,7 +17,7 @@
*/
// Protection to avoid direct call of template
-if (empty($conf) || ! is_object($conf))
+if (empty($conf) || !is_object($conf))
{
print "Error, template page can't be called as URL";
exit;
@@ -30,8 +30,8 @@ echo "\n";
echo $this->control->tpl['showhead'];
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
-if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
-if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
+if (!empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
+if (!empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
@@ -125,7 +125,7 @@ if (empty($user->socid)) {
echo 'control->tpl['id'].'&action=edit&canvas='.$canvas.'">'.$langs->trans('Modify').' ';
}
- if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) {
+ if (!$this->control->tpl['user_id'] && $user->rights->user->user->creer) {
echo 'control->tpl['id'].'&action=create_user&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").' ';
}
diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php
index bb6391dcb8c..c913d6a1b49 100644
--- a/htdocs/adherents/card.php
+++ b/htdocs/adherents/card.php
@@ -1773,8 +1773,10 @@ else
if ($action != 'editlogin' && $action != 'editthirdparty')
{
// Send
- if ($object->statut == 1) {
- print '';
+ if (empty($user->socid)) {
+ if ($object->statut == 1) {
+ print '';
+ }
}
// Send card by email
diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php
index 6736a22cd5d..86bf523ac51 100644
--- a/htdocs/adherents/cartes/carte.php
+++ b/htdocs/adherents/cartes/carte.php
@@ -29,22 +29,22 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/member/modules_cards.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/printsheet/modules_labels.php';
-$langs->loadLangs(array("members","errors"));
+$langs->loadLangs(array("members", "errors"));
// Choice of printing year or current year.
$now = dol_now();
-$year=dol_print_date($now, '%Y');
-$month=dol_print_date($now, '%m');
-$day=dol_print_date($now, '%d');
-$foruserid=GETPOST('foruserid', 'alphanohtml');
-$foruserlogin=GETPOST('foruserlogin', 'alphanohtml');
-$mode=GETPOST('mode', 'aZ09');
-$model=GETPOST("model", 'aZ09'); // Doc template to use for business cards
-$modellabel=GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
-$mesg='';
+$year = dol_print_date($now, '%Y');
+$month = dol_print_date($now, '%m');
+$day = dol_print_date($now, '%d');
+$foruserid = GETPOST('foruserid', 'alphanohtml');
+$foruserlogin = GETPOST('foruserlogin', 'alphanohtml');
+$mode = GETPOST('mode', 'aZ09');
+$model = GETPOST("model", 'aZ09'); // Doc template to use for business cards
+$modellabel = GETPOST("modellabel", 'aZ09'); // Doc template to use for address sheet
+$mesg = '';
-$adherentstatic=new Adherent($db);
-$object=new Adherent($db);
+$adherentstatic = new Adherent($db);
+$object = new Adherent($db);
$extrafields = new ExtraFields($db);
// Fetch optionals attributes and labels
@@ -57,29 +57,29 @@ $extrafields->fetch_name_optionals_label($object->table_element);
if ($mode == 'cardlogin' && empty($foruserlogin))
{
- $mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
+ $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"));
}
-if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg)
+if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg)
{
- $arrayofmembers=array();
+ $arrayofmembers = array();
// request taking into account member with up to date subscriptions
$sql = "SELECT d.rowid, d.firstname, d.lastname, d.login, d.societe as company, d.datefin,";
- $sql.= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
- $sql.= " t.libelle as type,";
- $sql.= " c.code as country_code, c.label as country";
+ $sql .= " d.address, d.zip, d.town, d.country, d.birth, d.email, d.photo,";
+ $sql .= " t.libelle as type,";
+ $sql .= " c.code as country_code, c.label as country";
// Add fields from extrafields
- if (! empty($extrafields->attributes[$object->table_element]['label']))
- foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
- $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
- $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
- if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
- $sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
- $sql.= " AND d.entity IN (".getEntity('adherent').")";
- if (is_numeric($foruserid)) $sql.=" AND d.rowid=".$foruserid;
- if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'";
- $sql.= " ORDER BY d.rowid ASC";
+ if (!empty($extrafields->attributes[$object->table_element]['label']))
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON d.country = c.rowid";
+ if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_extrafields as ef on (d.rowid = ef.fk_object)";
+ $sql .= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1";
+ $sql .= " AND d.entity IN (".getEntity('adherent').")";
+ if (is_numeric($foruserid)) $sql .= " AND d.rowid=".$foruserid;
+ if ($foruserlogin) $sql .= " AND d.login='".$db->escape($foruserlogin)."'";
+ $sql .= " ORDER BY d.rowid ASC";
dol_syslog("Search members", LOG_DEBUG);
$result = $db->query($sql);
@@ -91,19 +91,19 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
{
$objp = $db->fetch_object($result);
- if ($objp->country == '-') $objp->country='';
+ if ($objp->country == '-') $objp->country = '';
- $adherentstatic->id=$objp->rowid;
- $adherentstatic->lastname=$objp->lastname;
- $adherentstatic->firstname=$objp->firstname;
+ $adherentstatic->id = $objp->rowid;
+ $adherentstatic->lastname = $objp->lastname;
+ $adherentstatic->firstname = $objp->firstname;
// Format extrafield so they can be parsed in function complete_substitutions_array
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
{
$adherentstatic->array_options = array();
- foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
+ foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val)
{
- $tmpkey='options_'.$key;
+ $tmpkey = 'options_'.$key;
if (!empty($objp->$tmpkey))
{
$adherentstatic->array_options[$tmpkey] = $objp->$tmpkey;
@@ -115,7 +115,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
}
// List of values to scan for a replacement
- $substitutionarray = array (
+ $substitutionarray = array(
'__ID__'=>$objp->rowid,
'__LOGIN__'=>$objp->login,
'__FIRSTNAME__'=>$objp->firstname,
@@ -139,21 +139,21 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
complete_substitutions_array($substitutionarray, $langs, $adherentstatic);
// For business cards
- if (empty($mode) || $mode=='card' || $mode=='cardlogin')
+ if (empty($mode) || $mode == 'card' || $mode == 'cardlogin')
{
- $textleft=make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
- $textheader=make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
- $textfooter=make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
- $textright=make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
+ $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray);
+ $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray);
+ $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray);
+ $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray);
if (is_numeric($foruserid) || $foruserlogin)
{
$nb = $_Avery_Labels[$model]['NX'] * $_Avery_Labels[$model]['NY'];
- if ($nb <= 0) $nb=1; // Protection to avoid empty page
+ if ($nb <= 0) $nb = 1; // Protection to avoid empty page
- for($j=0;$j<$nb;$j++)
+ for ($j = 0; $j < $nb; $j++)
{
- $arrayofmembers[]=array(
+ $arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
@@ -165,7 +165,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
}
else
{
- $arrayofmembers[]=array(
+ $arrayofmembers[] = array(
'textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
@@ -179,13 +179,13 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
// For labels
if ($mode == 'label')
{
- if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
- $textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
- $textheader='';
- $textfooter='';
- $textright='';
+ if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT = "__FULLNAME__\n__ADDRESS__\n__ZIP__ __TOWN__\n__COUNTRY__";
+ $textleft = make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray);
+ $textheader = '';
+ $textfooter = '';
+ $textright = '';
- $arrayofmembers[]=array('textleft'=>$textleft,
+ $arrayofmembers[] = array('textleft'=>$textleft,
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
@@ -197,29 +197,29 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
}
// Build and output PDF
- if (empty($mode) || $mode=='card' || $mode=='cardlogin')
+ if (empty($mode) || $mode == 'card' || $mode == 'cardlogin')
{
- if (! count($arrayofmembers))
+ if (!count($arrayofmembers))
{
- $mesg=$langs->trans("ErrorRecordNotFound");
+ $mesg = $langs->trans("ErrorRecordNotFound");
}
if (empty($model) || $model == '-1')
{
- $mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
+ $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE"));
}
- if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
+ if (!$mesg) $result = members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs);
}
elseif ($mode == 'label')
{
- if (! count($arrayofmembers))
+ if (!count($arrayofmembers))
{
- $mesg=$langs->trans("ErrorRecordNotFound");
+ $mesg = $langs->trans("ErrorRecordNotFound");
}
if (empty($modellabel) || $modellabel == '-1')
{
- $mesg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
+ $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
}
- if (! $mesg) $result=doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
+ if (!$mesg) $result = doc_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs);
}
if ($result <= 0)
@@ -232,7 +232,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
dol_print_error($db);
}
- if (! $mesg)
+ if (!$mesg)
{
$db->close();
exit;
@@ -244,7 +244,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg
* View
*/
-$form=new Form($db);
+$form = new Form($db);
llxHeader('', $langs->trans("MembersCards"));
@@ -257,40 +257,40 @@ dol_htmloutput_errors($mesg);
print ' ';
-print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
+print img_picto('', 'puce').' '.$langs->trans("DocForAllMembersCards", ($conf->global->ADHERENT_CARD_TYPE ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '';
print ' ';
-print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' ';
+print img_picto('', 'puce').' '.$langs->trans("DocForOneMemberCards", ($conf->global->ADHERENT_CARD_TYPE ? $conf->global->ADHERENT_CARD_TYPE : $langs->transnoentitiesnoconv("None"))).' ';
print '';
@@ -299,18 +299,18 @@ print ' ';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
print '';
diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php
index fa8ae9fc2f3..4225dad5f31 100644
--- a/htdocs/adherents/class/adherent.class.php
+++ b/htdocs/adherents/class/adherent.class.php
@@ -7,11 +7,12 @@
* Copyright (C) 2009-2017 Regis Houssin
* Copyright (C) 2014-2018 Alexandre Spangaro
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2015-2018 Frédéric France
+ * Copyright (C) 2015-2018 Frédéric France
* Copyright (C) 2015 Raphaël Doursenaud
* Copyright (C) 2016 Juanjo Menent
- * Copyright (C) 2018-2019 Thibault FOUCART
- * Copyright (C) 2019 Nicolas ZABOURI
+ * Copyright (C) 2018-2019 Thibault FOUCART
+ * Copyright (C) 2019 Nicolas ZABOURI
+ * Copyright (C) 2020 Josep Lluís Amador
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -272,7 +273,7 @@ class Adherent extends CommonObject
'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80),
'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 85),
'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90),
- 'country' => array('type' => 'integer', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95),
+ 'country' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95),
'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => -1, 'position' => 100),
'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 105),
'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115),
@@ -1958,13 +1959,14 @@ class Adherent extends CommonObject
* @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small)
* @param int $maxlen length max label
* @param string $option Page for link ('card', 'category', 'subscription', ...)
- * @param string $mode ''=Show firstname+lastname as label (using default order), 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
- * @param string $morecss Add more css on link
- * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
- * @param int $notooltip 1=Disable tooltip
+ * @param string $mode ''=Show firstname+lastname as label (using default order), 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref
+ * @param string $morecss Add more css on link
+ * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+ * @param int $notooltip 1=Disable tooltip
+ * @param int $addlinktonotes 1=Add link to notes
* @return string Chaine avec URL
*/
- public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1, $notooltip = 0)
+ public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1, $notooltip = 0, $addlinktonotes = 0)
{
global $conf, $langs;
@@ -2046,6 +2048,17 @@ class Adherent extends CommonObject
if ($withpictoimg) $result .= '';
$result .= $linkend;
+ if ($addlinktonotes) {
+ if ($this->note_private) {
+ $notetoshow = $langs->trans("ViewPrivateNote").': '.dol_string_nohtmltag($this->note_private, 1);
+ $result .= ' ';
+ $result .= '';
+ $result .= img_picto('', 'note');
+ $result .= ' ';
+ $result .= ' ';
+ }
+ }
+
return $result;
}
diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php
index 1357e4a3b4b..bdb174cc0bd 100644
--- a/htdocs/adherents/class/adherentstats.class.php
+++ b/htdocs/adherents/class/adherentstats.class.php
@@ -23,8 +23,8 @@
* \brief Fichier de la classe de gestion des stats des adhérents
*/
-include_once DOL_DOCUMENT_ROOT . '/core/class/stats.class.php';
-include_once DOL_DOCUMENT_ROOT . '/adherents/class/subscription.class.php';
+include_once DOL_DOCUMENT_ROOT.'/core/class/stats.class.php';
+include_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
/**
@@ -61,17 +61,17 @@ class AdherentStats extends Stats
$this->socid = $socid;
$this->userid = $userid;
- $object=new Subscription($this->db);
+ $object = new Subscription($this->db);
$this->from = MAIN_DB_PREFIX.$object->table_element." as p";
- $this->from.= ", ".MAIN_DB_PREFIX."adherent as m";
+ $this->from .= ", ".MAIN_DB_PREFIX."adherent as m";
- $this->field='subscription';
+ $this->field = 'subscription';
- $this->where.= " m.statut != 0";
- $this->where.= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
+ $this->where .= " m.statut != 0";
+ $this->where .= " AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity('adherent').")";
//if (!$user->rights->societe->client->voir && !$user->socid) $this->where .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id;
- if($this->memberid)
+ if ($this->memberid)
{
$this->where .= " AND m.rowid = ".$this->memberid;
}
@@ -91,12 +91,12 @@ class AdherentStats extends Stats
global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, count(*)";
- $sql.= " FROM ".$this->from;
+ $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
- $sql.= " AND ".$this->where;
- $sql.= " GROUP BY dm";
- $sql.= $this->db->order('dm', 'DESC');
+ $sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
+ $sql .= " AND ".$this->where;
+ $sql .= " GROUP BY dm";
+ $sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByMonth($year, $sql, $format);
}
@@ -111,11 +111,11 @@ class AdherentStats extends Stats
global $user;
$sql = "SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
- $sql.= " FROM ".$this->from;
+ $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE ".$this->where;
- $sql.= " GROUP BY dm";
- $sql.= $this->db->order('dm', 'DESC');
+ $sql .= " WHERE ".$this->where;
+ $sql .= " GROUP BY dm";
+ $sql .= $this->db->order('dm', 'DESC');
return $this->_getNbByYear($sql);
}
@@ -132,12 +132,12 @@ class AdherentStats extends Stats
global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.")";
- $sql.= " FROM ".$this->from;
+ $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
- $sql.= " AND ".$this->where;
- $sql.= " GROUP BY dm";
- $sql.= $this->db->order('dm', 'DESC');
+ $sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
+ $sql .= " AND ".$this->where;
+ $sql .= " GROUP BY dm";
+ $sql .= $this->db->order('dm', 'DESC');
return $this->_getAmountByMonth($year, $sql, $format);
}
@@ -153,12 +153,12 @@ class AdherentStats extends Stats
global $user;
$sql = "SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.")";
- $sql.= " FROM ".$this->from;
+ $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
- $sql.= " AND ".$this->where;
- $sql.= " GROUP BY dm";
- $sql.= $this->db->order('dm', 'DESC');
+ $sql .= " WHERE date_format(p.dateadh,'%Y') = '".$year."'";
+ $sql .= " AND ".$this->where;
+ $sql .= " GROUP BY dm";
+ $sql .= $this->db->order('dm', 'DESC');
return $this->_getAverageByMonth($year, $sql);
}
@@ -174,11 +174,11 @@ class AdherentStats extends Stats
global $user;
$sql = "SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
- $sql.= " FROM ".$this->from;
+ $sql .= " FROM ".$this->from;
//if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
- $sql.= " WHERE ".$this->where;
- $sql.= " GROUP BY year";
- $sql.= $this->db->order('year', 'DESC');
+ $sql .= " WHERE ".$this->where;
+ $sql .= " GROUP BY year";
+ $sql .= $this->db->order('year', 'DESC');
return $this->_getAllByYear($sql);
}
diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php
index 3a17f5c7c28..bbc03c3387f 100644
--- a/htdocs/adherents/class/api_members.class.php
+++ b/htdocs/adherents/class/api_members.class.php
@@ -59,17 +59,17 @@ class Members extends DolibarrApi
*/
public function get($id)
{
- if(! DolibarrApiAccess::$user->rights->adherent->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member not found');
}
- if( ! DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
+ if (!DolibarrApi::_checkAccessToResource('adherent', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -98,50 +98,50 @@ class Members extends DolibarrApi
$obj_ret = array();
- if(! DolibarrApiAccess::$user->rights->adherent->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."adherent as t";
- $sql.= ' WHERE t.entity IN ('.getEntity('adherent').')';
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as t";
+ $sql .= ' WHERE t.entity IN ('.getEntity('adherent').')';
if (!empty($typeid))
{
- $sql.= ' AND t.fk_adherent_type='.$typeid;
+ $sql .= ' AND t.fk_adherent_type='.$typeid;
}
// Add sql filters
if ($sqlfilters)
{
- if (! DolibarrApi::_checkFilters($sqlfilters))
+ if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
- $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
- $sql.= $db->order($sortfield, $sortorder);
- if ($limit) {
+ $sql .= $db->order($sortfield, $sortorder);
+ if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
- $sql.= $db->plimit($limit + 1, $offset);
+ $sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
- $i=0;
+ $i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
{
$obj = $db->fetch_object($result);
$member = new Adherent($this->db);
- if($member->fetch($obj->rowid)) {
+ if ($member->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($member);
}
$i++;
@@ -150,7 +150,7 @@ class Members extends DolibarrApi
else {
throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror());
}
- if( ! count($obj_ret)) {
+ if (!count($obj_ret)) {
throw new RestException(404, 'No member found');
}
@@ -165,14 +165,14 @@ class Members extends DolibarrApi
*/
public function post($request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
$member = new Adherent($this->db);
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
$member->$field = $value;
}
if ($member->create(DolibarrApiAccess::$user) < 0) {
@@ -190,21 +190,21 @@ class Members extends DolibarrApi
*/
public function put($id, $request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member not found');
}
- if( ! DolibarrApi::_checkAccessToResource('member', $member->id)) {
+ if (!DolibarrApi::_checkAccessToResource('member', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
// Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class Adherent.
@@ -245,20 +245,20 @@ class Members extends DolibarrApi
*/
public function delete($id)
{
- if(! DolibarrApiAccess::$user->rights->adherent->supprimer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->supprimer) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member not found');
}
- if( ! DolibarrApi::_checkAccessToResource('member', $member->id)) {
+ if (!DolibarrApi::_checkAccessToResource('member', $member->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- if (! $member->delete($member->id, DolibarrApiAccess::$user)) {
+ if (!$member->delete($member->id, DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting member');
}
@@ -334,13 +334,13 @@ class Members extends DolibarrApi
{
$obj_ret = array();
- if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member not found');
}
@@ -365,13 +365,13 @@ class Members extends DolibarrApi
*/
public function createSubscription($id, $start_date, $end_date, $amount, $label = '')
{
- if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401);
}
$member = new Adherent($this->db);
$result = $member->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member not found');
}
@@ -393,7 +393,7 @@ class Members extends DolibarrApi
*/
public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
- if (! DolibarrApiAccess::$user->rights->categorie->lire) {
+ if (!DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}
diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php
index 987e3e2ea87..98cb25b7fc3 100644
--- a/htdocs/adherents/class/api_memberstypes.class.php
+++ b/htdocs/adherents/class/api_memberstypes.class.php
@@ -55,17 +55,17 @@ class MembersTypes extends DolibarrApi
*/
public function get($id)
{
- if(! DolibarrApiAccess::$user->rights->adherent->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);
$result = $membertype->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member type not found');
}
- if( ! DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
+ if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -92,40 +92,40 @@ class MembersTypes extends DolibarrApi
$obj_ret = array();
- if(! DolibarrApiAccess::$user->rights->adherent->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401);
}
$sql = "SELECT t.rowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
- $sql.= ' WHERE t.entity IN ('.getEntity('member_type').')';
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
+ $sql .= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Add sql filters
if ($sqlfilters)
{
- if (! DolibarrApi::_checkFilters($sqlfilters))
+ if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
- $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
- $sql.= $db->order($sortfield, $sortorder);
- if ($limit) {
+ $sql .= $db->order($sortfield, $sortorder);
+ if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
- $sql.= $db->plimit($limit + 1, $offset);
+ $sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
- $i=0;
+ $i = 0;
$num = $db->num_rows($result);
$min = min($num, ($limit <= 0 ? $num : $limit));
while ($i < $min)
@@ -141,7 +141,7 @@ class MembersTypes extends DolibarrApi
else {
throw new RestException(503, 'Error when retrieve member type list : '.$db->lasterror());
}
- if ( ! count($obj_ret)) {
+ if (!count($obj_ret)) {
throw new RestException(404, 'No member type found');
}
@@ -156,14 +156,14 @@ class MembersTypes extends DolibarrApi
*/
public function post($request_data = null)
{
- if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
$membertype = new AdherentType($this->db);
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
$membertype->$field = $value;
}
if ($membertype->create(DolibarrApiAccess::$user) < 0) {
@@ -181,21 +181,21 @@ class MembersTypes extends DolibarrApi
*/
public function put($id, $request_data = null)
{
- if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);
$result = $membertype->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member type not found');
}
- if( ! DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
+ if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
// Process the status separately because it must be updated using
// the validate() and resiliate() methods of the class AdherentType.
@@ -222,20 +222,20 @@ class MembersTypes extends DolibarrApi
*/
public function delete($id)
{
- if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401);
}
$membertype = new AdherentType($this->db);
$result = $membertype->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'member type not found');
}
- if ( ! DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
+ if (!DolibarrApi::_checkAccessToResource('member', $membertype->id, 'adherent_type')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
- if (! $membertype->delete()) {
+ if (!$membertype->delete()) {
throw new RestException(401, 'error when deleting member type');
}
diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php
index 101ed822466..c9804e5d802 100644
--- a/htdocs/adherents/class/api_subscriptions.class.php
+++ b/htdocs/adherents/class/api_subscriptions.class.php
@@ -58,13 +58,13 @@ class Subscriptions extends DolibarrApi
*/
public function get($id)
{
- if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401);
}
$subscription = new Subscription($this->db);
$result = $subscription->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'Subscription not found');
}
@@ -91,45 +91,45 @@ class Subscriptions extends DolibarrApi
$obj_ret = array();
- if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
+ if (!DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401);
}
$sql = "SELECT rowid";
- $sql.= " FROM ".MAIN_DB_PREFIX."subscription as t";
- $sql.= ' WHERE 1 = 1';
+ $sql .= " FROM ".MAIN_DB_PREFIX."subscription as t";
+ $sql .= ' WHERE 1 = 1';
// Add sql filters
if ($sqlfilters)
{
- if (! DolibarrApi::_checkFilters($sqlfilters))
+ if (!DolibarrApi::_checkFilters($sqlfilters))
{
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
}
- $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
- $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+ $regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
+ $sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
- $sql.= $db->order($sortfield, $sortorder);
- if ($limit) {
+ $sql .= $db->order($sortfield, $sortorder);
+ if ($limit) {
if ($page < 0)
{
$page = 0;
}
$offset = $limit * $page;
- $sql.= $db->plimit($limit + 1, $offset);
+ $sql .= $db->plimit($limit + 1, $offset);
}
$result = $db->query($sql);
if ($result)
{
- $i=0;
+ $i = 0;
$num = $db->num_rows($result);
while ($i < min($limit, $num))
{
$obj = $db->fetch_object($result);
$subscription = new Subscription($this->db);
- if($subscription->fetch($obj->rowid)) {
+ if ($subscription->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($subscription);
}
$i++;
@@ -138,7 +138,7 @@ class Subscriptions extends DolibarrApi
else {
throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror());
}
- if( ! count($obj_ret)) {
+ if (!count($obj_ret)) {
throw new RestException(404, 'No Subscription found');
}
@@ -153,14 +153,14 @@ class Subscriptions extends DolibarrApi
*/
public function post($request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
$subscription = new Subscription($this->db);
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
$subscription->$field = $value;
}
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
@@ -178,17 +178,17 @@ class Subscriptions extends DolibarrApi
*/
public function put($id, $request_data = null)
{
- if(! DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401);
}
$subscription = new Subscription($this->db);
$result = $subscription->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'Subscription not found');
}
- foreach($request_data as $field => $value) {
+ foreach ($request_data as $field => $value) {
if ($field == 'id') continue;
$subscription->$field = $value;
}
@@ -212,16 +212,16 @@ class Subscriptions extends DolibarrApi
public function delete($id)
{
// The right to delete a subscription comes with the right to create one.
- if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
+ if (!DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401);
}
$subscription = new Subscription($this->db);
$result = $subscription->fetch($id);
- if( ! $result ) {
+ if (!$result) {
throw new RestException(404, 'Subscription not found');
}
- if (! $subscription->delete(DolibarrApiAccess::$user)) {
+ if (!$subscription->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when deleting subscription');
}
diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php
index 99a0c113e9a..e512e1152bb 100644
--- a/htdocs/adherents/class/subscription.class.php
+++ b/htdocs/adherents/class/subscription.class.php
@@ -35,12 +35,12 @@ class Subscription extends CommonObject
/**
* @var string ID to identify managed object
*/
- public $element='subscription';
+ public $element = 'subscription';
/**
* @var string Name of table without prefix where object is stored
*/
- public $table_element='subscription';
+ public $table_element = 'subscription';
/**
* @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by fk_soc, 'field@table'=Test with link by field@table
@@ -50,7 +50,7 @@ class Subscription extends CommonObject
/**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
*/
- public $picto='payment';
+ public $picto = 'payment';
/**
* Date creation record (datec)
@@ -93,7 +93,7 @@ class Subscription extends CommonObject
*/
public $fk_bank;
- public $fields=array(
+ public $fields = array(
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>20),
@@ -133,12 +133,12 @@ class Subscription extends CommonObject
$error = 0;
- $now=dol_now();
+ $now = dol_now();
// Check parameters
if ($this->datef <= $this->dateh)
{
- $this->error=$langs->trans("ErrorBadValueForDate");
+ $this->error = $langs->trans("ErrorBadValueForDate");
return -1;
}
if (empty($this->datec)) $this->datec = $now;
@@ -149,37 +149,37 @@ class Subscription extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $member=new Adherent($this->db);
- $result=$member->fetch($this->fk_adherent);
+ $member = new Adherent($this->db);
+ $result = $member->fetch($this->fk_adherent);
if ($this->fk_type == null) { // If type not defined, we use the type of member
- $type=$member->typeid;
+ $type = $member->typeid;
} else {
- $type=$this->fk_type;
+ $type = $this->fk_type;
}
- $sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
- $sql.= " '".$this->db->idate($this->dateh)."',";
- $sql.= " '".$this->db->idate($this->datef)."',";
- $sql.= " ".$this->amount.",";
- $sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')";
+ $sql .= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
+ $sql .= " '".$this->db->idate($this->dateh)."',";
+ $sql .= " '".$this->db->idate($this->datef)."',";
+ $sql .= " ".$this->amount.",";
+ $sql .= " '".$this->db->escape($this->note_public ? $this->note_public : $this->note)."')";
$resql = $this->db->query($sql);
- if (! $resql) {
+ if (!$resql) {
$error++;
$this->errors[] = $this->db->lasterror();
}
- if (! $error)
+ if (!$error)
{
- $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element);
$this->fk_type = $type;
}
- if (! $error && ! $notrigger)
+ if (!$error && !$notrigger)
{
$this->context = array('member'=>$member);
// Call triggers
- $result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
+ $result = $this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; }
// End call triggers
}
@@ -203,16 +203,16 @@ class Subscription extends CommonObject
*/
public function fetch($rowid)
{
- $sql ="SELECT rowid, fk_type, fk_adherent, datec,";
- $sql.=" tms,";
- $sql.=" dateadh as dateh,";
- $sql.=" datef,";
- $sql.=" subscription, note, fk_bank";
- $sql.=" FROM ".MAIN_DB_PREFIX."subscription";
- $sql.=" WHERE rowid=".$rowid;
+ $sql = "SELECT rowid, fk_type, fk_adherent, datec,";
+ $sql .= " tms,";
+ $sql .= " dateadh as dateh,";
+ $sql .= " datef,";
+ $sql .= " subscription, note, fk_bank";
+ $sql .= " FROM ".MAIN_DB_PREFIX."subscription";
+ $sql .= " WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
@@ -240,7 +240,7 @@ class Subscription extends CommonObject
}
else
{
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
return -1;
}
}
@@ -275,14 +275,14 @@ class Subscription extends CommonObject
if ($resql)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $member=new Adherent($this->db);
- $result=$member->fetch($this->fk_adherent);
- $result=$member->update_end_date($user);
+ $member = new Adherent($this->db);
+ $result = $member->fetch($this->fk_adherent);
+ $result = $member->update_end_date($user);
- if (! $error && ! $notrigger) {
+ if (!$error && !$notrigger) {
$this->context = array('member'=>$member);
// Call triggers
- $result=$this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
+ $result = $this->call_trigger('MEMBER_SUBSCRIPTION_MODIFY', $user);
if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers
}
@@ -290,7 +290,7 @@ class Subscription extends CommonObject
else
{
$error++;
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
}
// Commit or rollback
@@ -318,39 +318,39 @@ class Subscription extends CommonObject
if ($this->fk_bank > 0)
{
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
- $accountline=new AccountLine($this->db);
- $result=$accountline->fetch($this->fk_bank);
+ $accountline = new AccountLine($this->db);
+ $result = $accountline->fetch($this->fk_bank);
}
$this->db->begin();
- if (! $error) {
- if (! $notrigger) {
+ if (!$error) {
+ if (!$notrigger) {
// Call triggers
- $result=$this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
+ $result = $this->call_trigger('MEMBER_SUBSCRIPTION_DELETE', $user);
if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
// End call triggers
}
}
- if (! $error)
+ if (!$error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
- $resql=$this->db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql)
{
- $num=$this->db->affected_rows($resql);
+ $num = $this->db->affected_rows($resql);
if ($num)
{
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $member=new Adherent($this->db);
- $result=$member->fetch($this->fk_adherent);
- $result=$member->update_end_date($user);
+ $member = new Adherent($this->db);
+ $result = $member->fetch($this->fk_adherent);
+ $result = $member->update_end_date($user);
if ($this->fk_bank > 0 && is_object($accountline) && $accountline->id > 0) // If we found bank account line (this means this->fk_bank defined)
{
- $result=$accountline->delete($user); // Return false if refused because line is conciliated
+ $result = $accountline->delete($user); // Return false if refused because line is conciliated
if ($result > 0)
{
$this->db->commit();
@@ -358,7 +358,7 @@ class Subscription extends CommonObject
}
else
{
- $this->error=$accountline->error;
+ $this->error = $accountline->error;
$this->db->rollback();
return -1;
}
@@ -378,7 +378,7 @@ class Subscription extends CommonObject
else
{
$error++;
- $this->error=$this->db->lasterror();
+ $this->error = $this->db->lasterror();
}
}
@@ -407,29 +407,29 @@ class Subscription extends CommonObject
{
global $langs;
- $result='';
+ $result = '';
$langs->load("members");
- $label=$langs->trans("ShowSubscription").': '.$this->ref;
+ $label = $langs->trans("ShowSubscription").': '.$this->ref;
$url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
- $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
- if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
- if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
+ $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+ if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
+ if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
}
$linkstart = '';
$linkend = ' ';
- $picto='payment';
+ $picto = 'payment';
$result .= $linkstart;
- if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
- if ($withpicto != 2) $result.= $this->ref;
+ if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+ if ($withpicto != 2) $result .= $this->ref;
$result .= $linkend;
return $result;
@@ -471,11 +471,11 @@ class Subscription extends CommonObject
public function info($id)
{
$sql = 'SELECT c.rowid, c.datec,';
- $sql.= ' c.tms as datem';
- $sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
- $sql.= ' WHERE c.rowid = '.$id;
+ $sql .= ' c.tms as datem';
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
+ $sql .= ' WHERE c.rowid = '.$id;
- $result=$this->db->query($sql);
+ $result = $this->db->query($sql);
if ($result)
{
if ($this->db->num_rows($result))
diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index ca74d9bcbda..cc3e06207be 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -34,45 +34,45 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","members","other"));
+$langs->loadLangs(array("companies", "members", "other"));
-$id=GETPOST('id', 'int');
-$action=GETPOST('action', 'alpha');
-$confirm=GETPOST('confirm', 'alpha');
+$id = GETPOST('id', 'int');
+$action = GETPOST('action', 'alpha');
+$confirm = GETPOST('confirm', 'alpha');
// Security check
-$result=restrictedArea($user, 'adherent', $id);
+$result = restrictedArea($user, 'adherent', $id);
// Get parameters
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
-$offset = $conf->liste_limit * $page ;
+$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
-if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="name";
+if (!$sortorder) $sortorder = "ASC";
+if (!$sortfield) $sortfield = "name";
$form = new Form($db);
-$object=new Adherent($db);
-$membert=new AdherentType($db);
-$result=$object->fetch($id);
+$object = new Adherent($db);
+$membert = new AdherentType($db);
+$result = $object->fetch($id);
if ($result < 0)
{
dol_print_error($db);
exit;
}
-$upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member');
+$upload_dir = $conf->adherent->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'member');
/*
* Actions
*/
-include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
+include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/*
@@ -81,24 +81,24 @@ include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
$form = new Form($db);
-$title=$langs->trans("Member") . " - " . $langs->trans("Documents");
-$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
+$title = $langs->trans("Member")." - ".$langs->trans("Documents");
+$helpurl = "EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
llxHeader("", $title, $helpurl);
if ($id > 0)
{
- $result=$membert->fetch($object->typeid);
+ $result = $membert->fetch($object->typeid);
if ($result > 0)
{
// Build file list
- $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
- $totalsize=0;
- foreach($filearray as $key => $file)
+ $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+ $totalsize = 0;
+ foreach ($filearray as $key => $file)
{
- $totalsize+=$file['size'];
+ $totalsize += $file['size'];
}
- if (! empty($conf->notification->enabled))
+ if (!empty($conf->notification->enabled))
$langs->load("mails");
$head = member_prepare_head($object);
@@ -154,8 +154,8 @@ if ($id > 0)
$modulepart = 'member';
$permission = $user->rights->adherent->creer;
$permtoedit = $user->rights->adherent->creer;
- $param = '&id=' . $object->id;
- include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
+ $param = '&id='.$object->id;
+ include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
print " ";
}
else
diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php
index 84fc6bc9824..b7aa8da5d14 100644
--- a/htdocs/adherents/htpasswd.php
+++ b/htdocs/adherents/htpasswd.php
@@ -27,7 +27,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
// Security check
-if (! $user->rights->adherent->export) accessforbidden();
+if (!$user->rights->adherent->export) accessforbidden();
/*
@@ -36,30 +36,30 @@ if (! $user->rights->adherent->export) accessforbidden();
llxHeader();
-$now=dol_now();
+$now = dol_now();
-if (empty($sortorder)) { $sortorder="ASC"; }
-if (empty($sortfield)) { $sortfield="d.login"; }
-if (! isset($statut))
+if (empty($sortorder)) { $sortorder = "ASC"; }
+if (empty($sortfield)) { $sortfield = "d.login"; }
+if (!isset($statut))
{
$statut = 1;
}
-if (! isset($cotis))
+if (!isset($cotis))
{
// by default, members must be up to date of subscription
- $cotis=1;
+ $cotis = 1;
}
$sql = "SELECT d.login, d.pass, d.datefin";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d ";
$sql .= " WHERE d.statut = ".$statut;
-if ($cotis==1)
+if ($cotis == 1)
{
$sql .= " AND datefin > '".$db->idate($now)."'";
}
-$sql.= $db->order($sortfield, $sortorder);
+$sql .= $db->order($sortfield, $sortorder);
//$sql.=$db->plimit($conf->liste_limit, $offset);
$resql = $db->query($sql);
@@ -74,7 +74,7 @@ if ($resql)
while ($i < $num)
{
$objp = $db->fetch_object($result);
- $htpass=crypt($objp->pass, makesalt());
+ $htpass = crypt($objp->pass, makesalt());
print $objp->login.":".$htpass." \n";
$i++;
}
diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php
index 029cf868bb0..44fcb397ddc 100644
--- a/htdocs/adherents/index.php
+++ b/htdocs/adherents/index.php
@@ -48,28 +48,28 @@ $result = restrictedArea($user, 'adherent');
llxHeader('', $langs->trans("Members"), 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
-$staticmember=new Adherent($db);
-$statictype=new AdherentType($db);
-$subscriptionstatic=new Subscription($db);
+$staticmember = new Adherent($db);
+$statictype = new AdherentType($db);
+$subscriptionstatic = new Subscription($db);
print load_fiche_titre($langs->trans("MembersArea"), '', 'members');
-$Adherents=array();
-$AdherentsAValider=array();
-$MemberUpToDate=array();
-$AdherentsResilies=array();
+$Adherents = array();
+$AdherentsAValider = array();
+$MemberUpToDate = array();
+$AdherentsResilies = array();
-$AdherentType=array();
+$AdherentType = array();
// Type of membership
$sql = "SELECT t.rowid, t.libelle as label, t.subscription,";
-$sql.= " d.statut, count(d.rowid) as somme";
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
-$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
-$sql.= " ON t.rowid = d.fk_adherent_type";
-$sql.= " AND d.entity IN (".getEntity('adherent').")";
-$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
-$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
+$sql .= " d.statut, count(d.rowid) as somme";
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
+$sql .= " ON t.rowid = d.fk_adherent_type";
+$sql .= " AND d.entity IN (".getEntity('adherent').")";
+$sql .= " WHERE t.entity IN (".getEntity('member_type').")";
+$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql);
@@ -81,32 +81,32 @@ if ($result)
{
$objp = $db->fetch_object($result);
- $adhtype=new AdherentType($db);
- $adhtype->id=$objp->rowid;
- $adhtype->subscription=$objp->subscription;
- $adhtype->label=$objp->label;
- $AdherentType[$objp->rowid]=$adhtype;
+ $adhtype = new AdherentType($db);
+ $adhtype->id = $objp->rowid;
+ $adhtype->subscription = $objp->subscription;
+ $adhtype->label = $objp->label;
+ $AdherentType[$objp->rowid] = $adhtype;
- if ($objp->statut == -1) { $MemberToValidate[$objp->rowid]=$objp->somme; }
- if ($objp->statut == 1) { $MembersValidated[$objp->rowid]=$objp->somme; }
- if ($objp->statut == 0) { $MembersResiliated[$objp->rowid]=$objp->somme; }
+ if ($objp->statut == -1) { $MemberToValidate[$objp->rowid] = $objp->somme; }
+ if ($objp->statut == 1) { $MembersValidated[$objp->rowid] = $objp->somme; }
+ if ($objp->statut == 0) { $MembersResiliated[$objp->rowid] = $objp->somme; }
$i++;
}
$db->free($result);
}
-$now=dol_now();
+$now = dol_now();
// Members up to date list
// current rule: uptodate = the end date is in future whatever is type
// old rule: uptodate = if type does not need payment, that end date is null, if type need payment that end date is in future)
$sql = "SELECT count(*) as somme , d.fk_adherent_type";
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
-$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
-$sql.= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
-$sql.= " AND t.rowid = d.fk_adherent_type";
-$sql.= " GROUP BY d.fk_adherent_type";
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
+$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+$sql .= " AND d.statut = 1 AND (d.datefin >= '".$db->idate($now)."' OR t.subscription = 0)";
+$sql .= " AND t.rowid = d.fk_adherent_type";
+$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql);
@@ -191,10 +191,10 @@ if ($conf->use_javascript_ajax)
}
$total = $SommeA + $SommeB + $SommeC + $SommeD;
$dataseries = array();
- $dataseries[] = array($langs->trans("MenuMembersNotUpToDate"), round($SommeB));
- $dataseries[] = array($langs->trans("MenuMembersUpToDate"), round($SommeC));
- $dataseries[] = array($langs->trans("MembersStatusResiliated"), round($SommeD));
- $dataseries[] = array($langs->trans("MembersStatusToValid"), round($SommeA));
+ $dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersNotUpToDate"), round($SommeB));
+ $dataseries[] = array($langs->transnoentitiesnoconv("MenuMembersUpToDate"), round($SommeC));
+ $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
+ $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA));
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
@@ -220,15 +220,15 @@ if ($conf->use_javascript_ajax)
print ' ';
// List of subscription by year
-$Total=array();
-$Number=array();
-$tot=0;
-$numb=0;
+$Total = array();
+$Number = array();
+$tot = 0;
+$numb = 0;
$sql = "SELECT c.subscription, c.dateadh as dateh";
-$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
-$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
-$sql.= " AND d.rowid = c.fk_adherent";
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
+$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+$sql .= " AND d.rowid = c.fk_adherent";
$result = $db->query($sql);
@@ -323,26 +323,26 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '';
- $staticmember->id=$obj->rowid;
- $staticmember->lastname=$obj->lastname;
- $staticmember->firstname=$obj->firstname;
- if (! empty($obj->fk_soc))
+ $staticmember->id = $obj->rowid;
+ $staticmember->lastname = $obj->lastname;
+ $staticmember->firstname = $obj->firstname;
+ if (!empty($obj->fk_soc))
{
$staticmember->fk_soc = $obj->fk_soc;
$staticmember->fetch_thirdparty();
- $staticmember->name=$staticmember->thirdparty->name;
+ $staticmember->name = $staticmember->thirdparty->name;
}
else
{
- $staticmember->name=$obj->company;
+ $staticmember->name = $obj->company;
}
- $staticmember->ref=$staticmember->getFullName($langs);
- $statictype->id=$obj->typeid;
- $statictype->label=$obj->label;
+ $staticmember->ref = $staticmember->getFullName($langs);
+ $statictype->id = $obj->typeid;
+ $statictype->label = $obj->label;
print ''.$staticmember->getNomUrl(1, 32).' ';
print ''.$statictype->getNomUrl(1, 32).' ';
print ''.dol_print_date($db->jdate($obj->datem), 'dayhour').' ';
- print ''.$staticmember->LibStatut($obj->statut, ($obj->subscription=='yes'?1:0), $db->jdate($obj->date_end_subscription), 3).' ';
+ print ''.$staticmember->LibStatut($obj->statut, ($obj->subscription == 'yes' ? 1 : 0), $db->jdate($obj->date_end_subscription), 3).' ';
print ' ';
$i++;
}
diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php
index 99326241485..6a49f99fbf4 100644
--- a/htdocs/adherents/ldap.php
+++ b/htdocs/adherents/ldap.php
@@ -30,21 +30,21 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","members","ldap","admin"));
+$langs->loadLangs(array("companies", "members", "ldap", "admin"));
$rowid = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
// Protection
-$socid=0;
+$socid = 0;
if ($user->socid > 0)
{
$socid = $user->socid;
}
$object = new Adherent($db);
-$result=$object->fetch($rowid);
-if (! $result)
+$result = $object->fetch($rowid);
+if (!$result)
{
dol_print_error($db, "Failed to get adherent: ".$object->error);
exit;
@@ -57,16 +57,16 @@ if (! $result)
if ($action == 'dolibarr2ldap')
{
- $ldap=new Ldap();
- $result=$ldap->connect_bind();
+ $ldap = new Ldap();
+ $result = $ldap->connect_bind();
if ($result > 0)
{
- $info=$object->_load_ldap_info();
- $dn=$object->_load_ldap_dn($info);
- $olddn=$dn; // We can say that old dn = dn as we force synchro
+ $info = $object->_load_ldap_info();
+ $dn = $object->_load_ldap_dn($info);
+ $olddn = $dn; // We can say that old dn = dn as we force synchro
- $result=$ldap->update($dn, $info, $user, $olddn);
+ $result = $ldap->update($dn, $info, $user, $olddn);
}
if ($result >= 0) {
@@ -104,7 +104,7 @@ print '';
print ''.$langs->trans("Login").' / '.$langs->trans("Id").' '.$object->login.' ';
// If there is a link to password not crypted, we show value in database here so we can compare because it is shown nowhere else
-if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
+if (!empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
{
print ''.$langs->trans("LDAPFieldPasswordNotCrypted").' ';
print ''.$object->pass.' ';
@@ -142,14 +142,14 @@ dol_fiche_end();
print '';
-if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr')
+if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr')
{
print '
';
}
print "
\n";
-if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') print " \n";
+if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr') print " \n";
@@ -164,12 +164,12 @@ print ''.$langs->trans("Value").' ';
print ' ';
// Lecture LDAP
-$ldap=new Ldap();
-$result=$ldap->connect_bind();
+$ldap = new Ldap();
+$result = $ldap->connect_bind();
if ($result > 0)
{
- $info=$object->_load_ldap_info();
- $dn=$object->_load_ldap_dn($info, 1);
+ $info = $object->_load_ldap_info();
+ $dn = $object->_load_ldap_dn($info, 1);
$search = "(".$object->_load_ldap_dn($info, 2).")";
if (empty($dn))
@@ -184,15 +184,15 @@ if ($result > 0)
//print_r($records);
// Show tree
- if (((! is_numeric($records)) || $records != 0) && (! isset($records['count']) || $records['count'] > 0))
+ if (((!is_numeric($records)) || $records != 0) && (!isset($records['count']) || $records['count'] > 0))
{
- if (! is_array($records))
+ if (!is_array($records))
{
print ''.$langs->trans("ErrorFailedToReadLDAP").' ';
}
else
{
- $result=show_ldap_content($records, 0, $records['count'], true);
+ $result = show_ldap_content($records, 0, $records['count'], true);
}
}
else
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index aa487ad4174..7ed417750a7 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -52,6 +52,7 @@ $search_lastname = GETPOST("search_lastname", 'alpha');
$search_firstname = GETPOST("search_firstname", 'alpha');
$search_gender = GETPOST("search_gender", 'alpha');
$search_civility = GETPOST("search_civility", 'alpha');
+$search_company = GETPOST('search_company', 'alphanohtml');
$search_login = GETPOST("search_login", 'alpha');
$search_address = GETPOST("search_address", 'alpha');
$search_zip = GETPOST("search_zip", 'alpha');
@@ -105,6 +106,9 @@ $fieldstosearchall = array(
'd.address'=>'Address',
'd.zip'=>'Zip',
'd.town'=>'Town',
+ 'd.phone'=>"Phone",
+ 'd.phone_perso'=>"PhonePerso",
+ 'd.phone_mobile'=>"PhoneMobile",
'd.note_public'=>'NotePublic',
'd.note_private'=>'NotePrivate',
);
@@ -254,6 +258,8 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.gender, d.societe as
$sql .= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,";
$sql .= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,";
$sql .= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,";
+$sql .= " d.note_private, d.note_public,";
+$sql .= " s.nom,";
$sql .= " t.libelle as type, t.subscription,";
$sql .= " state.code_departement as state_code, state.nom as state_name,";
// Add fields from extrafields
@@ -269,6 +275,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
if (!empty($search_categ) || !empty($catid)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = d.country)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = d.state_id)";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on (s.rowid = d.fk_soc)";
$sql .= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql .= " WHERE d.fk_adherent_type = t.rowid ";
if ($catid > 0) $sql .= " AND cm.fk_categorie = ".$db->escape($catid);
@@ -289,6 +296,7 @@ if ($search_firstname) $sql .= natural_search("d.firstname", $search_firstname);
if ($search_lastname) $sql .= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
if ($search_gender != '' && $search_gender != '-1') $sql .= " AND d.gender = '".$search_gender."'";
if ($search_login) $sql .= natural_search("d.login", $search_login);
+if ($search_company) $sql .= natural_search("s.nom", $search_company);
if ($search_email) $sql .= natural_search("d.email", $search_email);
if ($search_town) $sql .= natural_search("d.town", $search_town);
if ($search_zip) $sql .= natural_search("d.zip", $search_zip);
@@ -417,10 +425,9 @@ print ' ';
print ' ';
print ' ';
-print ' ';
print ' ';
-print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
+print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1);
$topicmail = "Information";
$modelmail = "member";
@@ -682,6 +689,8 @@ while ($i < min($num, $limit))
$memberstatic->socid = $obj->fk_soc;
$memberstatic->photo = $obj->photo;
$memberstatic->morphy = $obj->morphy;
+ $memberstatic->note_public = $obj->note_public;
+ $memberstatic->note_private = $obj->note_private;
if (!empty($obj->fk_soc)) {
$memberstatic->fetch_thirdparty();
@@ -703,7 +712,7 @@ while ($i < min($num, $limit))
if (!empty($arrayfields['d.ref']['checked']))
{
print "";
- print $memberstatic->getNomUrl(-1, 0, 'card', 'ref');
+ print $memberstatic->getNomUrl(-1, 0, 'card', 'ref', '', -1, 0, 1);
print " \n";
if (!$i) $totalarray['nbfield']++;
}
@@ -940,8 +949,6 @@ print "
\n";
print "";
print '';
-if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 1);
-
// End of page
llxFooter();
$db->close();
diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php
index 7e8175793fd..ee72c920e2f 100644
--- a/htdocs/adherents/note.php
+++ b/htdocs/adherents/note.php
@@ -29,23 +29,23 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","members","bills"));
+$langs->loadLangs(array("companies", "members", "bills"));
-$action=GETPOST('action', 'alpha');
-$id=GETPOST('id', 'int');
+$action = GETPOST('action', 'alpha');
+$id = GETPOST('id', 'int');
// Security check
-$result=restrictedArea($user, 'adherent', $id);
+$result = restrictedArea($user, 'adherent', $id);
$object = new Adherent($db);
-$result=$object->fetch($id);
+$result = $object->fetch($id);
if ($result > 0)
{
$adht = new AdherentType($db);
- $result=$adht->fetch($object->typeid);
+ $result = $adht->fetch($object->typeid);
}
-$permissionnote=$user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
+$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php
/*
* Actions
@@ -58,8 +58,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
/*
* View
*/
-$title=$langs->trans("Member") . " - " . $langs->trans("Note");
-$helpurl="EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
+$title = $langs->trans("Member")." - ".$langs->trans("Note");
+$helpurl = "EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros";
llxHeader("", $title, $helpurl);
$form = new Form($db);
@@ -110,8 +110,8 @@ if ($id)
print '';
- $cssclass='titlefield';
- $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
+ $cssclass = 'titlefield';
+ $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php
index e75e1a61e70..7927c2e3f00 100644
--- a/htdocs/adherents/stats/byproperties.php
+++ b/htdocs/adherents/stats/byproperties.php
@@ -29,7 +29,7 @@ $graphwidth = 700;
$mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio);
-$mode=GETPOST('mode')?GETPOST('mode'):'';
+$mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check
@@ -38,57 +38,57 @@ if ($user->socid > 0)
$action = '';
$socid = $user->socid;
}
-$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
+$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time());
-$startyear=$year-2;
-$endyear=$year;
+$startyear = $year - 2;
+$endyear = $year;
// Load translation files required by the page
-$langs->loadLangs(array("companies","members"));
+$langs->loadLangs(array("companies", "members"));
/*
* View
*/
-$memberstatic=new Adherent($db);
+$memberstatic = new Adherent($db);
llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, array('https://www.google.com/jsapi'));
-$title=$langs->trans("MembersStatisticsByProperties");
+$title = $langs->trans("MembersStatisticsByProperties");
-print load_fiche_titre($title, '');
+print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir);
-$tab='byproperties';
+$tab = 'byproperties';
$data = array();
-$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code";
-$sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
-$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
-$sql.=" WHERE d.entity IN (".getEntity('adherent').")";
-$sql.=" AND d.statut = 1";
-$sql.=" GROUP BY d.morphy";
+$sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, d.morphy as code";
+$sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+$sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+$sql .= " AND d.statut = 1";
+$sql .= " GROUP BY d.morphy";
-$foundphy=$foundmor=0;
+$foundphy = $foundmor = 0;
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
-$resql=$db->query($sql);
+$resql = $db->query($sql);
if ($resql)
{
- $num=$db->num_rows($resql);
- $i=0;
+ $num = $db->num_rows($resql);
+ $i = 0;
while ($i < $num)
{
- $obj=$db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++;
- $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
+ $data[] = array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
$i++;
}
@@ -106,14 +106,15 @@ dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'use
// Print title
-if (! count($data))
+if (!count($data))
{
print $langs->trans("NoValidatedMemberYet").' ';
print ' ';
}
else
{
- print load_fiche_titre($langs->trans("MembersByNature"), '', '');
+ print $langs->trans("MembersByNature").' ';
+ print ' ';
}
// Print array
@@ -125,8 +126,8 @@ print ''.$langs->trans("LastMemberDate").' ';
print ''.$langs->trans("LatestSubscriptionDate").' ';
print '';
-if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
-if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
+if (!$foundphy) $data[] = array('label'=>'phy', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
+if (!$foundmor) $data[] = array('label'=>'mor', 'nb'=>'0', 'lastdate'=>'', 'lastsubscriptiondate'=>'');
foreach ($data as $val)
{
diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php
index 956a71112cb..5b51008a9a2 100644
--- a/htdocs/adherents/stats/geo.php
+++ b/htdocs/adherents/stats/geo.php
@@ -26,11 +26,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
-$graphwidth=DolGraph::getDefaultGraphSizeForStats('width', 700);
+$graphwidth = DolGraph::getDefaultGraphSizeForStats('width', 700);
$mapratio = 0.5;
$graphheight = round($graphwidth * $mapratio);
-$mode=GETPOST('mode')?GETPOST('mode'):'';
+$mode = GETPOST('mode') ?GETPOST('mode') : '';
// Security check
@@ -39,32 +39,32 @@ if ($user->socid > 0)
$action = '';
$socid = $user->socid;
}
-$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
+$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time());
-$startyear=$year-2;
-$endyear=$year;
+$startyear = $year - 2;
+$endyear = $year;
// Load translation files required by the page
-$langs->loadLangs(array("companies","members"));
+$langs->loadLangs(array("companies", "members"));
/*
* View
*/
-$arrayjs=array('https://www.google.com/jsapi');
-if (! empty($conf->dol_use_jmobile)) $arrayjs=array();
+$arrayjs = array('https://www.google.com/jsapi');
+if (!empty($conf->dol_use_jmobile)) $arrayjs = array();
-$title=$langs->trans("Statistics");
-if ($mode == 'memberbycountry') $title=$langs->trans("MembersStatisticsByCountries");
-if ($mode == 'memberbystate') $title=$langs->trans("MembersStatisticsByState");
-if ($mode == 'memberbytown') $title=$langs->trans("MembersStatisticsByTown");
-if ($mode == 'memberbyregion') $title=$langs->trans("MembersStatisticsByRegion");
+$title = $langs->trans("Statistics");
+if ($mode == 'memberbycountry') $title = $langs->trans("MembersStatisticsByCountries");
+if ($mode == 'memberbystate') $title = $langs->trans("MembersStatisticsByState");
+if ($mode == 'memberbytown') $title = $langs->trans("MembersStatisticsByTown");
+if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion");
llxHeader('', $title, '', '', 0, 0, $arrayjs);
-print load_fiche_titre($title, $mesg);
+print load_fiche_titre($title, '', 'object_group');
dol_mkdir($dir);
@@ -73,92 +73,92 @@ if ($mode)
// Define sql
if ($mode == 'memberbycountry')
{
- $label=$langs->trans("Country");
- $tab='statscountry';
+ $label = $langs->trans("Country");
+ $tab = 'statscountry';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql.=" WHERE d.entity IN (".getEntity('adherent').")";
- $sql.=" AND d.statut = 1";
- $sql.=" GROUP BY c.label, c.code";
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label";
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY c.label, c.code";
//print $sql;
}
if ($mode == 'memberbystate')
{
- $label=$langs->trans("Country");
- $label2=$langs->trans("State");
- $tab='statsstate';
+ $label = $langs->trans("Country");
+ $label2 = $langs->trans("State");
+ $tab = 'statsstate';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql.=" WHERE d.entity IN (".getEntity('adherent').")";
- $sql.=" AND d.statut = 1";
- $sql.=" GROUP BY co.label, co.code, c.nom";
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, c.nom as label2"; //
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY co.label, co.code, c.nom";
//print $sql;
}
if ($mode == 'memberbyregion') //
{
- $label=$langs->trans("Country");
- $label2=$langs->trans("Region"); //département
- $tab='statsregion'; //onglet
+ $label = $langs->trans("Country");
+ $label2 = $langs->trans("Region"); //département
+ $tab = 'statsregion'; //onglet
$data = array(); //tableau de donnée
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql.=" WHERE d.entity IN (".getEntity('adherent').")";
- $sql.=" AND d.statut = 1";
- $sql.=" GROUP BY co.label, co.code, r.nom"; //+
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, co.code, co.label, r.nom as label2";
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as r on c.fk_region = r.code_region";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co on d.country = co.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY co.label, co.code, r.nom"; //+
//print $sql;
}
if ($mode == 'memberbytown')
{
- $label=$langs->trans("Country");
- $label2=$langs->trans("Town");
- $tab='statstown';
+ $label = $langs->trans("Country");
+ $label2 = $langs->trans("Town");
+ $tab = 'statstown';
$data = array();
- $sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
- $sql.=" FROM ".MAIN_DB_PREFIX."adherent as d";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
- $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
- $sql.=" WHERE d.entity IN (".getEntity('adherent').")";
- $sql.=" AND d.statut = 1";
- $sql.=" GROUP BY c.label, c.code, d.town";
+ $sql .= "SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, MAX(s.dateadh) as lastsubscriptiondate, c.code, c.label, d.town as label2";
+ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid";
+ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."subscription as s ON s.fk_adherent = d.rowid";
+ $sql .= " WHERE d.entity IN (".getEntity('adherent').")";
+ $sql .= " AND d.statut = 1";
+ $sql .= " GROUP BY c.label, c.code, d.town";
//print $sql;
}
- $langsen=new Translate('', $conf);
+ $langsen = new Translate('', $conf);
$langsen->setDefaultLang('en_US');
$langsen->load("dict");
//print $langsen->trans("Country"."FI");exit;
// Define $data array
dol_syslog("Count member", LOG_DEBUG);
- $resql=$db->query($sql);
+ $resql = $db->query($sql);
if ($resql)
{
- $num=$db->num_rows($resql);
- $i=0;
+ $num = $db->num_rows($resql);
+ $i = 0;
while ($i < $num)
{
- $obj=$db->fetch_object($resql);
+ $obj = $db->fetch_object($resql);
if ($mode == 'memberbycountry')
{
- $data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
+ $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
'code'=>$obj->code,
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
@@ -167,10 +167,10 @@ if ($mode)
}
if ($mode == 'memberbyregion') //+
{
- $data[]=array(
- 'label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
+ $data[] = array(
+ 'label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@@ -178,9 +178,9 @@ if ($mode)
}
if ($mode == 'memberbystate')
{
- $data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
+ $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@@ -188,9 +188,9 @@ if ($mode)
}
if ($mode == 'memberbytown')
{
- $data[]=array('label'=>(($obj->code && $langs->trans("Country".$obj->code)!="Country".$obj->code)?$langs->trans("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("Country".$obj->code):($obj->label?$obj->label:$langs->trans("Unknown"))),
- 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
+ $data[] = array('label'=>(($obj->code && $langs->trans("Country".$obj->code) != "Country".$obj->code) ? $langs->trans("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code) != "Country".$obj->code) ? $langsen->transnoentitiesnoconv("Country".$obj->code) : ($obj->label ? $obj->label : $langs->trans("Unknown"))),
+ 'label2'=>($obj->label2 ? $obj->label2 : $langs->trans("Unknown")),
'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
@@ -214,7 +214,7 @@ dol_fiche_head($head, $tab, $langs->trans("Statistics"), -1, 'user');
// Print title
-if ($mode && ! count($data))
+if ($mode && !count($data))
{
print $langs->trans("NoValidatedMemberYet").' ';
print ' ';
@@ -224,7 +224,7 @@ else
if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").' ';
elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").' ';
elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").' ';
- elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").' ';//+
+ elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").' '; //+
else
{
print $langs->trans("MembersStatisticsDesc").' ';
@@ -234,8 +234,8 @@ else
print ''.$langs->trans("MembersStatisticsByState").' ';
print ' ';
print ''.$langs->trans("MembersStatisticsByTown").' ';
- print ' ';//+
- print ''.$langs->trans("MembersStatisticsByRegion").' ';//+
+ print ' '; //+
+ print ''.$langs->trans("MembersStatisticsByRegion").' '; //+
}
print ' ';
}
@@ -260,16 +260,16 @@ if (count($arrayjs) && $mode == 'memberbycountry')
print "\tdata.addColumn('number', 'Number');\n";
// loop and dump
- $i=0;
- foreach($data as $val)
+ $i = 0;
+ foreach ($data as $val)
{
- $valcountry=strtoupper($val['code']); // Should be ISO-3166 code (faster)
+ $valcountry = strtoupper($val['code']); // Should be ISO-3166 code (faster)
//$valcountry=ucfirst($val['label_en']);
if ($valcountry == 'Great Britain') { $valcountry = 'United Kingdom'; } // fix case of uk (when we use labels)
print "\tdata.setValue(".$i.", 0, \"".$valcountry."\");\n";
print "\tdata.setValue(".$i.", 1, ".$val['nb'].");\n";
// Google's Geomap only supports up to 400 entries
- if ($i >= 400){ break; }
+ if ($i >= 400) { break; }
$i++;
}
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index 10eca32ac13..cb0e6a463e4 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -28,11 +28,11 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherentstats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
-$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
-$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
+$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
+$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
-$userid=GETPOST('userid', 'int'); if ($userid < 0) $userid=0;
-$socid=GETPOST('socid', 'int'); if ($socid < 0) $socid=0;
+$userid = GETPOST('userid', 'int'); if ($userid < 0) $userid = 0;
+$socid = GETPOST('socid', 'int'); if ($socid < 0) $socid = 0;
// Security check
if ($user->socid > 0)
@@ -40,28 +40,28 @@ if ($user->socid > 0)
$action = '';
$socid = $user->socid;
}
-$result=restrictedArea($user, 'adherent', '', '', 'cotisation');
+$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = strftime("%Y", time());
-$startyear=$year-2;
-$endyear=$year;
+$startyear = $year - 2;
+$endyear = $year;
// Load translation files required by the page
-$langs->loadLangs(array("companies","members"));
+$langs->loadLangs(array("companies", "members"));
/*
* View
*/
-$form=new Form($db);
+$form = new Form($db);
$title = $langs->trans("SubscriptionsStatistics");
llxHeader('', $title);
print load_fiche_titre($title, '', 'members');
-$dir=$conf->adherent->dir_temp;
+$dir = $conf->adherent->dir_temp;
dol_mkdir($dir);
@@ -79,13 +79,13 @@ $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscripti
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
-if (! $mesg)
+if (!$mesg)
{
$px1->SetData($data);
- $i=$startyear;
+ $i = $startyear;
while ($i <= $endyear)
{
- $legend[]=$i;
+ $legend[] = $i;
$i++;
}
$px1->SetLegend($legend);
@@ -96,7 +96,7 @@ if (! $mesg)
$px1->SetYLabel($langs->trans("NbOfSubscriptions"));
$px1->SetShading(3);
$px1->SetHorizTickIncrement(1);
- $px1->mode='depth';
+ $px1->mode = 'depth';
$px1->SetTitle($langs->trans("NbOfSubscriptions"));
$px1->draw($filenamenb, $fileurlnb);
@@ -112,13 +112,13 @@ $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=memberstats&file=subscr
$px2 = new DolGraph();
$mesg = $px2->isGraphKo();
-if (! $mesg)
+if (!$mesg)
{
$px2->SetData($data);
- $i=$startyear;
+ $i = $startyear;
while ($i <= $endyear)
{
- $legend[]=$i;
+ $legend[] = $i;
$i++;
}
$px2->SetLegend($legend);
@@ -129,7 +129,7 @@ if (! $mesg)
$px2->SetYLabel($langs->trans("AmountOfSubscriptions"));
$px2->SetShading(3);
$px2->SetHorizTickIncrement(1);
- $px2->mode='depth';
+ $px2->mode = 'depth';
$px2->SetTitle($langs->trans("AmountOfSubscriptions"));
$px2->draw($filenameamount, $fileurlamount);
@@ -174,11 +174,11 @@ print ''.$langs->trans("AmountTotal").' ';
print ''.$langs->trans("AmountAverage").' ';
print '';
-$oldyear=0;
+$oldyear = 0;
foreach ($data as $val)
{
$year = $val['year'];
- while ($oldyear > $year+1)
+ while ($oldyear > $year + 1)
{ // If we have empty year
$oldyear--;
print '';
@@ -202,7 +202,7 @@ foreach ($data as $val)
print ''.price(price2num($val['total'], 'MT'), 1).' ';
print ''.price(price2num($val['avg'], 'MT'), 1).' ';
print ' ';
- $oldyear=$year;
+ $oldyear = $year;
}
print '
';
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index 12301b272a6..47866fc8981 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -81,33 +81,33 @@ if ($rowid)
$result = $object->fetch($rowid);
// Define variables to know what current user can do on users
- $canadduser=($user->admin || $user->rights->user->user->creer);
+ $canadduser = ($user->admin || $user->rights->user->user->creer);
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id)
{
// $user is the user editing, $object->user_id is the user's id linked to the edited member
- $caneditfielduser=( (($user->id == $object->user_id) && $user->rights->user->self->creer)
- || (($user->id != $object->user_id) && $user->rights->user->user->creer) );
- $caneditpassworduser=( (($user->id == $object->user_id) && $user->rights->user->self->password)
- || (($user->id != $object->user_id) && $user->rights->user->user->password) );
+ $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
+ || (($user->id != $object->user_id) && $user->rights->user->user->creer));
+ $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
+ || (($user->id != $object->user_id) && $user->rights->user->user->password));
}
}
// Define variables to know what current user can do on members
-$canaddmember=$user->rights->adherent->creer;
+$canaddmember = $user->rights->adherent->creer;
// Define variables to know what current user can do on properties of a member
if ($rowid)
{
- $caneditfieldmember=$user->rights->adherent->creer;
+ $caneditfieldmember = $user->rights->adherent->creer;
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('subscription'));
// PDF
-$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
-$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
-$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
+$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
+$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
+$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
/*
diff --git a/htdocs/adherents/subscription/info.php b/htdocs/adherents/subscription/info.php
index f3d9fc5790c..78b3fd4384b 100644
--- a/htdocs/adherents/subscription/info.php
+++ b/htdocs/adherents/subscription/info.php
@@ -29,12 +29,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
// Load translation files required by the page
-$langs->loadLangs(array("companies","members","bills","users"));
+$langs->loadLangs(array("companies", "members", "bills", "users"));
if (!$user->rights->adherent->lire)
accessforbidden();
-$rowid=GETPOST("rowid", 'int');
+$rowid = GETPOST("rowid", 'int');
diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php
index c75041705df..b9f5611f7e8 100644
--- a/htdocs/adherents/subscription/list.php
+++ b/htdocs/adherents/subscription/list.php
@@ -33,6 +33,7 @@ $langs->loadLangs(array("members", "companies"));
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
+$contextpage = GETPOST('contextpage', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
$toselect = GETPOST('toselect', 'array');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search
@@ -117,7 +118,6 @@ if (empty($reshook))
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
- $search = "";
$search_type = "";
$search_ref = "";
$search_lastname = "";
@@ -338,7 +338,7 @@ if (!empty($arrayfields['t.libelle']['checked']))
if (!empty($arrayfields['d.bank']['checked']))
{
print '
';
- $form->select_comptes($search_account, 'search_account', 0, '', 1);
+ $form->select_comptes($search_account, 'search_account', 0, '', 1, '', 0, 'maxwidth150');
print ' ';
}
@@ -444,7 +444,7 @@ while ($i < min($num, $limit))
// Type
if (!empty($arrayfields['d.fk_type']['checked']))
{
- print '
';
+ print ' ';
if ($typeid > 0)
{
print $adht->getNomUrl(1);
@@ -464,14 +464,14 @@ while ($i < min($num, $limit))
// Firstname
if (!empty($arrayfields['d.firstname']['checked']))
{
- print ' '.$adherent->firstname.' ';
+ print '
'.$adherent->firstname.' ';
if (!$i) $totalarray['nbfield']++;
}
// Login
if (!empty($arrayfields['d.login']['checked']))
{
- print '
'.$adherent->login.' ';
+ print '
'.$adherent->login.' ';
if (!$i) $totalarray['nbfield']++;
}
@@ -487,7 +487,7 @@ while ($i < min($num, $limit))
// Banque
if (!empty($arrayfields['d.bank']['checked']))
{
- print "
";
+ print ' ';
if ($obj->fk_account > 0)
{
$accountstatic->id = $obj->fk_account;
diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php
index 26850c72b84..4c68b82784f 100644
--- a/htdocs/adherents/type_translation.php
+++ b/htdocs/adherents/type_translation.php
@@ -71,21 +71,21 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
$current_lang = $langs->getDefaultLang();
// update of object
- if ( $_POST["forcelangprod"] == $current_lang )
+ if ($_POST["forcelangprod"] == $current_lang)
{
$object->label = $_POST["libelle"];
- $object->description = dol_htmlcleanlastbr($_POST["desc"]);
+ $object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]);
}
else
{
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
- $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
+ $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]);
}
// backup into database
- if ( $object->setMultiLangs($user) > 0 )
+ if ($object->setMultiLangs($user) > 0)
{
$action = '';
}
diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php
index b5a6e2e3dfe..7a436c5a363 100644
--- a/htdocs/admin/accountant.php
+++ b/htdocs/admin/accountant.php
@@ -28,27 +28,27 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
-$action=GETPOST('action', 'aZ09');
-$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'adminaccoutant'; // To manage different context of search
+$action = GETPOST('action', 'aZ09');
+$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'adminaccoutant'; // To manage different context of search
// Load translation files required by the page
$langs->loadLangs(array('admin', 'companies'));
-if (! $user->admin) accessforbidden();
+if (!$user->admin) accessforbidden();
-$error=0;
+$error = 0;
/*
* Actions
*/
-$parameters=array();
-$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
-if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
-|| ($action == 'updateedit') )
+if (($action == 'update' && !GETPOST("cancel", 'alpha'))
+|| ($action == 'updateedit'))
{
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NAME", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_ADDRESS", GETPOST("address", 'nohtml'), 'chaine', 0, '', $conf->entity);
@@ -64,7 +64,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_CODE", GETPOST("code", 'nohtml'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, "MAIN_INFO_ACCOUNTANT_NOTE", GETPOST("note", 'none'), 'chaine', 0, '', $conf->entity);
- if ($action != 'updateedit' && ! $error)
+ if ($action != 'updateedit' && !$error)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
@@ -75,7 +75,7 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha'))
* View
*/
-$help_url='';
+$help_url = '';
llxHeader('', $langs->trans("CompanyFoundation"), $help_url);
print load_fiche_titre($langs->trans("CompanyFoundation"), '', 'title_setup');
@@ -84,11 +84,11 @@ $head = company_admin_prepare_head();
dol_fiche_head($head, 'accountant', $langs->trans("Company"), -1, 'company');
-$form=new Form($db);
-$formother=new FormOther($db);
-$formcompany=new FormCompany($db);
+$form = new Form($db);
+$formother = new FormOther($db);
+$formcompany = new FormCompany($db);
-$countrynotdefined=''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").') ';
+$countrynotdefined = ''.$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").') ';
print ''.$langs->trans("AccountantDesc")." \n";
print " \n";
@@ -109,22 +109,22 @@ print '