Merge branch 'develop' into NEW_develop_supplier_buyprice_barcode

This commit is contained in:
Laurent Destailleur 2019-03-14 17:48:44 +01:00 committed by GitHub
commit 8f65ee2296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2497 changed files with 69275 additions and 50854 deletions

View File

@ -309,7 +309,7 @@ script:
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
#phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
phpcs -s -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true . phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .
set +e set +e
echo echo

View File

@ -236,6 +236,12 @@ source_file = htdocs/langs/en_US/modulebuilder.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.mrp]
file_filter = htdocs/langs/<lang>/mrp.lang
source_file = htdocs/langs/en_US/mrp.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.multicurrency] [dolibarr.multicurrency]
file_filter = htdocs/langs/<lang>/multicurrency.lang file_filter = htdocs/langs/<lang>/multicurrency.lang
source_file = htdocs/langs/en_US/multicurrency.lang source_file = htdocs/langs/en_US/multicurrency.lang

View File

@ -34,7 +34,7 @@ Swift Mailer 5.4.2-DEV MIT license Yes
Stripe 4.7.0 MIT licence Yes Library for Stripe module Stripe 4.7.0 MIT licence Yes Library for Stripe module
JS libraries: JS libraries:
jQuery 3.1.1 MIT License Yes JS library jQuery 3.3.1 MIT License Yes JS library
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups) jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
@ -57,8 +57,7 @@ Image libraries:
Octicons 8.1 MIT Yes Octicons 8.1 MIT Yes
Font libraries: Font libraries:
Fontawesome 4.7 ? Yes Fontawesome 5.7.2 Font Awesome Free licence Yes
Fontawesome 5.0 ? Yes
For licenses compatibility informations: For licenses compatibility informations:

View File

@ -15,28 +15,60 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules. * Method GetUrlTrackingStatus were renamed into getUrlTrackingStatus for consistency with naming rules.
* API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules. * API getListOfCivility has been renamed into getListOfCivilities for consistency with naming rules.
* Deprecated function img_phone as been removed. You can use img_picto(..., 'call|call_out') instead.;
* Files for variables of themes were renamed from graph-color.php into theme_vars.inc.php to match naming
convention of extension .inc.php for files to be included.
***** ChangeLog for 9.0.1 compared to 9.0.0 ***** ***** ChangeLog for 9.0.1 compared to 9.0.0 *****
FIX: #10381 FIX: #10381
FIX: #10460 compatibility with MariaDB 10.4 FIX: #10460 compatibility with MariaDB 10.4
FIX: #10485 FIX: #10485
FIX: #10638
FIX: Accountancy - Adding transaction with multicompany uses all the time 1st entity
FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work
FIX: add fk_unit on addline action FIX: add fk_unit on addline action
FIX: adding css by page if url is externam
FIX: Bad link in menu manager
FIX: better test on fetch FIX: better test on fetch
FIX: can't add lines on invoices
FIX: Check for old picture name if the new one was not found
FIX: could not create several superadmin in transversal mode
FIX: creation of menu entry with parent id not int
FIX: creation of new left menu entry
FIX: Default language of company is not set FIX: Default language of company is not set
FIX: error on setup of password if pass generators have a .old file.
FIX: error report not returned FIX: error report not returned
FIX: expedition: reset status on rollback + replace hardcoded status with const FIX: expedition: reset status on rollback + replace hardcoded status with const
FIX: fetch module / pos source
FIX: fk_default_warehouse missing in group by
FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it
FIX: if empty error message, we just see "error" displayed
FIX: label of bank account
FIX: line edit template: keep fk_parent_line FIX: line edit template: keep fk_parent_line
FIX: Mark credit note as available for credit note in other currency
FIX: missing access security checking with multicompany
FIX: missing entity filter in function "build_filterField()" (export module)
FIX: missing $ismultientitymanaged for previous/next ref
FIX: Missing province in export of invoice FIX: Missing province in export of invoice
FIX: must fetch member in current entity FIX: must fetch member in current entity
FIX: positive values creating diff on addline rounding
FIX: positive values IN supplier credit notes creating diff on addline rounding
FIX: Price in combo list of service does not use the correct price level FIX: Price in combo list of service does not use the correct price level
FIX: supplier invoice payment total doesnt care about deposit or credit FIX: project_title for display of getNomUrl()
FIX: same thing here
FIX: Show button POS Ticket only if invoice was generated by POS
FIX: supplier invoice payment total doesn't care about deposit or credit
FIX: supplier invoice product stats total ht is line total not invoice total FIX: supplier invoice product stats total ht is line total not invoice total
FIX: The notes was also copied on invoice
FIX: Transaction on leave approval and decrease ko if setup not complete
FIX: Translation not loaded by scheduled jobs FIX: Translation not loaded by scheduled jobs
FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9
FIX: we want to be able to reopen fourn credit note
FIX: wrong feature2 when user rights "group_advance" is used
FIX: wrong merged conflict FIX: wrong merged conflict
FIX: wrong tests on fetch FIX: wrong tests on fetch
NEW: Add protection to avoid packaging if files non indexed exists into NEW: Add protection to avoid packaging if files non indexed exists
***** ChangeLog for 9.0.0 compared to 8.0.0 ***** ***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users: For Users:

View File

@ -1,6 +1,6 @@
# DOLIBARR ERP & CRM # DOLIBARR ERP & CRM
![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) ![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg)
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|6|7|8|9|develop| |6|7|8|9|develop|
@ -47,7 +47,7 @@ You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL)
git clone https://github.com/dolibarr/dolibarr -b x.y (where x.y is main version like 3.6, 9.0, ...) git clone https://github.com/dolibarr/dolibarr -b x.y (where x.y is main version like 3.6, 9.0, ...)
- Set up your web server to use "*dolibarr/htdocs*" as root if you'r web server does not have directory to point to already defined. - Set up your web server to use "*dolibarr/htdocs*" as root if your web server does not have an already defined directory to point to.
- Create an empty `htdocs/conf/conf.php` file and set *write* permissions for your web server user (*write* permission will be removed once install is finished) - Create an empty `htdocs/conf/conf.php` file and set *write* permissions for your web server user (*write* permission will be removed once install is finished)

View File

@ -191,6 +191,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm %_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install

View File

@ -271,6 +271,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm %_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install

View File

@ -188,6 +188,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm %_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install

View File

@ -199,6 +199,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/ftp %_datadir/dolibarr/htdocs/ftp
%_datadir/dolibarr/htdocs/holiday %_datadir/dolibarr/htdocs/holiday
%_datadir/dolibarr/htdocs/hrm %_datadir/dolibarr/htdocs/hrm
%_datadir/dolibarr/htdocs/ifttt
%_datadir/dolibarr/htdocs/imports %_datadir/dolibarr/htdocs/imports
%_datadir/dolibarr/htdocs/includes %_datadir/dolibarr/htdocs/includes
%_datadir/dolibarr/htdocs/install %_datadir/dolibarr/htdocs/install

View File

@ -53,97 +53,118 @@ $error=0;
// List of sql to execute // List of sql to execute
$sqls=array( $sqls=array(
'user'=>array( 'user'=>array(
'DELETE FROM '.MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin')", "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user IN (SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin') AND fk_user IN (select rowid FROM ".MAIN_DB_PREFIX."user where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin'", "DELETE FROM ".MAIN_DB_PREFIX."user WHERE admin = 0 and login != 'admin' AND datec < '__DATE__'",
),
'event'=>array(
//"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."actioncomm WHERE datec < '__DATE__'",
),
'payment'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."paiement_facture where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."paiement where rowid NOT IN (SELECT fk_paiement FROM ".MAIN_DB_PREFIX."paiement_facture)",
), ),
'bank'=>array( 'bank'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'bank_account', "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'bank_class', "DELETE FROM ".MAIN_DB_PREFIX."bank_url WHERE fk_bank IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'bank_url', "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE datec < '__DATE__'",
'DELETE FROM '.MAIN_DB_PREFIX.'bank',
), ),
'contract'=>array( 'bankaccount'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'contratdet', "DELETE FROM ".MAIN_DB_PREFIX."bank_account WHERE datec < '__DATE__'",
'DELETE FROM '.MAIN_DB_PREFIX.'contrat',
), ),
'invoice'=>array( 'invoice'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'paiement_facture', '@payment',
'DELETE FROM '.MAIN_DB_PREFIX.'facture_rec', "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_source IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'facturedet', "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE fk_facture_source IS NOT NULL', "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except where fk_facture_line IN (select rowid FROM ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture IN (select rowid from ".MAIN_DB_PREFIX."facture where datec < '__DATE__'))",
'DELETE FROM '.MAIN_DB_PREFIX.'facture', "DELETE FROM ".MAIN_DB_PREFIX."facture_rec where datec < '__DATE__'",
"DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE fk_facture IN (select rowid FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__')",
"UPDATE ".MAIN_DB_PREFIX."facture SET fk_facture_source = NULL WHERE fk_facture_source IN (select f2.rowid FROM (select * from ".MAIN_DB_PREFIX."facture) as f2 where f2.datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."facture where datec < '__DATE__'",
),
'accounting'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."accounting_bookkeeping where doc_date < '__DATE__'",
), ),
'proposal'=>array( 'proposal'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'propaldet', "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'propal', "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE datec < '__DATE__'",
), ),
'supplier_proposal'=>array( "supplier_proposal"=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposaldet', "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal IN (select rowid FROM ".MAIN_DB_PREFIX."propal where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'supplier_proposal', "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal where datec < '__DATE__'",
),
'supplier_order'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet',
'DELETE FROM '.MAIN_DB_PREFIX.'commande_fournisseur',
),
'supplier_invoice'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det',
'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn',
),
'delivery'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'livraisondet',
'DELETE FROM '.MAIN_DB_PREFIX.'livraison',
),
'shipment'=>array(
'@delivery',
'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet_batch',
'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet_extrafields',
'DELETE FROM '.MAIN_DB_PREFIX.'expeditiondet',
'DELETE FROM '.MAIN_DB_PREFIX.'expedition_extrafields',
'DELETE FROM '.MAIN_DB_PREFIX.'expedition',
), ),
'order'=>array( 'order'=>array(
'@shipment', '@shipment',
'DELETE FROM '.MAIN_DB_PREFIX.'commandedet', "DELETE FROM ".MAIN_DB_PREFIX."commandedet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'commande', "DELETE FROM ".MAIN_DB_PREFIX."commande where date_creation < '__DATE__'",
),
'supplier_order'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande IN (select rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur where date_creation < '__DATE__'",
),
'supplier_invoice'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det WHERE fk_facture_fourn IN (select rowid FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."facture_fourn where datec < '__DATE__'",
),
'shipment'=>array(
'@delivery',
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_batch WHERE fk_expeditiondet IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."expeditiondet WHERE fk_expedition IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."expedition_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."expedition where date_creation < '__DATE__'",
),
'delivery'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."livraisondet WHERE fk_livraison IN (select rowid FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."livraison where date_creation < '__DATE__'",
),
'contract'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."contratdet_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__'))",
"DELETE FROM ".MAIN_DB_PREFIX."contratdet WHERE fk_contrat IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."contrat_extrafields WHERE fk_object IN (select rowid FROM ".MAIN_DB_PREFIX."contrat where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."contrat WHERE datec < '__DATE__'",
), ),
'intervention'=>array( 'intervention'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'fichinterdet', "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE fk_fichinter IN (select rowid FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'fichinter', "DELETE FROM ".MAIN_DB_PREFIX."fichinter where datec < '__DATE__'",
),
'stock'=>array(
"DELETE FROM ".MAIN_DB_PREFIX."stock_mouvement WHERE datem < '__DATE__'",
), ),
'product'=>array( 'product'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_product', "DELETE FROM ".MAIN_DB_PREFIX."categorie_product WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'product_lang', "DELETE FROM ".MAIN_DB_PREFIX."product_lang WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'product_price', "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty WHERE fk_product_price IN (select rowid FROM ".MAIN_DB_PREFIX."product_price where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
'DELETE FROM '.MAIN_DB_PREFIX.'product_fournisseur_price', "DELETE FROM ".MAIN_DB_PREFIX."product_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'product_batch', "DELETE FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'product_stock', "DELETE FROM ".MAIN_DB_PREFIX."product_batch WHERE fk_product_stock IN (select rowid FROM ".MAIN_DB_PREFIX."product_stock where fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'))",
'DELETE FROM '.MAIN_DB_PREFIX.'product_lot', "DELETE FROM ".MAIN_DB_PREFIX."product_stock WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'product', "DELETE FROM ".MAIN_DB_PREFIX."product_lot WHERE fk_product IN (select rowid FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."product where datec < '__DATE__'",
), ),
'project'=>array( 'project'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task_time', // TODO set fk_project to null on object that refer to project
'DELETE FROM '.MAIN_DB_PREFIX.'projet_task', "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time WHERE fk_task IN (select rowid FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'))",
'DELETE FROM '.MAIN_DB_PREFIX.'projet', "DELETE FROM ".MAIN_DB_PREFIX."projet_task WHERE fk_projet IN (select rowid FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__')",
"DELETE FROM ".MAIN_DB_PREFIX."projet where datec < '__DATE__'",
), ),
'contact'=>array( 'contact'=>array(
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_contact', "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact WHERE fk_socpeople IN (select rowid FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'socpeople', "DELETE FROM ".MAIN_DB_PREFIX."socpeople where datec < '__DATE__'",
), ),
'thirdparty'=>array( 'thirdparty'=>array(
'@contact', '@contact',
'DELETE FROM '.MAIN_DB_PREFIX.'cabinetmed_cons', "DELETE FROM ".MAIN_DB_PREFIX."cabinetmed_cons WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
'UPDATE '.MAIN_DB_PREFIX.'adherent SET fk_soc = NULL', "UPDATE ".MAIN_DB_PREFIX."adherent SET fk_soc = NULL WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_fournisseur', "DELETE FROM ".MAIN_DB_PREFIX."categorie_fournisseur WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'categorie_societe', "DELETE FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'societe_remise_except', "DELETE FROM ".MAIN_DB_PREFIX."societe_remise_except WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'societe_rib', "DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE fk_soc IN (select rowid FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__')",
'DELETE FROM '.MAIN_DB_PREFIX.'societe', "DELETE FROM ".MAIN_DB_PREFIX."societe where datec < '__DATE__'",
) )
); );
/* /*
* Main * Main
*/ */
@ -154,27 +175,50 @@ dol_syslog($script_file." launched with arg ".implode(',', $argv));
$mode = $argv[1]; $mode = $argv[1];
$option = $argv[2]; $option = $argv[2];
$date = $argv[3];
if (empty($mode) || ! in_array($mode, array('test','confirm'))) { if (empty($mode) || ! in_array($mode, array('test','confirm'))) {
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n"; print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n"; print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1); exit(-1);
} }
if (empty($option))
{
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option must be defined with a value in list ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
if ($option != 'all')
{
$listofoptions=explode(',', $option);
foreach($listofoptions as $cursoroption)
{
if (! in_array($cursoroption, array_keys($sqls))) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option '".$cursoroption."' must be in list ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
}
}
if (empty($date) || (! preg_match('/\d\d\d\d\-\d\d\-\d\d$/', $date) && $date != 'all')) {
print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "date can be 'all' or 'YYYY-MM-DD' to delete record before YYYY-MM-DD\n";
exit(-1);
}
if (empty($option) || ! in_array($option, array_merge(array('all'), array_keys($sqls))) ) { if ($date == 'all') $date = '2199-01-01';
print "Usage: $script_file (test|confirm) (all|option) [dbtype dbhost dbuser dbpassword dbname dbport]\n";
print "\n";
print "option can be ".implode(',', array_keys($sqls))."\n";
exit(-1);
}
// Replace database handler // Replace database handler
if (! empty($argv[3])) if (! empty($argv[4]))
{ {
$db->close(); $db->close();
unset($db); unset($db);
$db=getDoliDBInstance($argv[3], $argv[4], $argv[5], $argv[6], $argv[7], $argv[8]); $db=getDoliDBInstance($argv[4], $argv[5], $argv[6], $argv[7], $argv[8], $argv[9]);
$user=new User($db); $user=new User($db);
} }
@ -189,6 +233,7 @@ if (! $ret > 0)
print "Purge all data for this database:\n"; print "Purge all data for this database:\n";
print "Before = ".$date."\n";
print "Server = ".$db->database_host."\n"; print "Server = ".$db->database_host."\n";
print "Database name = ".$db->database_name."\n"; print "Database name = ".$db->database_name."\n";
print "Database port = ".$db->database_port."\n"; print "Database port = ".$db->database_port."\n";
@ -206,9 +251,10 @@ if (! $confirmed)
* Process sql requests of a family * Process sql requests of a family
* *
* @param string $family Name of family key of array $sqls * @param string $family Name of family key of array $sqls
* @param string $date Date value
* @return int -1 if KO, 1 if OK * @return int -1 if KO, 1 if OK
*/ */
function processfamily($family) function processfamily($family, $date)
{ {
global $db, $sqls; global $db, $sqls;
@ -218,11 +264,14 @@ function processfamily($family)
if (preg_match('/^@/', $sql)) if (preg_match('/^@/', $sql))
{ {
$newfamily=preg_replace('/@/', '', $sql); $newfamily=preg_replace('/@/', '', $sql);
processfamily($newfamily); processfamily($newfamily, $date);
continue; continue;
} }
$sql = preg_replace('/__DATE__/', $date, $sql);
print "Run sql: ".$sql."\n"; print "Run sql: ".$sql."\n";
$resql=$db->query($sql); $resql=$db->query($sql);
if (! $resql) if (! $resql)
{ {
@ -247,25 +296,29 @@ function processfamily($family)
$db->begin(); $db->begin();
$oldfamily=''; $listofoptions=explode(',', $option);
foreach($sqls as $family => $familysql) foreach($listofoptions as $cursoroption)
{ {
if ($option && $option != 'all' && $option != $family) continue; $oldfamily='';
foreach($sqls as $family => $familysql)
if ($family != $oldfamily) print "Process action for family ".$family."\n";
$oldfamily = $family;
$result=processfamily($family);
if ($result < 0)
{ {
$error++; if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) continue;
break;
if ($family != $oldfamily) print "Process action for family ".$family."\n";
$oldfamily = $family;
$result=processfamily($family, $date);
if ($result < 0)
{
$error++;
break;
}
} }
} }
if ($error || $mode != 'confirm') if ($error || $mode != 'confirm')
{ {
print "Rollback any changes.\n"; print "\nRollback any changes.\n";
$db->rollback(); $db->rollback();
} }
else else

View File

@ -0,0 +1,2 @@
This directory contains the file with the graphical database structure.
It can be read with MySQL Workbench software.

View File

@ -11,10 +11,8 @@
<exclude-pattern type="relative">htdocs/conf.php</exclude-pattern> <exclude-pattern type="relative">htdocs/conf.php</exclude-pattern>
<exclude-pattern type="relative">*/nltechno*</exclude-pattern> <exclude-pattern type="relative">*/nltechno*</exclude-pattern>
<exclude-pattern type="relative">*/htdocs/includes</exclude-pattern> <exclude-pattern type="relative">*/htdocs/includes</exclude-pattern>
<exclude-pattern type="relative">*.min.css</exclude-pattern>
<exclude-pattern type="relative">*.js</exclude-pattern>
<!-- List of all tests --> <!-- List of all tests -->
<!-- Rules from Internal Standard --> <!-- Rules from Internal Standard -->
@ -201,7 +199,7 @@
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint"> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Squiz.Scope.MethodScope.Missing" />
<!-- Rules from PEAR Standard --> <!-- Rules from PEAR Standard -->
@ -430,4 +428,5 @@
<rule ref="PSR2.Files.EndFileNewline.TooMany" /> <rule ref="PSR2.Files.EndFileNewline.TooMany" />
<rule ref="PSR2.Files.EndFileNewline.NoneFound" /> <rule ref="PSR2.Files.EndFileNewline.NoneFound" />
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket" /> <rule ref="PSR2.Methods.FunctionCallSignature.SpaceBeforeOpenBracket" />
<rule ref="PSR2.Classes.PropertyDeclaration.VarUsed" />
</ruleset> </ruleset>

View File

@ -50,7 +50,7 @@ class autoTranslator
* @param string $_apikey Api key * @param string $_apikey Api key
* @return void * @return void
*/ */
function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey) public function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey)
{ {
// Set enviorment variables // Set enviorment variables
@ -346,5 +346,5 @@ class autoTranslator
//print "OK ".join('',$src_texts).' => '.$rep."\n"; //print "OK ".join('',$src_texts).' => '.$rep."\n";
return $rep; return $rep;
} }
} }

View File

@ -307,11 +307,11 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['aa.account_number']['checked'])) print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder); if (! empty($arrayfields['aa.label']['checked'])) print_liste_field_titre($arrayfields['aa.label']['label'], $_SERVER["PHP_SELF"], "aa.label", "", $param, '', $sortfield, $sortorder);
if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, 'align="left"', $sortfield, $sortorder); if (! empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left ');
if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); if (! empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']);
if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']); if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']);
if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); if (! empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
$accountstatic = new AccountingAccount($db); $accountstatic = new AccountingAccount($db);
@ -403,7 +403,7 @@ if ($resql)
} }
// Action // Action
print '<td align="center">'; print '<td class="center">';
if ($user->rights->accounting->chartofaccount) { if ($user->rights->accounting->chartofaccount) {
print '<a href="./card.php?action=update&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">'; print '<a href="./card.php?action=update&id=' . $obj->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?chartofaccounts='.$object->id).'">';
print img_edit(); print img_edit();

View File

@ -532,8 +532,8 @@ if ($id)
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); }
if ($valuetoshow != '') { if ($valuetoshow != '') {
print '<td align="'.$align.'">'; print '<td class="'.$class.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (! empty($tabhelp[$id][$value])) { } elseif (! empty($tabhelp[$id][$value])) {
print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
@ -662,23 +662,29 @@ if ($id)
*/ */
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') {
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $valuetoshow=$langs->trans("Code");
{ }
$valuetoshow=$langs->trans("Label"); if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
if ($id != 25) $valuetoshow.="*"; $valuetoshow=$langs->trans("Label");
} if ($id != 25) $valuetoshow.="*";
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } }
if ($fieldlist[$field]=='country_id') { $showfield=0; } if ($fieldlist[$field]=='country') {
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } $valuetoshow=$langs->trans("Country");
}
if ($fieldlist[$field]=='country_id') {
$showfield=0;
}
if ($fieldlist[$field]=='fk_pcg_version') {
$valuetoshow=$langs->trans("Pcg_version");
}
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield) {
{ print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
} }
} }
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print '</tr>'; print '</tr>';
@ -757,7 +763,7 @@ if ($id)
$class='tddict'; $class='tddict';
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
// Show value for field // Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
} }
} }
@ -769,17 +775,17 @@ if ($id)
$url.='&'; $url.='&';
// Active // Active
print '<td align="center" class="nowrap">'; print '<td class="center nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else print $langs->trans("AlwaysActive"); else print $langs->trans("AlwaysActive");
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link
if ($iserasable) print '<td align="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>'; if ($iserasable) print '<td class="center"><a href="'.$url.'action=delete">'.img_delete().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
@ -852,7 +858,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
} }
} }
elseif ($fieldlist[$field] == 'type_cdr') { elseif ($fieldlist[$field] == 'type_cdr') {
if ($fieldlist[$field] == 'type_cdr') print '<td align="center">'; if ($fieldlist[$field] == 'type_cdr') print '<td class="center">';
else print '<td>'; else print '<td>';
if ($fieldlist[$field] == 'type_cdr') { if ($fieldlist[$field] == 'type_cdr') {
print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); print $form->selectarray($fieldlist[$field], array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));

View File

@ -60,7 +60,7 @@ $accountingcategory = new AccountancyCategory($db);
// si ajout de comptes // si ajout de comptes
if (! empty($selectcpt)) { if (! empty($selectcpt)) {
$cpts = array (); $cpts = array();
foreach ($selectcpt as $selectedoption) { foreach ($selectcpt as $selectedoption) {
if (! array_key_exists($selectedoption, $cpts)) if (! array_key_exists($selectedoption, $cpts))
$cpts[$selectedoption] = "'" . $selectedoption . "'"; $cpts[$selectedoption] = "'" . $selectedoption . "'";
@ -71,13 +71,13 @@ if (! empty($selectcpt)) {
if ($return<0) { if ($return<0) {
setEventMessages($langs->trans('errors'), $accountingcategory->errors, 'errors'); setEventMessages($langs->trans('errors'), $accountingcategory->errors, 'errors');
} else { } else {
setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); setEventMessages($langs->trans('RecordModifiedSuccessfully'), null, 'mesgs');
} }
} }
if ($action == 'delete') { if ($action == 'delete') {
if ($cpt_id) { if ($cpt_id) {
if ($accountingcategory->deleteCptCat($cpt_id)) { if ($accountingcategory->deleteCptCat($cpt_id)) {
setEventMessages($langs->trans('CategoryDeleted'), null, 'mesgs'); setEventMessages($langs->trans('AccountRemovedFromGroup'), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans('errors'), null, 'errors'); setEventMessages($langs->trans('errors'), null, 'errors');
} }
@ -173,8 +173,9 @@ if ($action == 'display' || $action == 'delete') {
print '<td>' . $cpt->label . '</td>'; print '<td>' . $cpt->label . '</td>';
print '<td class="right">'; print '<td class="right">';
print "<a href= '".$_SERVER['PHP_SELF']."?action=delete&account_category=" . $cat_id . "&cptid=" . $cpt->rowid."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?action=delete&account_category=" . $cat_id . "&cptid=" . $cpt->rowid."'>";
print img_delete($langs->trans("DeleteFromCat")).' '; print $langs->trans("DeleteFromCat");
print $langs->trans("DeleteFromCat")."</a>"; print img_picto($langs->trans("DeleteFromCat"), 'unlink');
print "</a>";
print "</td>"; print "</td>";
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -41,8 +41,7 @@ $rowid=GETPOST('rowid', 'alpha');
$code=GETPOST('code', 'alpha'); $code=GETPOST('code', 'alpha');
// Security access // Security access
if (empty($user->rights->accounting->chartofaccount)) if (empty($user->rights->accounting->chartofaccount)) {
{
accessforbidden(); accessforbidden();
} }
@ -468,29 +467,46 @@ if ($id)
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
$class="left"; $class="left";
if ($fieldlist[$field]=='type') { if ($fieldlist[$field]=='type') {
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, '')); if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
else $valuetoshow=$langs->trans("Type"); $valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
} else {
$valuetoshow=$langs->trans("Type");
}
} }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') {
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $valuetoshow=$langs->trans("Code");
{ }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label"); $valuetoshow=$langs->trans("Label");
} }
if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments"); } if ($fieldlist[$field]=='libelle_facture') {
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("LabelOnDocuments");
}
if ($fieldlist[$field]=='country') {
$valuetoshow=$langs->trans("Country"); $valuetoshow=$langs->trans("Country");
} }
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } if ($fieldlist[$field]=='accountancy_code') {
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } $valuetoshow=$langs->trans("AccountancyCode");
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } }
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='accountancy_code_sell') {
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); } $valuetoshow=$langs->trans("AccountancyCodeSell");
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } }
if ($fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow=$langs->trans("AccountancyCodeBuy");
}
if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') {
$valuetoshow=$langs->trans("Pcg_version");
}
if ($fieldlist[$field]=='range_account') {
$valuetoshow=$langs->trans("Comment");
}
if ($fieldlist[$field]=='category_type') {
$valuetoshow=$langs->trans("Calculated");
}
if ($valuetoshow != '') if ($valuetoshow != '') {
{ print '<td class="'.$class.'">';
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow; else print $valuetoshow;
@ -591,7 +607,7 @@ if ($id)
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
if ($filterfound) if ($filterfound)
{ {
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
@ -613,38 +629,73 @@ if ($id)
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } if ($fieldlist[$field]=='source') {
if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } $valuetoshow=$langs->trans("Contact");
if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate");
else $valuetoshow=$langs->trans("Amount");
$align='center';
} }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='price') {
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } $valuetoshow=$langs->trans("PriceUHT");
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') }
{ if ($fieldlist[$field]=='taux') {
if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") {
$valuetoshow=$langs->trans("Rate");
} else {
$valuetoshow=$langs->trans("Amount");
}
$class='center';
}
if ($fieldlist[$field]=='type') {
$valuetoshow=$langs->trans("Type");
}
if ($fieldlist[$field]=='code') {
$valuetoshow=$langs->trans("Code");
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label"); $valuetoshow=$langs->trans("Label");
} }
if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } if ($fieldlist[$field]=='country') {
if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } $valuetoshow=$langs->trans("Country");
if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } }
if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') {
if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } $showfield=0;
if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } }
if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } if ($fieldlist[$field]=='accountancy_code') {
if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } $valuetoshow=$langs->trans("AccountancyCode");
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); } }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } if ($fieldlist[$field]=='accountancy_code_sell') {
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Comment"); } $valuetoshow=$langs->trans("AccountancyCodeSell");
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); } $sortable=0;
}
if ($fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow=$langs->trans("AccountancyCodeBuy");
$sortable=0;
}
if ($fieldlist[$field]=='fk_pcg_version') {
$valuetoshow=$langs->trans("Pcg_version");
}
if ($fieldlist[$field]=='account_parent') {
$valuetoshow=$langs->trans("Accountsparent");
}
if ($fieldlist[$field]=='pcg_type') {
$valuetoshow=$langs->trans("Pcg_type");
}
if ($fieldlist[$field]=='pcg_subtype') {
$valuetoshow=$langs->trans("Pcg_subtype");
}
if ($fieldlist[$field]=='type_template') {
$valuetoshow=$langs->trans("TypeOfTemplate");
}
if ($fieldlist[$field]=='range_account') {
$valuetoshow=$langs->trans("Comment");
}
if ($fieldlist[$field]=='category_type') {
$valuetoshow=$langs->trans("Calculated");
}
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield) {
{ print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
} }
} }
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
@ -670,7 +721,7 @@ if ($id)
print '<td></td>'; print '<td></td>';
print '<td></td>'; print '<td></td>';
print '<td align="center">'; print '<td class="center">';
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
@ -732,7 +783,7 @@ if ($id)
$class='tddict'; $class='tddict';
// Show value for field // Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
} }
} }
@ -750,7 +801,7 @@ if ($id)
$url.='&'; $url.='&';
// Active // Active
print '<td align="center" class="nowrap">'; print '<td class="center" class="nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else else
{ {
@ -759,13 +810,13 @@ if ($id)
print "</td>"; print "</td>";
// Modify link // Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>'; if ($canbemodified) print '<td class="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>'; else print '<td>&nbsp;</td>';
// Delete link // Delete link
if ($iserasable) if ($iserasable)
{ {
print '<td align="center">'; print '<td class="center">';
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>'; if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
print '</td>'; print '</td>';

View File

@ -32,8 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
$langs->loadLangs(array("compta","admin","accountancy")); $langs->loadLangs(array("compta","admin","accountancy"));
// Security check // Security check
if (empty($user->rights->accounting->chartofaccount)) if (empty($user->rights->accounting->chartofaccount)) {
{
accessforbidden(); accessforbidden();
} }
@ -112,7 +111,7 @@ foreach ($list_account_main as $key) {
print $form->textwithpicto($label, $htmltext); print $form->textwithpicto($label, $htmltext);
print '</td>'; print '</td>';
// Value // Value
print '<td>'; // Do not force align=right, or it align also the content of the select box print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -156,7 +156,7 @@ foreach ($list_account_main as $key) {
print $form->textwithpicto($label, $htmltext); print $form->textwithpicto($label, $htmltext);
print '</td>'; print '</td>';
// Value // Value
print '<td>'; // Do not force align=right, or it align also the content of the select box print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -179,7 +179,7 @@ foreach ($list_account as $key) {
$label = $langs->trans($key); $label = $langs->trans($key);
print '<td width="50%">' . $label . '</td>'; print '<td width="50%">' . $label . '</td>';
// Value // Value
print '<td>'; // Do not force align=right, or it align also the content of the select box print '<td>'; // Do not force class=right, or it align also the content of the select box
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -131,8 +131,8 @@ if ($result)
print '<td>' . $langs->trans("Label") . '</td>'; print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("DateStart") . '</td>'; print '<td>' . $langs->trans("DateStart") . '</td>';
print '<td>' . $langs->trans("DateEnd") . '</td>'; print '<td>' . $langs->trans("DateEnd") . '</td>';
print '<td align="center">' . $langs->trans("NumberOfAccountancyEntries") . '</td>'; print '<td class="center">' . $langs->trans("NumberOfAccountancyEntries") . '</td>';
print '<td align="center">' . $langs->trans("NumberOfAccountancyMovements") . '</td>'; print '<td class="center">' . $langs->trans("NumberOfAccountancyMovements") . '</td>';
print '<td class="right">' . $langs->trans("Statut") . '</td>'; print '<td class="right">' . $langs->trans("Statut") . '</td>';
print '</tr>'; print '</tr>';
@ -147,8 +147,8 @@ if ($result)
print '<td class="left">' . $obj->label . '</td>'; print '<td class="left">' . $obj->label . '</td>';
print '<td class="left">' . dol_print_date($db->jdate($obj->date_start), 'day') . '</td>'; print '<td class="left">' . dol_print_date($db->jdate($obj->date_start), 'day') . '</td>';
print '<td class="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>'; print '<td class="left">' . dol_print_date($db->jdate($obj->date_end), 'day') . '</td>';
print '<td align="center">' . $object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end) . '</td>'; print '<td class="center">' . $object->getAccountancyEntriesByFiscalYear($obj->date_start, $obj->date_end) . '</td>';
print '<td align="center">' . $object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end) . '</td>'; print '<td class="center">' . $object->getAccountancyMovementsByFiscalYear($obj->date_start, $obj->date_end) . '</td>';
print '<td class="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>'; print '<td class="right">' . $fiscalyearstatic->LibStatut($obj->statut, 5) . '</td>';
print '</tr>'; print '</tr>';
$i++; $i++;

View File

@ -132,7 +132,7 @@ if ($result) {
print '<td>' . $langs->trans("Accountparent") . '</td>'; print '<td>' . $langs->trans("Accountparent") . '</td>';
print '<td>' . $langs->trans("Pcgtype") . '</td>'; print '<td>' . $langs->trans("Pcgtype") . '</td>';
print '<td>' . $langs->trans("Pcgsubtype") . '</td>'; print '<td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td align="center">' . $langs->trans("Import") . '</td>'; print '<td class="center">' . $langs->trans("Import") . '</td>';
print '</tr>'; print '</tr>';
$form = new Form($db); $form = new Form($db);
@ -166,7 +166,7 @@ if ($result) {
// Colonne choix ligne a ventiler // Colonne choix ligne a ventiler
$checked = ('label' == 'O') ? ' checked' : ''; $checked = ('label' == 'O') ? ' checked' : '';
print '<td align="center">'; print '<td class="center">';
print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>'; print '<input type="checkbox" name="mesCasesCochees[]" ' . $checked . ' value="' . $objp->accounting . '"/>';
print '</td>'; print '</td>';
@ -174,7 +174,7 @@ if ($result) {
$i ++; $i ++;
} }
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Import") . '"></td></tr>'; print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" class="center"><input type="submit" class="butAction" value="' . $langs->trans("Import") . '"></td></tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';

View File

@ -430,16 +430,18 @@ if ($id)
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
$class="left"; $class="left";
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') {
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $valuetoshow=$langs->trans("Code");
{ }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label"); $valuetoshow=$langs->trans("Label");
} }
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); } if ($fieldlist[$field]=='nature') {
$valuetoshow=$langs->trans("Nature");
}
if ($valuetoshow != '') if ($valuetoshow != '') {
{ print '<td class="'.$class.'">';
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>'; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]); elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
else print $valuetoshow; else print $valuetoshow;
@ -549,17 +551,22 @@ if ($id)
*/ */
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') {
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); } $valuetoshow=$langs->trans("Code");
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); } }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') {
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') {
$valuetoshow=$langs->trans("Nature");
}
// Affiche nom du champ // Affiche nom du champ
if ($showfield) if ($showfield) {
{ print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "", $sortfield, $sortorder, $class.' ');
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
} }
} }
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, '', $sortfield, $sortorder, 'center ');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print getTitleFieldOfList(''); print getTitleFieldOfList('');
@ -621,7 +628,7 @@ if ($id)
$class='tddict'; $class='tddict';
// Show value for field // Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>'; if ($showfield) print '<!-- '.$fieldlist[$field].' --><td class="'.$class.'">'.$valuetoshow.'</td>';
} }
} }
@ -696,11 +703,11 @@ $db->close();
/** /**
* Show fields in insert/edit mode * Show fields in insert/edit mode
* *
* @param array $fieldlist Array of fields * @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields * @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table * @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void * @return void
*/ */
function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
{ {

View File

@ -65,6 +65,8 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
$btn_changeaccount = GETPOST('changeaccount', 'alpha'); $btn_changeaccount = GETPOST('changeaccount', 'alpha');
$btn_changetype = GETPOST('changetype', 'alpha'); $btn_changetype = GETPOST('changetype', 'alpha');
if (empty($accounting_product_mode)) $accounting_product_mode='ACCOUNTANCY_SELL';
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha');
@ -112,8 +114,6 @@ if ($action == 'update') {
'ACCOUNTANCY_BUY' 'ACCOUNTANCY_BUY'
); );
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
if (in_array($accounting_product_mode, $accounting_product_modes)) { if (in_array($accounting_product_mode, $accounting_product_modes)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
@ -307,7 +307,7 @@ if ($result)
print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n"; print '<td>'.$langs->trans('OptionModeProductBuyDesc')."</td></tr>\n";
print "</table>\n"; print "</table>\n";
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>'; print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
print "<br>\n"; print "<br>\n";
@ -338,7 +338,7 @@ if ($result)
print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1); print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1);
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td align="center" class="liste_titre">'; print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -348,14 +348,14 @@ if ($result)
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder); if ($accounting_product_mode == 'ACCOUNTANCY_SELL') print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, '', $sortfield, $sortorder, 'center ');
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder); if ($accounting_product_mode == 'ACCOUNTANCY_BUY') print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center ');
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') $fieldtosortaccount="p.accountancy_code_buy"; if ($accounting_product_mode == 'ACCOUNTANCY_BUY') $fieldtosortaccount="p.accountancy_code_buy";
else $fieldtosortaccount="p.accountancy_code_sell"; else $fieldtosortaccount="p.accountancy_code_sell";
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder); print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount"); print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco=$form->showCheckAddButtons('checkforselect', 1); $clickpitco=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"'); print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center ');
print '</tr>'; print '</tr>';
$product_static = new Product($db); $product_static = new Product($db);
@ -408,10 +408,10 @@ if ($result)
} }
if ($accounting_product_mode == 'ACCOUNTANCY_SELL') if ($accounting_product_mode == 'ACCOUNTANCY_SELL')
print '<td align="center">'.$product_static->getLibStatut(3, 0).'</td>'; print '<td class="center">'.$product_static->getLibStatut(3, 0).'</td>';
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') if ($accounting_product_mode == 'ACCOUNTANCY_BUY')
print '<td align="center">'.$product_static->getLibStatut(3, 1).'</td>'; print '<td class="center">'.$product_static->getLibStatut(3, 1).'</td>';
// Current accounting account // Current accounting account
print '<td class="left">'; print '<td class="left">';
@ -450,7 +450,7 @@ if ($result)
} }
// Checkbox select // Checkbox select
print '<td align="center">'; print '<td class="center">';
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>'; print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
print "</tr>"; print "</tr>";
$i ++; $i ++;
@ -485,7 +485,7 @@ if ($result)
</script>'; </script>';
print '<br><div align="center"><input type="submit" class="butAction" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '"></div>'; print '<br><div class="center"><input type="submit" class="butAction" id="changeaccount" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
print '</form>'; print '</form>';

View File

@ -248,7 +248,7 @@ if ($action != 'export_csv')
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder);
print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" class="center"', $sortfield, $sortorder);
print "</tr>\n"; print "</tr>\n";
$total_debit = 0; $total_debit = 0;
@ -296,7 +296,7 @@ if ($action != 'export_csv')
print '<td class="right">' . price($line->debit) . '</td>'; print '<td class="right">' . price($line->debit) . '</td>';
print '<td class="right">' . price($line->credit) . '</td>'; print '<td class="right">' . price($line->credit) . '</td>';
print '<td class="right">' . price($line->credit - $line->debit) . '</td>'; print '<td class="right">' . price($line->credit - $line->debit) . '</td>';
print '<td align="center">' . $link; print '<td class="center">' . $link;
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -73,19 +73,19 @@ $y = $year_current;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td width=150>' . $langs->trans("Label") . '</td>'; print '<td width=150>' . $langs->trans("Label") . '</td>';
print '<td align="center">' . $langs->trans("JanuaryMin") . '</td>'; print '<td class="center">' . $langs->trans("JanuaryMin") . '</td>';
print '<td align="center">' . $langs->trans("FebruaryMin") . '</td>'; print '<td class="center">' . $langs->trans("FebruaryMin") . '</td>';
print '<td align="center">' . $langs->trans("MarchMin") . '</td>'; print '<td class="center">' . $langs->trans("MarchMin") . '</td>';
print '<td align="center">' . $langs->trans("AprilMin") . '</td>'; print '<td class="center">' . $langs->trans("AprilMin") . '</td>';
print '<td align="center">' . $langs->trans("MayMin") . '</td>'; print '<td class="center">' . $langs->trans("MayMin") . '</td>';
print '<td align="center">' . $langs->trans("JuneMin") . '</td>'; print '<td class="center">' . $langs->trans("JuneMin") . '</td>';
print '<td align="center">' . $langs->trans("JulyMin") . '</td>'; print '<td class="center">' . $langs->trans("JulyMin") . '</td>';
print '<td align="center">' . $langs->trans("AugustMin") . '</td>'; print '<td class="center">' . $langs->trans("AugustMin") . '</td>';
print '<td align="center">' . $langs->trans("SeptemberMin") . '</td>'; print '<td class="center">' . $langs->trans("SeptemberMin") . '</td>';
print '<td align="center">' . $langs->trans("OctoberMin") . '</td>'; print '<td class="center">' . $langs->trans("OctoberMin") . '</td>';
print '<td align="center">' . $langs->trans("NovemberMin") . '</td>'; print '<td class="center">' . $langs->trans("NovemberMin") . '</td>';
print '<td align="center">' . $langs->trans("DecemberMin") . '</td>'; print '<td class="center">' . $langs->trans("DecemberMin") . '</td>';
print '<td align="center"><strong>Total</strong></td>'; print '<td class="center"><strong>Total</strong></td>';
print '</tr>'; print '</tr>';
$sql = "SELECT bk.numero_compte AS 'compte',"; $sql = "SELECT bk.numero_compte AS 'compte',";

View File

@ -171,8 +171,8 @@ elseif ($action == "add") {
$object->doc_ref = GETPOST('doc_ref', 'alpha'); $object->doc_ref = GETPOST('doc_ref', 'alpha');
$object->code_journal = $journal_code; $object->code_journal = $journal_code;
$object->journal_label = $journal_label; $object->journal_label = $journal_label;
$object->fk_doc = GETPOST('fk_doc', 'int'); $object->fk_doc = (int) GETPOST('fk_doc', 'int');
$object->fk_docdet = GETPOST('fk_docdet', 'int'); $object->fk_docdet = (int) GETPOST('fk_docdet', 'int');
if (floatval($debit) != 0.0) { if (floatval($debit) != 0.0) {
$object->montant = $debit; $object->montant = $debit;
@ -604,7 +604,7 @@ if ($action == 'create')
print_liste_field_titre("LabelOperation"); print_liste_field_titre("LabelOperation");
print_liste_field_titre("Debit", "", "", "", "", 'class="right"'); print_liste_field_titre("Debit", "", "", "", "", 'class="right"');
print_liste_field_titre("Credit", "", "", "", "", 'class="right"'); print_liste_field_titre("Credit", "", "", "", "", 'class="right"');
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"'); print_liste_field_titre("Action", "", "", "", "", 'width="60" class="center"');
print "</tr>\n"; print "</tr>\n";
@ -644,7 +644,7 @@ if ($action == 'create')
print '<td class="right">' . price($line->debit) . '</td>'; print '<td class="right">' . price($line->debit) . '</td>';
print '<td class="right">' . price($line->credit) . '</td>'; print '<td class="right">' . price($line->credit) . '</td>';
print '<td align="center">'; print '<td class="center">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
print img_edit(); print img_edit();
print '</a> &nbsp;'; print '</a> &nbsp;';

View File

@ -606,18 +606,18 @@ print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.piece_num']['checked'])) print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.doc_date']['checked'])) print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.doc_ref']['checked'])) print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.numero_compte']['checked'])) print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, 'class="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";

View File

@ -286,7 +286,7 @@ print $formaccounting->select_account($search_accountancy_code_end, 'search_acco
print '</div>'; print '</div>';
print '</td>'; print '</td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
print $langs->trans('From') . ': '; print $langs->trans('From') . ': ';
print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1); print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1);
print '<br>'; print '<br>';
@ -297,7 +297,7 @@ print '<td class="liste_titre"><input type="text" size="7" class="flat" name="se
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="' . dol_escape_htmltag($search_label_operation) . '"/></td>';
print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>'; print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>'; print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
print '<td class="liste_titre" align="center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>'; print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . dol_escape_htmltag($search_ledger_code) . '"></td>';
print '<td class="liste_titre right" colspan="2">'; print '<td class="liste_titre right" colspan="2">';
$searchpicto=$form->showFilterAndCheckAddButtons(0); $searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto; print $searchpicto;
@ -305,14 +305,14 @@ print '</td>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']); print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Piece", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label"); print_liste_field_titre("Label");
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60"', $sortfield, $sortorder, 'center ');
print "</tr>\n"; print "</tr>\n";
print '</tr>'; print '</tr>';
@ -364,7 +364,7 @@ while ($i < min($num, $limit))
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td class="right"><a href="./card.php?piece_num=' . $line->piece_num . '">'.$line->piece_num.'</a></td>'; print '<td class="right"><a href="./card.php?piece_num=' . $line->piece_num . '">'.$line->piece_num.'</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>'; print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
// TODO Add a link according to doc_type and fk_doc // TODO Add a link according to doc_type and fk_doc
print '<td class="nowrap">'; print '<td class="nowrap">';
@ -384,9 +384,9 @@ while ($i < min($num, $limit))
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
$result = $accountingjournal->fetch('', $line->code_journal); $result = $accountingjournal->fetch('', $line->code_journal);
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal); $journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
print '<td align="center">' . $journaltoshow . '</td>'; print '<td class="center">' . $journaltoshow . '</td>';
print '<td align="center">'; print '<td class="center">';
print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;'; print '<a href="'.DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>'; print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . '">' . img_delete() . '</a>';
print '</td>'; print '</td>';

View File

@ -238,12 +238,12 @@ if ($resql) {
print '<td class="right">' . price($obj->debit) . '</td>'; print '<td class="right">' . price($obj->debit) . '</td>';
print '<td class="right">' . price($obj->credit) . '</td>'; print '<td class="right">' . price($obj->credit) . '</td>';
print '<td class="right">' . price(round($solde, 2)) . '</td>'; print '<td class="right">' . price(round($solde, 2)) . '</td>';
print '<td align="center">' . $obj->code_journal . '</td>'; print '<td class="center">' . $obj->code_journal . '</td>';
if (empty($obj->lettering_code)) { if (empty($obj->lettering_code)) {
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>'; print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
} else } else
print '<td align="center">' . $obj->lettering_code . '</td>'; print '<td class="center">' . $obj->lettering_code . '</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -240,12 +240,12 @@ if ($resql) {
print '<td class="right">' . price($obj->debit) . '</td>'; print '<td class="right">' . price($obj->debit) . '</td>';
print '<td class="right">' . price($obj->credit) . '</td>'; print '<td class="right">' . price($obj->credit) . '</td>';
print '<td class="right">' . price(round($solde, 2)) . '</td>'; print '<td class="right">' . price(round($solde, 2)) . '</td>';
print '<td align="center">' . $obj->code_journal . '</td>'; print '<td class="center">' . $obj->code_journal . '</td>';
if (empty($obj->lettering_code)) { if (empty($obj->lettering_code)) {
print '<td class="nowrap" align="center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>'; print '<td class="nowrap center"><input type="checkbox" class="flat checkforselect" name="toselect[]" id="toselect[]" value="' . $obj->rowid . '" /></td>';
} else } else
print '<td align="center">' . $obj->lettering_code . '</td>'; print '<td class="center">' . $obj->lettering_code . '</td>';
print "</tr>\n"; print "</tr>\n";
} }

View File

@ -129,7 +129,7 @@ class AccountancyCategory // extends CommonObject
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -142,7 +142,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK * @return int <0 if KO, Id of created object if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -239,7 +239,7 @@ class AccountancyCategory // extends CommonObject
* @param string $label Label * @param string $label Label
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $code = '', $label = '') public function fetch($id, $code = '', $label = '')
{ {
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
@ -299,7 +299,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user = null, $notrigger = 0) public function update($user = null, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -379,7 +379,7 @@ class AccountancyCategory // extends CommonObject
* @param int $notrigger 0=launch triggers after, 1=disable triggers * @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
$error=0; $error=0;
@ -460,7 +460,7 @@ class AccountancyCategory // extends CommonObject
return - 1; return - 1;
} }
} }
/** /**
* Function to select accounting category of an accounting account present in chart of accounts * Function to select accounting category of an accounting account present in chart of accounts
@ -509,12 +509,12 @@ class AccountancyCategory // extends CommonObject
return - 1; return - 1;
} }
} }
/** /**
* Function to select accounting category of an accounting account present in chart of accounts * Function to select accounting category of an accounting account present in chart of accounts
* *
* @param int $id Id category * @param int $id Id of category to know which account to exclude
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
@ -552,7 +552,7 @@ class AccountancyCategory // extends CommonObject
return - 1; return - 1;
} }
} }
/** /**
* Function to add an accounting account in an accounting category * Function to add an accounting account in an accounting category
@ -569,12 +569,13 @@ class AccountancyCategory // extends CommonObject
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$sql = "SELECT aa.rowid,aa.account_number "; $sql = "SELECT aa.rowid, aa.account_number";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = " . $conf->entity; $sql .= " AND aa.entity = " . $conf->entity;
$sql .= " ORDER BY LENGTH(aa.account_number) DESC;"; // LENGTH is ok with mysql and postgresql
$this->db->begin(); $this->db->begin();
@ -587,10 +588,16 @@ class AccountancyCategory // extends CommonObject
return -1; return -1;
} }
while ( $obj = $this->db->fetch_object($resql)) $accountincptsadded=array();
while ($obj = $this->db->fetch_object($resql))
{ {
if (array_key_exists(length_accountg($obj->account_number), $cpts)) $account_number_formated=length_accountg($obj->account_number);
if (! empty($accountincptsadded[$account_number_formated])) continue;
if (array_key_exists($account_number_formated, $cpts))
{ {
$accountincptsadded[$account_number_formated]=1;
// We found an account number that is in list $cpts of account to add
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account"; $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account";
$sql .= " SET fk_accounting_category=" . $id_cat; $sql .= " SET fk_accounting_category=" . $id_cat;
$sql .= " WHERE rowid=".$obj->rowid; $sql .= " WHERE rowid=".$obj->rowid;
@ -617,7 +624,7 @@ class AccountancyCategory // extends CommonObject
return 1; return 1;
} }
} }
/** /**
* Function to delete an accounting account from an accounting category * Function to delete an accounting account from an accounting category
@ -643,7 +650,7 @@ class AccountancyCategory // extends CommonObject
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
foreach ($this->errors as $errmsg) { foreach ($this->errors as $errmsg) {
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR); dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg); $this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
@ -651,12 +658,12 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback(); $this->db->rollback();
return - 1 * $error; return - 1 * $error;
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }
/** /**
* Function to know all category from accounting account * Function to know all category from accounting account

View File

@ -8,7 +8,7 @@
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com> * Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
class AccountancyExport class AccountancyExport
{ {
/** /**
* @var Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV * Type of export. Defined by $conf->global->ACCOUNTING_EXPORT_MODELCSV
*/ */
public static $EXPORT_TYPE_NORMAL = 1; // CSV public static $EXPORT_TYPE_NORMAL = 1; // CSV
public static $EXPORT_TYPE_CONFIGURABLE = 10; // CSV public static $EXPORT_TYPE_CONFIGURABLE = 10; // CSV
@ -98,18 +98,18 @@ class AccountancyExport
global $langs; global $langs;
return array ( return array (
//self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'), //self::$EXPORT_TYPE_NORMAL => $langs->trans('Modelcsv_normal'),
self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'), self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'), self::$EXPORT_TYPE_CEGID => $langs->trans('Modelcsv_CEGID'),
self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'), self::$EXPORT_TYPE_COALA => $langs->trans('Modelcsv_COALA'),
self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'), self::$EXPORT_TYPE_BOB50 => $langs->trans('Modelcsv_bob50'),
self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'), self::$EXPORT_TYPE_CIEL => $langs->trans('Modelcsv_ciel'),
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'), self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
); );
} }
/** /**
@ -535,14 +535,18 @@ class AccountancyExport
print $line->id . $separator; print $line->id . $separator;
print $date . $separator; print $date . $separator;
print $line->code_journal . $separator; print $line->code_journal . $separator;
print length_accountg($line->numero_compte) . $separator; if (empty($line->subledger_account)) {
print substr(length_accountg($line->numero_compte), 0, 2) . $separator; print $line->numero_compte . $separator;
} else {
print $line->subledger_account . $separator;
}
//print substr(length_accountg($line->numero_compte), 0, 2) . $separator;
print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"' . $separator; print '"'.dol_trunc($line->label_operation, 40, 'right', 'UTF-8', 1).'"' . $separator;
print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator; print '"'.dol_trunc($line->piece_num, 15, 'right', 'UTF-8', 1).'"'.$separator;
print price2num($line->montant).$separator; print price2num($line->montant).$separator;
print $line->sens.$separator; print $line->sens.$separator;
print $date . $separator; print $date . $separator;
print 'EUR'; //print 'EUR';
print $end_line; print $end_line;
} }
} }

View File

@ -64,10 +64,10 @@ class AccountancySystem
* *
* @param DoliDB $db handler * @param DoliDB $db handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
@ -77,7 +77,7 @@ class AccountancySystem
* @param string $ref ref * @param string $ref ref
* @return int <0 if KO, Id of record if OK and found * @return int <0 if KO, Id of record if OK and found
*/ */
function fetch($rowid = 0, $ref = '') public function fetch($rowid = 0, $ref = '')
{ {
global $conf; global $conf;
@ -124,7 +124,7 @@ class AccountancySystem
* @param User $user making insert * @param User $user making insert
* @return int if KO, Id of line if OK * @return int if KO, Id of line if OK
*/ */
function create($user) public function create($user)
{ {
$now = dol_now(); $now = dol_now();
@ -151,6 +151,6 @@ class AccountancySystem
dol_syslog($this->error, LOG_ERR); dol_syslog($this->error, LOG_ERR);
} }
return $result; return $result;
} }
} }

View File

@ -138,13 +138,13 @@ class AccountingAccount extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf; global $conf;
$this->db = $db; $this->db = $db;
$this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method $this->next_prev_filter='fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; // Used to add a filter in Form::showrefnav method
} }
/** /**
* Load record in memory * Load record in memory
@ -154,7 +154,7 @@ class AccountingAccount extends CommonObject
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, 0 if not found, Id of record if OK and found * @return int <0 if KO, 0 if not found, Id of record if OK and found
*/ */
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) public function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
{ {
global $conf; global $conf;
@ -216,7 +216,7 @@ class AccountingAccount extends CommonObject
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $conf;
$error = 0; $error = 0;
@ -317,7 +317,7 @@ class AccountingAccount extends CommonObject
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
} }
/** /**
* Update record * Update record
@ -325,7 +325,7 @@ class AccountingAccount extends CommonObject
* @param User $user Use making update * @param User $user Use making update
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user) public function update($user)
{ {
// Check parameters // Check parameters
if (empty($this->pcg_type) || $this->pcg_type == '-1') if (empty($this->pcg_type) || $this->pcg_type == '-1')
@ -368,7 +368,7 @@ class AccountingAccount extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function checkUsage() public function checkUsage()
{ {
global $langs; global $langs;
@ -402,7 +402,7 @@ class AccountingAccount extends CommonObject
* @param int $notrigger 0=triggers after, 1=disable triggers * @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
$error = 0; $error = 0;
@ -453,9 +453,9 @@ class AccountingAccount extends CommonObject
} else { } else {
return - 1; return - 1;
} }
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
@ -466,8 +466,8 @@ class AccountingAccount extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -522,7 +522,7 @@ class AccountingAccount extends CommonObject
if ($withpicto && $withpicto != 2) $result .= ' '; if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend; if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
return $result; return $result;
} }
/** /**
* Information on record * Information on record
@ -530,7 +530,7 @@ class AccountingAccount extends CommonObject
* @param int $id of record * @param int $id of record
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms'; $sql = 'SELECT a.rowid, a.datec, a.fk_user_author, a.fk_user_modif, a.tms';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as a';
@ -562,14 +562,14 @@ class AccountingAccount extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Account deactivated * Account deactivated
* *
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_desactivate($id) public function account_desactivate($id)
{ {
// phpcs:enable // phpcs:enable
$result = $this->checkUsage(); $result = $this->checkUsage();
@ -597,14 +597,14 @@ class AccountingAccount extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Account activated * Account activated
* *
* @param int $id Id * @param int $id Id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function account_activate($id) public function account_activate($id)
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
@ -615,15 +615,15 @@ class AccountingAccount extends CommonObject
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
$this->error = $this->db->lasterror(); $this->error = $this->db->lasterror();
$this->db->rollback(); $this->db->rollback();
return - 1; return - 1;
} }
} }
/** /**
@ -632,12 +632,12 @@ class AccountingAccount extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status * @return string Label of status
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->status, $mode); return $this->LibStatut($this->status, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@ -645,7 +645,7 @@ class AccountingAccount extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status * @return string Label of status
*/ */
function LibStatut($statut, $mode = 0) public function LibStatut($statut, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -655,32 +655,32 @@ class AccountingAccount extends CommonObject
{ {
$prefix=''; $prefix='';
if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled'); elseif ($statut == 0) return $langs->trans('Disabled');
} }
elseif ($mode == 1) elseif ($mode == 1)
{ {
if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 1) return $langs->trans('Enabled');
if ($statut == 0) return $langs->trans('Disabled'); elseif ($statut == 0) return $langs->trans('Disabled');
} }
elseif ($mode == 2) elseif ($mode == 2)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
} }
elseif ($mode == 3) elseif ($mode == 3)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4'); if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5');
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); if ($statut == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled');
if ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); elseif ($statut == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled');
} }
elseif ($mode == 5) elseif ($mode == 5)
{ {
if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4');
if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5');
} }
} }
} }

View File

@ -74,10 +74,10 @@ class AccountingJournal extends CommonObject
* *
* @param DoliDB $db Database handle * @param DoliDB $db Database handle
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
* Load an object from database * Load an object from database
@ -86,7 +86,7 @@ class AccountingJournal extends CommonObject
* @param string $journal_code Journal code * @param string $journal_code Journal code
* @return int <0 if KO, Id of record if OK and found * @return int <0 if KO, Id of record if OK and found
*/ */
function fetch($rowid = null, $journal_code = null) public function fetch($rowid = null, $journal_code = null)
{ {
global $conf; global $conf;
@ -146,7 +146,7 @@ class AccountingJournal extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
$sql = "SELECT rowid, code, label, nature, active"; $sql = "SELECT rowid, code, label, nature, active";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
@ -213,7 +213,7 @@ class AccountingJournal extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0) public function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
@ -270,12 +270,12 @@ class AccountingJournal extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court * @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type * @return string Label of type
*/ */
function getLibType($mode = 0) public function getLibType($mode = 0)
{ {
return $this->LibType($this->nature, $mode); return $this->LibType($this->nature, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return type of an accounting journal * Return type of an accounting journal
* *
@ -283,7 +283,7 @@ class AccountingJournal extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court * @param int $mode 0=libelle long, 1=libelle court
* @return string Label of type * @return string Label of type
*/ */
function LibType($nature, $mode = 0) public function LibType($nature, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -294,20 +294,20 @@ class AccountingJournal extends CommonObject
{ {
$prefix=''; $prefix='';
if ($nature == 9) return $langs->trans('AccountingJournalType9'); if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 5) return $langs->trans('AccountingJournalType5'); elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
if ($nature == 4) return $langs->trans('AccountingJournalType4'); elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3'); elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2'); elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1'); elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
} }
if ($mode == 1) elseif ($mode == 1)
{ {
if ($nature == 9) return $langs->trans('AccountingJournalType9'); if ($nature == 9) return $langs->trans('AccountingJournalType9');
if ($nature == 5) return $langs->trans('AccountingJournalType5'); elseif ($nature == 5) return $langs->trans('AccountingJournalType5');
if ($nature == 4) return $langs->trans('AccountingJournalType4'); elseif ($nature == 4) return $langs->trans('AccountingJournalType4');
if ($nature == 3) return $langs->trans('AccountingJournalType3'); elseif ($nature == 3) return $langs->trans('AccountingJournalType3');
if ($nature == 2) return $langs->trans('AccountingJournalType2'); elseif ($nature == 2) return $langs->trans('AccountingJournalType2');
if ($nature == 1) return $langs->trans('AccountingJournalType1'); elseif ($nature == 1) return $langs->trans('AccountingJournalType1');
} }
} }
} }

View File

@ -167,10 +167,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref); $this->doc_ref = trim($this->doc_ref);
} }
if (isset($this->fk_doc)) { if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc); $this->fk_doc = (int) $this->fk_doc;
} }
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = (int) $this->fk_docdet;
} }
if (isset($this->thirdparty_code)) { if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code); $this->thirdparty_code = trim($this->thirdparty_code);
@ -411,7 +411,7 @@ class BookKeeping extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -487,10 +487,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref); $this->doc_ref = trim($this->doc_ref);
} }
if (isset($this->fk_doc)) { if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc); $this->fk_doc = (int) $this->fk_doc;
} }
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = (int) $this->fk_docdet;
} }
if (isset($this->thirdparty_code)) { if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code); $this->thirdparty_code = trim($this->thirdparty_code);
@ -1104,10 +1104,10 @@ class BookKeeping extends CommonObject
$this->doc_ref = trim($this->doc_ref); $this->doc_ref = trim($this->doc_ref);
} }
if (isset($this->fk_doc)) { if (isset($this->fk_doc)) {
$this->fk_doc = trim($this->fk_doc); $this->fk_doc = (int) $this->fk_doc;
} }
if (isset($this->fk_docdet)) { if (isset($this->fk_docdet)) {
$this->fk_docdet = trim($this->fk_docdet); $this->fk_docdet = (int) $this->fk_docdet;
} }
if (isset($this->thirdparty_code)) { if (isset($this->thirdparty_code)) {
$this->thirdparty_code = trim($this->thirdparty_code); $this->thirdparty_code = trim($this->thirdparty_code);
@ -1308,7 +1308,7 @@ class BookKeeping extends CommonObject
* @param string $importkey Import key * @param string $importkey Import key
* @return int Result * @return int Result
*/ */
function deleteByImportkey($importkey) public function deleteByImportkey($importkey)
{ {
$this->db->begin(); $this->db->begin();
@ -1338,7 +1338,7 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '') public function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '')
{ {
global $conf; global $conf;
@ -1378,7 +1378,7 @@ class BookKeeping extends CommonObject
* @param int $piecenum Piecenum to delete * @param int $piecenum Piecenum to delete
* @return int Result * @return int Result
*/ */
function deleteMvtNum($piecenum) public function deleteMvtNum($piecenum)
{ {
global $conf; global $conf;
@ -1473,8 +1473,8 @@ class BookKeeping extends CommonObject
$this->doc_date = $now; $this->doc_date = $now;
$this->doc_type = ''; $this->doc_type = '';
$this->doc_ref = ''; $this->doc_ref = '';
$this->fk_doc = ''; $this->fk_doc = 0;
$this->fk_docdet = ''; $this->fk_docdet = 0;
$this->thirdparty_code = 'CU001'; $this->thirdparty_code = 'CU001';
$this->subledger_account = '41100001'; $this->subledger_account = '41100001';
$this->subledger_label = 'My customer company'; $this->subledger_label = 'My customer company';
@ -1565,7 +1565,7 @@ class BookKeeping extends CommonObject
* @param string $mode Mode * @param string $mode Mode
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetchAllPerMvt($piecenum, $mode = '') public function fetchAllPerMvt($piecenum, $mode = '')
{ {
global $conf; global $conf;
@ -1618,14 +1618,14 @@ class BookKeeping extends CommonObject
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Export bookkeping * Export bookkeping
* *
* @param string $model Model * @param string $model Model
* @return int Result * @return int Result
*/ */
function export_bookkeping($model = 'ebp') public function export_bookkeping($model = 'ebp')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1771,7 +1771,7 @@ class BookKeeping extends CommonObject
*/ */
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of accounts with label by chart of accounts * Return list of accounts with label by chart of accounts
* *
@ -1784,7 +1784,7 @@ class BookKeeping extends CommonObject
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1843,14 +1843,14 @@ class BookKeeping extends CommonObject
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Description of a root accounting account * Description of a root accounting account
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string Root account * @return string Root account
*/ */
function get_compte_racine($account = null) public function get_compte_racine($account = null)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1884,15 +1884,15 @@ class BookKeeping extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Description of accounting account * Description of accounting account
* *
* @param string $account Accounting account * @param string $account Accounting account
* @return string Account desc * @return string Account desc
*/ */
function get_compte_desc($account = null) public function get_compte_desc($account = null)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;

View File

@ -309,7 +309,9 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
print '<td class="liste_titre center nowraponall">'; print '<td class="liste_titre center nowraponall">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
}
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">'; print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); $formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>'; print '</td>';
@ -323,8 +325,8 @@ if ($result) {
//print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">'; //print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>'; print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print "</td></tr>\n"; print "</td></tr>\n";
@ -332,17 +334,17 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center ');
$clickpicto=$form->showCheckAddButtons(); $clickpicto=$form->showCheckAddButtons();
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($clickpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$facture_static = new Facture($db); $facture_static = new Facture($db);
@ -368,7 +370,7 @@ if ($result) {
// Ref Invoice // Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>'; print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref Product // Ref Product
print '<td>'; print '<td>';
@ -391,7 +393,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>'; print '<td>' . $objp->tva_intra . '</td>';
print '<td align="center">'; print '<td class="center">';
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')).'">'; print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')).'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';

View File

@ -376,7 +376,9 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth25" name="search_lineid" value="' . dol_escape_htmltag($search_lineid) . '""></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_invoice" value="' . dol_escape_htmltag($search_invoice) . '"></td>';
print '<td class="liste_titre center nowraponall">'; print '<td class="liste_titre center nowraponall">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">'; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) {
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
}
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">'; print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year, 'search_year', 1, 20, 5); $formother->select_year($search_year, 'search_year', 1, 20, 5);
print '</td>'; print '</td>';
@ -392,7 +394,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td align="center" class="liste_titre">'; print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -401,19 +403,19 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"'); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"'); print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto=''; $checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$facture_static = new Facture($db); $facture_static = new Facture($db);
@ -482,7 +484,7 @@ if ($result) {
// Ref Invoice // Ref Invoice
print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>'; print '<td class="nowraponall">' . $facture_static->getNomUrl(1) . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref Product // Ref Product
print '<td>'; print '<td>';
@ -513,7 +515,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>'; print '<td>' . $objp->tva_intra . '</td>';
// Current account // Current account
print '<td align="center" style="' . $code_sell_p_notset . '">'; print '<td class="center" style="' . $code_sell_p_notset . '">';
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown")); print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("Unknown"));
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
@ -523,12 +525,12 @@ if ($result) {
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account
print '<td align="center">'; print '<td class="center">';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
// Column with checkbox // Column with checkbox
print '<td align="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>'; print '</td>';

View File

@ -270,7 +270,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>'; print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_vat" size="1" placeholder="%" value="' . dol_escape_htmltag($search_vat) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre right"></td>'; print '<td class="liste_titre right"></td>';
print '<td class="liste_titre right">'; print '<td class="liste_titre right">';
@ -282,15 +282,15 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre(''); print_liste_field_titre('');
$checkpicto=$form->showCheckAddButtons(); $checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$expensereport_static = new ExpenseReport($db); $expensereport_static = new ExpenseReport($db);
@ -309,7 +309,7 @@ if ($result) {
// Ref Invoice // Ref Invoice
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>'; print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>'; print '<td class="tdoverflow">' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '</td>';
@ -321,7 +321,7 @@ if ($result) {
print '<td class="right">' . price($objp->total_ht) . '</td>'; print '<td class="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>'; print '<td class="center">' . vatrate($objp->tva_tx.($objp->vat_src_code?' ('.$objp->vat_src_code.')':'')) . '</td>';
print '<td>' . $codeCompta . '</td>'; print '<td>' . $codeCompta . '</td>';

View File

@ -319,7 +319,7 @@ if ($result) {
print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>'; print '<td class="liste_titre right"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td align="center" class="liste_titre">'; print '<td class="center" class="liste_titre">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -328,16 +328,16 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder); print_liste_field_titre("IntoAccount", '', '', '', '', '', $sortfield, $sortorder, 'center ');
$checkpicto=''; $checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
@ -362,7 +362,7 @@ if ($result) {
print '<td>' . $expensereport_static->getNomUrl(1) . '</td>'; print '<td>' . $expensereport_static->getNomUrl(1) . '</td>';
// Date // Date
print '<td align="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->date), 'day') . '</td>';
// Fees label // Fees label
print '<td>'; print '<td>';
@ -386,16 +386,16 @@ if ($result) {
print '</td>'; print '</td>';
// Current account // Current account
print '<td align="center">'; print '<td class="center">';
print length_accountg(html_entity_decode($objp->code_buy)); print length_accountg(html_entity_decode($objp->code_buy));
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account
print '<td align="center">'; print '<td class="center">';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
print '<td align="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>'; print '</td>';

View File

@ -64,13 +64,13 @@ if ($conf->accounting->enabled)
// STEPS // STEPS
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'.'</a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong>'.'</a>');
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>'.'</a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong>'.'</a>');
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'.'</a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong>'.'</a>');
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -79,20 +79,20 @@ if ($conf->accounting->enabled)
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'.'</a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'.'</a>');
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>'.'</a>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong>'.'</a>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'.'</a>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong>'.'</a>';
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
print "<br>\n"; print "<br>\n";
if (! empty($conf->tax->enabled)) if (! empty($conf->tax->enabled))
{ {
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup").'-'.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'.'</a>'; $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong>'.'</a>';
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
print "<br>\n"; print "<br>\n";
@ -100,7 +100,7 @@ if ($conf->accounting->enabled)
/*if (! empty($conf->salaries->enabled)) /*if (! empty($conf->salaries->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
// htdocs/admin/salaries.php // htdocs/admin/salaries.php
print "<br>\n"; print "<br>\n";
print "<br>\n"; print "<br>\n";
@ -108,36 +108,37 @@ if ($conf->accounting->enabled)
if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. if (! empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'.'</a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong>'.'</a>');
print "<br>\n"; print "<br>\n";
} }
/* /*
if (! empty($conf->loan->enabled)) if (! empty($conf->loan->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").'-'.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
} }
if (! empty($conf->don->enabled)) if (! empty($conf->don->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
} }
if (! empty($conf->adherents->enabled)) if (! empty($conf->adherents->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n"; print "<br>\n";
}*/ }*/
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'.'</a>'); print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php">'.'<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong>'.'</a>');
print "<br>\n"; print "<br>\n";
print '<br>'; print '<br>';
// Step A - E
print "<br>\n"; print "<br>\n";
print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', ''); print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
@ -148,22 +149,22 @@ if ($conf->accounting->enabled)
$langs->loadLangs(array('bills', 'trips')); $langs->loadLangs(array('bills', 'trips'));
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>'.'</a>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>'.'</a>')."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>'.'</a>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>'.'</a>')."\n";
print "<br>\n"; print "<br>\n";
if (! empty($conf->expensereport->enabled) || ! empty($conf->deplacement->enabled)) if (! empty($conf->expensereport->enabled) || ! empty($conf->deplacement->enabled))
{ {
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>'.'</a>')."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php">'.'<strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>'.'</a>')."\n";
print "<br>\n"; print "<br>\n";
} }
$step++; $step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n"; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
print "<br>\n"; print "<br>\n";
$step++; $step++;

View File

@ -994,8 +994,8 @@ if (empty($action) || $action == 'view') {
print "<td>" . $langs->trans("SubledgerAccount") . "</td>"; print "<td>" . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $langs->trans("LabelOperation") . "</td>"; print "<td>" . $langs->trans("LabelOperation") . "</td>";
print "<td>" . $langs->trans("PaymentMode") . "</td>"; print "<td>" . $langs->trans("PaymentMode") . "</td>";
print "<td align='right'>" . $langs->trans("Debit") . "</td>"; print "<td class='right'>" . $langs->trans("Debit") . "</td>";
print "<td align='right'>" . $langs->trans("Credit") . "</td>"; print "<td class='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n"; print "</tr>\n";
$r = ''; $r = '';
@ -1044,8 +1044,8 @@ if (empty($action) || $action == 'view') {
print $reflabel; print $reflabel;
print "</td>"; print "</td>";
print "<td>" . $val["type_payment"] . "</td>"; print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td class='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td class='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>"; print "</tr>";
} }
} }
@ -1126,8 +1126,8 @@ if (empty($action) || $action == 'view') {
print "</td>"; print "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>"; print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td class='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td class='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";
} }
} }
@ -1163,8 +1163,8 @@ if (empty($action) || $action == 'view') {
print "</td>"; print "</td>";
print "<td>" . $reflabel . "</td>"; print "<td>" . $reflabel . "</td>";
print "<td>" . $val["type_payment"] . "</td>"; print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "<td class='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>"; print "<td class='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>"; print "</tr>";
} }
} }

View File

@ -328,8 +328,8 @@ if ($result) {
// print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">'; // print '<input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '">';
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>'; print '<td class="liste_titre center"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre center">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -339,17 +339,17 @@ if ($result) {
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder, 'center ');
$checkpicto=$form->showCheckAddButtons(); $checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$facturefournisseur_static = new FactureFournisseur($db); $facturefournisseur_static = new FactureFournisseur($db);
@ -380,7 +380,7 @@ if ($result) {
print $objp->invoice_label; print $objp->invoice_label;
print '</td>'; print '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product // Ref product
print '<td>'; print '<td>';
@ -404,7 +404,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>'; print '<td>' . $objp->tva_intra . '</td>';
print '<td align="center">'; print '<td class="center">';
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">'; print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '&backtopage='.urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:'')) . '">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';

View File

@ -392,7 +392,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tvaintra" value="' . dol_escape_htmltag($search_tvaintra) . '"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td align="center" class="liste_titre">'; print '<td class="center liste_titre">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
@ -402,19 +402,19 @@ if ($result) {
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"'); print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', '', '', '', 'center ');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"'); print_liste_field_titre("IntoAccount", '', '', '', '', '', '', '', 'center ');
$checkpicto=''; $checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($checkpicto, '', '', '', '', '', '', '', 'center ');
print "</tr>\n"; print "</tr>\n";
$facturefourn_static = new FactureFournisseur($db); $facturefourn_static = new FactureFournisseur($db);
@ -475,7 +475,7 @@ if ($result) {
print $objp->invoice_label; print $objp->invoice_label;
print '</td>'; print '</td>';
print '<td align="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>'; print '<td class="center">' . dol_print_date($db->jdate($objp->datef), 'day') . '</td>';
// Ref product // Ref product
print '<td>'; print '<td>';
@ -506,7 +506,7 @@ if ($result) {
print '<td>' . $objp->tva_intra . '</td>'; print '<td>' . $objp->tva_intra . '</td>';
// Current account // Current account
print '<td align="center" style="' . $code_buy_p_notset . '">'; print '<td class="center" style="' . $code_buy_p_notset . '">';
print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown")); print (($objp->type_l == 1)?$langs->trans("DefaultForService"):$langs->trans("DefaultForProduct")) . ' = ' . ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("Unknown"));
if ($objp->product_id > 0) if ($objp->product_id > 0)
{ {
@ -516,12 +516,12 @@ if ($result) {
print '</td>'; print '</td>';
// Suggested accounting account // Suggested accounting account
print '<td align="center">'; print '<td class="center">';
print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone'); print $formaccounting->select_account($objp->aarowid_suggest, 'codeventil'.$objp->rowid, 1, array(), 0, 0, 'codeventil maxwidth300 maxwidthonsmartphone', 'cachewithshowemptyone');
print '</td>'; print '</td>';
// Column with checkbox // Column with checkbox
print '<td align="center">'; print '<td class="center">';
print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '<input type="checkbox" class="flat checkforselect checkforselect'.$objp->rowid.'" name="toselect[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>'; print '</td>';

View File

@ -183,6 +183,10 @@ if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! emp
if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice"); if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['bankviainvoice']=$langs->trans("MoreActionBankViaInvoice");
print '<td>'; print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0); 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')
{
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
}
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -32,15 +32,15 @@ abstract class ActionsAdherentCardCommon
*/ */
public $db; public $db;
var $dirmodule; public $dirmodule;
var $targetmodule; public $targetmodule;
var $canvas; public $canvas;
var $card; public $card;
//! Template container //! Template container
var $tpl = array(); public $tpl = array();
//! Object container //! Object container
var $object; public $object;
/** /**
* @var string Error code (or message) * @var string Error code (or message)
@ -59,7 +59,7 @@ abstract class ActionsAdherentCardCommon
* @param int $id Object id * @param int $id Object id
* @return object Object loaded * @return object Object loaded
*/ */
function getObject($id) public function getObject($id)
{ {
//$ret = $this->getInstanceDao(); //$ret = $this->getInstanceDao();
@ -75,7 +75,7 @@ abstract class ActionsAdherentCardCommon
//} //}
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Set content of ->tpl array, to use into template * Set content of ->tpl array, to use into template
* *
@ -83,7 +83,7 @@ abstract class ActionsAdherentCardCommon
* @param int $id Id * @param int $id Id
* @return string HTML output * @return string HTML output
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs, $user, $canvas; global $conf, $langs, $user, $canvas;
@ -245,23 +245,23 @@ abstract class ActionsAdherentCardCommon
// phpcs:enable // phpcs:enable
global $langs, $mysoc; global $langs, $mysoc;
$this->object->old_name = $_POST["old_name"]; $this->object->old_name = $_POST["old_name"];
$this->object->old_firstname = $_POST["old_firstname"]; $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->lastname = $_POST["lastname"];
$this->object->firstname = $_POST["firstname"]; $this->object->firstname = $_POST["firstname"];
$this->object->civility_id = $_POST["civility_id"]; $this->object->civility_id = $_POST["civility_id"];
$this->object->address = $_POST["address"]; $this->object->address = $_POST["address"];
$this->object->zip = $_POST["zipcode"]; $this->object->zip = $_POST["zipcode"];
$this->object->town = $_POST["town"]; $this->object->town = $_POST["town"];
$this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id; $this->object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
$this->object->state_id = $_POST["state_id"]; $this->object->state_id = $_POST["state_id"];
$this->object->phone_perso = $_POST["phone_perso"]; $this->object->phone_perso = $_POST["phone_perso"];
$this->object->phone_mobile = $_POST["phone_mobile"]; $this->object->phone_mobile = $_POST["phone_mobile"];
$this->object->email = $_POST["email"]; $this->object->email = $_POST["email"];
$this->object->note = $_POST["note"]; $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 // We set country_id, and country_code label of the chosen country
if ($this->object->country_id) if ($this->object->country_id)
@ -272,8 +272,8 @@ abstract class ActionsAdherentCardCommon
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->object->country_code = $obj->code; $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 else
{ {

View File

@ -39,7 +39,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param string $canvas Name of canvas * @param string $canvas Name of canvas
* @param string $card Name of tab (sub-canvas) * @param string $card Name of tab (sub-canvas)
*/ */
function __construct($db, $dirmodule, $targetmodule, $canvas, $card) public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
{ {
$this->db = $db; $this->db = $db;
$this->dirmodule = $dirmodule; $this->dirmodule = $dirmodule;
@ -67,7 +67,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
return $out; return $out;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Assign custom values for canvas * Assign custom values for canvas
* *
@ -75,7 +75,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param int $id Id * @param int $id Id
* @return void * @return void
*/ */
function assign_values(&$action, $id) public function assign_values(&$action, $id)
{ {
// phpcs:enable // phpcs:enable
global $limit, $offset, $sortfield, $sortorder; global $limit, $offset, $sortfield, $sortorder;
@ -122,7 +122,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Fetch datas list and save into ->list_datas * Fetch datas list and save into ->list_datas
* *
@ -132,7 +132,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon
* @param string $sortorder Sort order ('ASC' or 'DESC') * @param string $sortorder Sort order ('ASC' or 'DESC')
* @return void * @return void
*/ */
function LoadListDatas($limit, $offset, $sortfield, $sortorder) public function LoadListDatas($limit, $offset, $sortfield, $sortorder)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -249,13 +249,14 @@ $form=new Form($db);
llxHeader('', $langs->trans("MembersCards")); llxHeader('', $langs->trans("MembersCards"));
print load_fiche_titre($langs->trans("LinkToGeneratedPages")); print load_fiche_titre($langs->trans("LinkToGeneratedPages"));
print '<br>';
print $langs->trans("LinkToGeneratedPagesDesc").'<br>'; print '<span class="opacitymedium">'.$langs->trans("LinkToGeneratedPagesDesc").'</span><br>';
print '<br>'; print '<br>';
dol_htmloutput_errors($mesg); dol_htmloutput_errors($mesg);
print '<br>';
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 '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="foruserid" value="all">'; print '<input type="hidden" name="foruserid" value="all">';
@ -272,7 +273,8 @@ asort($arrayoflabels);
print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">'; print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br>';
print '<br><br>';
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 '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -290,7 +292,8 @@ print $form->selectarray('model', $arrayoflabels, (GETPOST('model')?GETPOST('mod
print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">'; print '<br>'.$langs->trans("Login").': <input size="10" type="text" name="foruserlogin" value="'.GETPOST('foruserlogin').'">';
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">'; print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br>';
print '<br><br>';
print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print img_picto('', 'puce').' '.$langs->trans("DocForLabels", $conf->global->ADHERENT_ETIQUETTE_TYPE).' ';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
@ -307,7 +310,6 @@ asort($arrayoflabels);
print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1);
print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">'; print '<br><input class="button" type="submit" value="'.$langs->trans("BuildDoc").'">';
print '</form>'; print '</form>';
print '<br>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -223,7 +223,7 @@ class Adherent extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = -1; $this->statut = -1;
@ -234,7 +234,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function sending an email to the current member with the text supplied in parameter. * Function sending an email to the current member with the text supplied in parameter.
* *
@ -251,7 +251,7 @@ class Adherent extends CommonObject
* @param string $moreinheader Add more html headers * @param string $moreinheader Add more html headers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') public function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -296,7 +296,7 @@ class Adherent extends CommonObject
* @param string $text Text to make substitution to * @param string $text Text to make substitution to
* @return string Value of input text string with substitutions done * @return string Value of input text string with substitutions done
*/ */
function makeSubstitution($text) public function makeSubstitution($text)
{ {
global $conf,$langs; global $conf,$langs;
@ -363,7 +363,7 @@ class Adherent extends CommonObject
* @param string $morphy Nature of the adherent (physical or moral) * @param string $morphy Nature of the adherent (physical or moral)
* @return string Label * @return string Label
*/ */
function getmorphylib($morphy = '') public function getmorphylib($morphy = '')
{ {
global $langs; global $langs;
if (! $morphy) { $morphy=$this->morphy; } if (! $morphy) { $morphy=$this->morphy; }
@ -379,7 +379,7 @@ class Adherent extends CommonObject
* @param int $notrigger 1 ne declenche pas les triggers, 0 sinon * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
@ -505,7 +505,7 @@ class Adherent extends CommonObject
* @param string $action Current action for hookmanager * @param string $action Current action for hookmanager
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update') public function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update')
{ {
global $conf, $langs, $hookmanager; global $conf, $langs, $hookmanager;
@ -572,6 +572,22 @@ class Adherent extends CommonObject
$sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest $sql.= ", fk_user_mod = ".($user->id>0?$user->id:'null'); // Can be null because member can be create by a guest
$sql.= " WHERE rowid = ".$this->id; $sql.= " WHERE rowid = ".$this->id;
// If we change the type of membership, we set also label of new type
if (! empty($this->oldcopy) && $this->typeid != $this->oldcopy->typeid)
{
$sql2 = "SELECT libelle as label";
$sql2.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql2.= " WHERE rowid = ".$this->typeid;
$resql2 = $this->db->query($sql2);
if ($resql2)
{
while ($obj=$this->db->fetch_object($resql2))
{
$this->type=$obj->label;
}
}
}
dol_syslog(get_class($this)."::update update member", LOG_DEBUG); dol_syslog(get_class($this)."::update update member", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
@ -760,7 +776,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update denormalized last subscription date. * Update denormalized last subscription date.
* This function is called when we delete a subscription for example. * This function is called when we delete a subscription for example.
@ -768,7 +784,7 @@ class Adherent extends CommonObject
* @param User $user User making change * @param User $user User making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_end_date($user) public function update_end_date($user)
{ {
// phpcs:enable // phpcs:enable
$this->db->begin(); $this->db->begin();
@ -825,7 +841,7 @@ class Adherent extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, 0=nothing to do, >0 if OK * @return int <0 if KO, 0=nothing to do, >0 if OK
*/ */
function delete($rowid, $user, $notrigger = 0) public function delete($rowid, $user, $notrigger = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -935,7 +951,7 @@ class Adherent extends CommonObject
* @param int $nosyncuser Do not synchronize linked user * @param int $nosyncuser Do not synchronize linked user
* @return string If OK return clear password, 0 if no change, < 0 if error * @return string If OK return clear password, 0 if no change, < 0 if error
*/ */
function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0) public function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0)
{ {
global $conf, $langs; global $conf, $langs;
@ -1046,7 +1062,7 @@ class Adherent extends CommonObject
* @param int $userid Id of user to link to * @param int $userid Id of user to link to
* @return int 1=OK, -1=KO * @return int 1=OK, -1=KO
*/ */
function setUserId($userid) public function setUserId($userid)
{ {
global $conf, $langs; global $conf, $langs;
@ -1080,7 +1096,7 @@ class Adherent extends CommonObject
* @param int $thirdpartyid Id of user to link to * @param int $thirdpartyid Id of user to link to
* @return int 1=OK, -1=KO * @return int 1=OK, -1=KO
*/ */
function setThirdPartyId($thirdpartyid) public function setThirdPartyId($thirdpartyid)
{ {
global $conf, $langs; global $conf, $langs;
@ -1116,14 +1132,14 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Method to load member from its login * Method to load member from its login
* *
* @param string $login login of member * @param string $login login of member
* @return void * @return void
*/ */
function fetch_login($login) public function fetch_login($login)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1147,7 +1163,7 @@ class Adherent extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Method to load member from its name * Method to load member from its name
* *
@ -1155,7 +1171,7 @@ class Adherent extends CommonObject
* @param string $lastname Lastname * @param string $lastname Lastname
* @return void * @return void
*/ */
function fetch_name($firstname, $lastname) public function fetch_name($firstname, $lastname)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1191,7 +1207,7 @@ class Adherent extends CommonObject
* @param bool $fetch_subscriptions To load member subscriptions * @param bool $fetch_subscriptions To load member subscriptions
* @return int >0 if OK, 0 if not found, <0 if KO * @return int >0 if OK, 0 if not found, <0 if KO
*/ */
function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true) public function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true)
{ {
global $langs; global $langs;
@ -1281,9 +1297,12 @@ class Adherent extends CommonObject
$this->public = $obj->public; $this->public = $obj->public;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->date_creation = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->datem); $this->datem = $this->db->jdate($obj->datem);
$this->date_modification= $this->db->jdate($obj->datem);
$this->datefin = $this->db->jdate($obj->datefin); $this->datefin = $this->db->jdate($obj->datefin);
$this->datevalid = $this->db->jdate($obj->datev); $this->datevalid = $this->db->jdate($obj->datev);
$this->date_validation = $this->db->jdate($obj->datev);
$this->birth = $this->db->jdate($obj->birthday); $this->birth = $this->db->jdate($obj->birthday);
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
@ -1325,7 +1344,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to get member subscriptions data * Function to get member subscriptions data
* first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount * first_subscription_date, first_subscription_date_start, first_subscription_date_end, first_subscription_amount
@ -1333,7 +1352,7 @@ class Adherent extends CommonObject
* *
* @return int <0 si KO, >0 si OK * @return int <0 si KO, >0 si OK
*/ */
function fetch_subscriptions() public function fetch_subscriptions()
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -1409,7 +1428,7 @@ class Adherent extends CommonObject
* @param int $datesubend Date end subscription * @param int $datesubend Date end subscription
* @return int rowid of record added, <0 if KO * @return int rowid of record added, <0 if KO
*/ */
function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0) public function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0)
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
@ -1495,7 +1514,7 @@ class Adherent extends CommonObject
* @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice. * @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0) public function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0)
{ {
global $conf, $langs, $user, $mysoc; global $conf, $langs, $user, $mysoc;
@ -1788,7 +1807,7 @@ class Adherent extends CommonObject
* @param User $user user adherent qui valide * @param User $user user adherent qui valide
* @return int <0 if KO, 0 if nothing done, >0 if OK * @return int <0 if KO, 0 if nothing done, >0 if OK
*/ */
function validate($user) public function validate($user)
{ {
global $langs,$conf; global $langs,$conf;
@ -1841,7 +1860,7 @@ class Adherent extends CommonObject
* @param User $user User making change * @param User $user User making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function resiliate($user) public function resiliate($user)
{ {
global $langs,$conf; global $langs,$conf;
@ -1883,13 +1902,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to add member into external tools mailing-list, spip, etc. * Function to add member into external tools mailing-list, spip, etc.
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function add_to_abo() public function add_to_abo()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -1942,13 +1961,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to delete a member from external tools like mailing-list, spip, etc. * Function to delete a member from external tools like mailing-list, spip, etc.
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function del_to_abo() public function del_to_abo()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -2006,7 +2025,7 @@ class Adherent extends CommonObject
* *
* @return string Translated name of civility (translated with transnoentitiesnoconv) * @return string Translated name of civility (translated with transnoentitiesnoconv)
*/ */
function getCivilityLabel() public function getCivilityLabel()
{ {
global $langs; global $langs;
$langs->load("dict"); $langs->load("dict");
@ -2027,7 +2046,7 @@ class Adherent extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1)
{ {
global $conf, $langs; global $conf, $langs;
@ -2118,12 +2137,12 @@ class Adherent extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->statut, $this->need_subscription, $this->datefin, $mode); return $this->LibStatut($this->statut, $this->need_subscription, $this->datefin, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
@ -2133,7 +2152,7 @@ class Adherent extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label * @return string Label
*/ */
function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0) public function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -2211,13 +2230,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Charge indicateurs this->nb de tableau de bord * Charge indicateurs this->nb de tableau de bord
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function load_state_board() public function load_state_board()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -2247,14 +2266,14 @@ class Adherent extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate) * Load indicators for dashboard (this->nbtodo and this->nbtodolate)
* *
* @param User $user Objet user * @param User $user Objet user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/ */
function load_board($user) public function load_board($user)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -2346,7 +2365,7 @@ class Adherent extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $user,$langs; global $user,$langs;
@ -2400,7 +2419,7 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@ -2410,7 +2429,7 @@ class Adherent extends CommonObject
* 2=Return key only (uid=qqq) * 2=Return key only (uid=qqq)
* @return string DN * @return string DN
*/ */
function _load_ldap_dn($info, $mode = 0) private function _load_ldap_dn($info, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -2422,13 +2441,13 @@ class Adherent extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialise tableau info (tableau des attributs LDAP) * Initialise tableau info (tableau des attributs LDAP)
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs
*/ */
function _load_ldap_info() private function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -2536,7 +2555,7 @@ class Adherent extends CommonObject
* @param int $id Id of member to load * @param int $id Id of member to load
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT a.rowid, a.datec as datec,'; $sql = 'SELECT a.rowid, a.datec as datec,';
$sql.= ' a.datevalid as datev,'; $sql.= ' a.datevalid as datev,';
@ -2592,7 +2611,7 @@ class Adherent extends CommonObject
* *
* @return int Number of EMailings * @return int Number of EMailings
*/ */
function getNbOfEMailings() public function getNbOfEMailings()
{ {
$sql = "SELECT count(mc.email) as nb"; $sql = "SELECT count(mc.email) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
@ -2774,9 +2793,13 @@ class Adherent extends CommonObject
{ {
$adherent->fetch_thirdparty(); $adherent->fetch_thirdparty();
// Language code to use ($languagecodeformember) is default language of thirdparty, if no thirdparty, the language found from country of member then country of thirdparty, and if still not found we use the language of company.
$languagefromcountrycode = getLanguageCodeFromCountryCode($adherent->country_code ? $adherent->country_code : $adherent->thirdparty->country_code);
$languagecodeformember = (empty($adherent->thirdparty->default_lang) ? ($languagefromcountrycode ? $languagefromcountrycode : $mysoc->default_lang) : $adherent->thirdparty->default_lang);
// Send reminder email // Send reminder email
$outputlangs = new Translate('', $conf); $outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); $outputlangs->setDefaultLang($languagecodeformember);
$outputlangs->loadLangs(array("main", "members")); $outputlangs->loadLangs(array("main", "members"));
dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang); dol_syslog("sendReminderForExpiredSubscription Language for member id ".$adherent->id." set to ".$outputlangs->defaultlang." mysoc->default_lang=".$mysoc->default_lang);

View File

@ -89,7 +89,7 @@ class AdherentType extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = 1; $this->statut = 1;
@ -103,7 +103,7 @@ class AdherentType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $conf;
@ -170,7 +170,7 @@ class AdherentType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $hookmanager; global $conf, $hookmanager;
@ -238,7 +238,7 @@ class AdherentType extends CommonObject
* *
* @return int > 0 if OK, 0 if not found, < 0 if KO * @return int > 0 if OK, 0 if not found, < 0 if KO
*/ */
function delete() public function delete()
{ {
global $user; global $user;
@ -272,7 +272,7 @@ class AdherentType extends CommonObject
* @param int $rowid Id of member type to load * @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
@ -306,13 +306,13 @@ class AdherentType extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of members' type * Return list of members' type
* *
* @return array List of types of members * @return array List of types of members
*/ */
function liste_array() public function liste_array()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -356,7 +356,7 @@ class AdherentType extends CommonObject
* 2=Return array of members id only * 2=Return array of members id only
* @return mixed Array of members or -1 on error * @return mixed Array of members or -1 on error
*/ */
function listMembersForMemberType($excludefilter = '', $mode = 0) public function listMembersForMemberType($excludefilter = '', $mode = 0)
{ {
global $conf, $user; global $conf, $user;
@ -404,14 +404,14 @@ class AdherentType extends CommonObject
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $maxlen length max label * @param int $maxlen length max label
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{ {
global $langs; global $langs;
@ -434,12 +434,12 @@ class AdherentType extends CommonObject
* *
* @return string Return status of a type of member * @return string Return status of a type of member
*/ */
function getLibStatut() public function getLibStatut()
{ {
return ''; return '';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@ -449,7 +449,7 @@ class AdherentType extends CommonObject
* 2=Return key only (uid=qqq) * 2=Return key only (uid=qqq)
* @return string DN * @return string DN
*/ */
function _load_ldap_dn($info, $mode = 0) private function _load_ldap_dn($info, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -461,13 +461,13 @@ class AdherentType extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions * Initialize the info array (array of LDAP values) that will be used to call LDAP functions
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs
*/ */
function _load_ldap_info() private function _load_ldap_info()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -502,7 +502,7 @@ class AdherentType extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
@ -530,7 +530,7 @@ class AdherentType extends CommonObject
* *
* @return string Return mail content of type or empty * @return string Return mail content of type or empty
*/ */
function getMailOnValid() public function getMailOnValid()
{ {
global $conf; global $conf;
@ -547,7 +547,7 @@ class AdherentType extends CommonObject
* *
* @return string Return mail content of type or empty * @return string Return mail content of type or empty
*/ */
function getMailOnSubscription() public function getMailOnSubscription()
{ {
global $conf; global $conf;
@ -565,16 +565,16 @@ class AdherentType extends CommonObject
* *
* @return string Return mail model content of type or empty * @return string Return mail model content of type or empty
*/ */
function getMailOnResiliate() public function getMailOnResiliate()
{ {
global $conf; global $conf;
// NOTE mail_resiliate not defined so never used // NOTE mail_resiliate not defined so never used
if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined if (! empty($this->mail_resiliate) && trim(dol_htmlentitiesbr_decode($this->mail_resiliate))) // Property not yet defined
{ {
return $this->mail_resiliate; return $this->mail_resiliate;
} }
return ''; return '';
} }
} }

View File

@ -37,12 +37,12 @@ class AdherentStats extends Stats
*/ */
public $table_element; public $table_element;
var $socid; public $socid;
var $userid; public $userid;
var $from; public $from;
var $field; public $field;
var $where; public $where;
/** /**
@ -52,7 +52,7 @@ class AdherentStats extends Stats
* @param int $socid Id third party * @param int $socid Id third party
* @param int $userid Id user for filter * @param int $userid Id user for filter
*/ */
function __construct($db, $socid = 0, $userid = 0) public function __construct($db, $socid = 0, $userid = 0)
{ {
global $user, $conf; global $user, $conf;
@ -85,7 +85,7 @@ class AdherentStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of nb each month * @return array Array of nb each month
*/ */
function getNbByMonth($year, $format = 0) public function getNbByMonth($year, $format = 0)
{ {
global $user; global $user;
@ -105,7 +105,7 @@ class AdherentStats extends Stats
* *
* @return array Array of nb each year * @return array Array of nb each year
*/ */
function getNbByYear() public function getNbByYear()
{ {
global $user; global $user;
@ -126,7 +126,7 @@ class AdherentStats extends Stats
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
* @return array Array of amount each month * @return array Array of amount each month
*/ */
function getAmountByMonth($year, $format = 0) public function getAmountByMonth($year, $format = 0)
{ {
global $user; global $user;
@ -147,7 +147,7 @@ class AdherentStats extends Stats
* @param int $year Year * @param int $year Year
* @return array Array of average each month * @return array Array of average each month
*/ */
function getAverageByMonth($year) public function getAverageByMonth($year)
{ {
global $user; global $user;
@ -168,7 +168,7 @@ class AdherentStats extends Stats
* *
* @return array Array with nb, total amount, average for each year * @return array Array with nb, total amount, average for each year
*/ */
function getAllByYear() public function getAllByYear()
{ {
global $user; global $user;

View File

@ -41,7 +41,7 @@ class Members extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -57,7 +57,7 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if(! DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
@ -91,7 +91,7 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -162,7 +162,7 @@ class Members extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of member * @return int ID of member
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
@ -187,7 +187,7 @@ class Members extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
@ -242,7 +242,7 @@ class Members extends DolibarrApi
* @param int $id member ID * @param int $id member ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->supprimer) { if(! DolibarrApiAccess::$user->rights->adherent->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -277,7 +277,7 @@ class Members extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$member = array(); $member = array();
foreach (Members::$FIELDS as $field) { foreach (Members::$FIELDS as $field) {
@ -288,15 +288,16 @@ class Members extends DolibarrApi
return $member; return $member;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove the subscriptions because they are handled as a subresource. // Remove the subscriptions because they are handled as a subresource.
@ -328,7 +329,7 @@ class Members extends DolibarrApi
* *
* @url GET {id}/subscriptions * @url GET {id}/subscriptions
*/ */
function getSubscriptions($id) public function getSubscriptions($id)
{ {
$obj_ret = array(); $obj_ret = array();
@ -361,7 +362,7 @@ class Members extends DolibarrApi
* *
* @url POST {id}/subscriptions * @url POST {id}/subscriptions
*/ */
function createSubscription($id, $start_date, $end_date, $amount, $label = '') 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); throw new RestException(401);
@ -389,7 +390,7 @@ class Members extends DolibarrApi
* *
* @url GET {id}/categories * @url GET {id}/categories
*/ */
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) 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); throw new RestException(401);

View File

@ -37,7 +37,7 @@ class MembersTypes extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -53,7 +53,7 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->lire) { if(! DolibarrApiAccess::$user->rights->adherent->lire) {
throw new RestException(401); throw new RestException(401);
@ -86,7 +86,7 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -154,7 +154,7 @@ class MembersTypes extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of member type * @return int ID of member type
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
@ -179,7 +179,7 @@ class MembersTypes extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
@ -220,7 +220,7 @@ class MembersTypes extends DolibarrApi
* @param int $id member type ID * @param int $id member type ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if (! DolibarrApiAccess::$user->rights->adherent->configurer) { if (! DolibarrApiAccess::$user->rights->adherent->configurer) {
throw new RestException(401); throw new RestException(401);
@ -255,7 +255,7 @@ class MembersTypes extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$membertype = array(); $membertype = array();
foreach (MembersTypes::$FIELDS as $field) { foreach (MembersTypes::$FIELDS as $field) {
@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi
return $membertype; return $membertype;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->array_options); unset($object->array_options);

View File

@ -40,7 +40,7 @@ class Subscriptions extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -56,7 +56,7 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->lire) {
throw new RestException(401); throw new RestException(401);
@ -85,7 +85,7 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "dateadh", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -151,7 +151,7 @@ class Subscriptions extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of subscription * @return int ID of subscription
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) {
throw new RestException(401); throw new RestException(401);
@ -176,7 +176,7 @@ class Subscriptions extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->adherent->creer) { if(! DolibarrApiAccess::$user->rights->adherent->creer) {
throw new RestException(401); throw new RestException(401);
@ -209,7 +209,7 @@ class Subscriptions extends DolibarrApi
* @param int $id ID of subscription to delete * @param int $id ID of subscription to delete
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
// The right to delete a subscription comes with the right to create one. // 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) {
@ -241,7 +241,7 @@ class Subscriptions extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$subscription = array(); $subscription = array();
foreach (Subscriptions::$FIELDS as $field) { foreach (Subscriptions::$FIELDS as $field) {

View File

@ -32,78 +32,78 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
*/ */
class Subscription extends CommonObject class Subscription extends CommonObject
{ {
/** /**
* @var string ID to identify managed object * @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';
/** /**
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png * @var string Name of table without prefix where object is stored
*/ */
public $picto='payment'; public $table_element='subscription';
public $datec; // Date creation /**
public $datem; // Date modification * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
public $dateh; // Subscription start date (date subscription) */
public $datef; // Subscription end date public $picto='payment';
/** public $datec; // Date creation
public $datem; // Date modification
public $dateh; // Subscription start date (date subscription)
public $datef; // Subscription end date
/**
* @var int ID * @var int ID
*/ */
public $fk_type; public $fk_type;
public $fk_adherent; public $fk_adherent;
public $amount; public $amount;
/** /**
* @var int ID * @var int ID
*/ */
public $fk_bank; public $fk_bank;
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
* Function who permitted cretaion of the subscription * Function who permitted cretaion of the subscription
* *
* @param User $user User that create * @param User $user User that create
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, Id subscription created if OK * @return int <0 if KO, Id subscription created if OK
*/ */
function create($user, $notrigger = false) public function create($user, $notrigger = false)
{ {
global $langs; global $langs;
$error = 0; $error = 0;
$now=dol_now(); $now=dol_now();
// Check parameters // Check parameters
if ($this->datef <= $this->dateh) if ($this->datef <= $this->dateh)
{ {
$this->error=$langs->trans("ErrorBadValueForDate"); $this->error=$langs->trans("ErrorBadValueForDate");
return -1; return -1;
} }
if (empty($this->datec)) $this->datec = $now; if (empty($this->datec)) $this->datec = $now;
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."subscription (fk_adherent, fk_type, datec, dateadh, datef, subscription, note)";
if ($this->fk_type == null) { if ($this->fk_type == null) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
@ -113,338 +113,338 @@ class Subscription extends CommonObject
} else { } else {
$type=$this->fk_type; $type=$this->fk_type;
} }
$sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',"; $sql.= " VALUES (".$this->fk_adherent.", '".$type."', '".$this->db->idate($now)."',";
$sql.= " '".$this->db->idate($this->dateh)."',"; $sql.= " '".$this->db->idate($this->dateh)."',";
$sql.= " '".$this->db->idate($this->datef)."',"; $sql.= " '".$this->db->idate($this->datef)."',";
$sql.= " ".$this->amount.","; $sql.= " ".$this->amount.",";
$sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')"; $sql.= " '".$this->db->escape($this->note_public?$this->note_public:$this->note)."')";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) { if (! $resql) {
$error++; $error++;
$this->errors[] = $this->db->lasterror(); $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);
} }
if (! $error && ! $notrigger) if (! $error && ! $notrigger)
{ {
// Call triggers // Call triggers
$result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user); $result=$this->call_trigger('MEMBER_SUBSCRIPTION_CREATE', $user);
if ($result < 0) { $error++; } if ($result < 0) { $error++; }
// End call triggers // End call triggers
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} else { } else {
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
} }
/** /**
* Method to load a subscription * Method to load a subscription
* *
* @param int $rowid Id subscription * @param int $rowid Id subscription
* @return int <0 if KO, =0 if not found, >0 if OK * @return int <0 if KO, =0 if not found, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql ="SELECT rowid, fk_type, fk_adherent, datec,"; $sql ="SELECT rowid, fk_type, fk_adherent, datec,";
$sql.=" tms,"; $sql.=" tms,";
$sql.=" dateadh as dateh,"; $sql.=" dateadh as dateh,";
$sql.=" datef,"; $sql.=" datef,";
$sql.=" subscription, note, fk_bank"; $sql.=" subscription, note, fk_bank";
$sql.=" FROM ".MAIN_DB_PREFIX."subscription"; $sql.=" FROM ".MAIN_DB_PREFIX."subscription";
$sql.=" WHERE rowid=".$rowid; $sql.=" WHERE rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql)) if ($this->db->num_rows($resql))
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->fk_type = $obj->fk_type; $this->fk_type = $obj->fk_type;
$this->fk_adherent = $obj->fk_adherent; $this->fk_adherent = $obj->fk_adherent;
$this->datec = $this->db->jdate($obj->datec); $this->datec = $this->db->jdate($obj->datec);
$this->datem = $this->db->jdate($obj->tms); $this->datem = $this->db->jdate($obj->tms);
$this->dateh = $this->db->jdate($obj->dateh); $this->dateh = $this->db->jdate($obj->dateh);
$this->datef = $this->db->jdate($obj->datef); $this->datef = $this->db->jdate($obj->datef);
$this->amount = $obj->subscription; $this->amount = $obj->subscription;
$this->note = $obj->note; $this->note = $obj->note;
$this->fk_bank = $obj->fk_bank; $this->fk_bank = $obj->fk_bank;
return 1; return 1;
} }
else else
{ {
return 0; return 0;
} }
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
} }
/** /**
* Update subscription * Update subscription
* *
* @param User $user User who updated * @param User $user User who updated
* @param int $notrigger 0=Disable triggers * @param int $notrigger 0=Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET "; $sql = "UPDATE ".MAIN_DB_PREFIX."subscription SET ";
$sql .= " fk_type = ".$this->fk_type.","; $sql .= " fk_type = ".$this->fk_type.",";
$sql .= " fk_adherent = ".$this->fk_adherent.","; $sql .= " fk_adherent = ".$this->fk_adherent.",";
$sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').","; $sql .= " note=".($this->note ? "'".$this->db->escape($this->note)."'" : 'null').",";
$sql .= " subscription = '".price2num($this->amount)."',"; $sql .= " subscription = '".price2num($this->amount)."',";
$sql .= " dateadh='".$this->db->idate($this->dateh)."',"; $sql .= " dateadh='".$this->db->idate($this->dateh)."',";
$sql .= " datef='".$this->db->idate($this->datef)."',"; $sql .= " datef='".$this->db->idate($this->datef)."',";
$sql .= " datec='".$this->db->idate($this->datec)."',"; $sql .= " datec='".$this->db->idate($this->datec)."',";
$sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null'); $sql .= " fk_bank = ".($this->fk_bank ? $this->fk_bank : 'null');
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db); $member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent); $result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user); $result=$member->update_end_date($user);
if (! $error && ! $notrigger) { if (! $error && ! $notrigger) {
// Call triggers // 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 if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} }
else else
{ {
$error++; $error++;
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} else { } else {
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
} }
/** /**
* Delete a subscription * Delete a subscription
* *
* @param User $user User that delete * @param User $user User that delete
* @param bool $notrigger false=launch triggers after, true=disable triggers * @param bool $notrigger false=launch triggers after, true=disable triggers
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
function delete($user, $notrigger = false) public function delete($user, $notrigger = false)
{ {
$error = 0; $error = 0;
// It subscription is linked to a bank transaction, we get it // It subscription is linked to a bank transaction, we get it
if ($this->fk_bank > 0) if ($this->fk_bank > 0)
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$accountline=new AccountLine($this->db); $accountline=new AccountLine($this->db);
$result=$accountline->fetch($this->fk_bank); $result=$accountline->fetch($this->fk_bank);
} }
$this->db->begin(); $this->db->begin();
if (! $error) { if (! $error) {
if (! $notrigger) { if (! $notrigger) {
// Call triggers // 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 if ($result < 0) { $error++; } // Do also here what you must do to rollback action if trigger fail
// End call triggers // End call triggers
} }
} }
if (! $error) if (! $error)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id; $sql = "DELETE FROM ".MAIN_DB_PREFIX."subscription WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG); dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$num=$this->db->affected_rows($resql); $num=$this->db->affected_rows($resql);
if ($num) if ($num)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$member=new Adherent($this->db); $member=new Adherent($this->db);
$result=$member->fetch($this->fk_adherent); $result=$member->fetch($this->fk_adherent);
$result=$member->update_end_date($user); $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) 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) if ($result > 0)
{ {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
else else
{ {
$this->error=$accountline->error; $this->error=$accountline->error;
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
else else
{ {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }
else else
{ {
$this->db->commit(); $this->db->commit();
return 0; return 0;
} }
} }
else else
{ {
$error++; $error++;
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
} }
} }
// Commit or rollback // Commit or rollback
if ($error) { if ($error) {
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} else { } else {
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
} }
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param string $option Page for link ('', 'nolink', ...) * @param string $option Page for link ('', 'nolink', ...)
* @param string $morecss Add more css on link * @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 $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1)
{ {
global $langs; global $langs;
$result=''; $result='';
$langs->load("members"); $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; $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
if ($option != 'nolink') if ($option != 'nolink')
{ {
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); $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 ($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'; if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
} }
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">'; $linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>'; $linkend = '</a>';
$picto='payment'; $picto='payment';
$result .= $linkstart; $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) $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 != 2) $result.= $this->ref;
$result .= $linkend; $result .= $linkend;
return $result; return $result;
} }
/** /**
* Retourne le libelle du statut d'une adhesion * Retourne le libelle du statut d'une adhesion
* *
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label * @return string Label
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return ''; return '';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* *
* @param int $statut Id statut * @param int $statut Id statut
* @return string Label * @return string Label
*/ */
function LibStatut($statut) public function LibStatut($statut)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
$langs->load("members"); $langs->load("members");
return ''; return '';
} }
/** /**
* Load information of the subscription object * Load information of the subscription object
* *
* @param int $id Id subscription * @param int $id Id subscription
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT c.rowid, c.datec,'; $sql = 'SELECT c.rowid, c.datec,';
$sql.= ' c.tms as datem'; $sql.= ' c.tms as datem';
$sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c'; $sql.= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql.= ' WHERE c.rowid = '.$id; $sql.= ' WHERE c.rowid = '.$id;
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
if ($this->db->num_rows($result)) if ($this->db->num_rows($result))
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec); $this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem); $this->date_modification = $this->db->jdate($obj->datem);
} }
$this->db->free($result); $this->db->free($result);
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
} }

View File

@ -511,7 +511,7 @@ if (! empty($arrayfields['state.nom']['checked']))
if (! empty($arrayfields['country.code_iso']['checked'])) if (! empty($arrayfields['country.code_iso']['checked']))
{ {
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100'); print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
print '</td>'; print '</td>';
} }
// Phone pro // Phone pro

View File

@ -58,15 +58,16 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra
$title=$langs->trans("MembersStatisticsByProperties"); $title=$langs->trans("MembersStatisticsByProperties");
print load_fiche_titre($title, $mesg); print load_fiche_titre($title, '');
dol_mkdir($dir); dol_mkdir($dir);
$tab='byproperties'; $tab='byproperties';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, d.morphy as code"; $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.=" 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.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql.=" AND d.statut = 1";
$sql.=" GROUP BY d.morphy"; $sql.=" GROUP BY d.morphy";
@ -87,7 +88,7 @@ if ($resql)
if ($obj->code == 'phy') $foundphy++; if ($obj->code == 'phy') $foundphy++;
if ($obj->code == 'mor') $foundmor++; if ($obj->code == 'mor') $foundmor++;
$data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate)); $data[]=array('label'=>$obj->code, 'nb'=>$obj->nb, 'lastdate'=>$db->jdate($obj->lastdate), 'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate));
$i++; $i++;
} }
@ -120,22 +121,21 @@ print '<table class="liste" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Nature").'</td>'; print '<td>'.$langs->trans("Nature").'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>'; print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
print '<td align="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td align="center">'.$langs->trans("LatestSubscriptionDate").'</td>'; print '<td align="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>'; print '</tr>';
if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>''); if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>''); if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>'', 'lastsubscriptiondate'=>'');
$oldyear=0;
foreach ($data as $val) foreach ($data as $val)
{ {
$year = $val['year'];
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>'; print '<td>'.$memberstatic->getmorphylib($val['label']).'</td>';
print '<td class="right">'.$val['nb'].'</td>'; print '<td class="right">'.$val['nb'].'</td>';
print '<td align="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>'; print '<td align="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>';
print '<td align="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year;
} }
print '</table>'; print '</table>';

View File

@ -77,8 +77,10 @@ if ($mode)
$tab='statscountry'; $tab='statscountry';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label"; $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 LEFT JOIN ".MAIN_DB_PREFIX."c_country as c on d.country = c.rowid"; $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.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code"; $sql.=" GROUP BY c.label, c.code";
@ -92,10 +94,12 @@ if ($mode)
$tab='statsstate'; $tab='statsstate';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, c.nom as label2"; // $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 LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $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_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."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.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, c.nom"; $sql.=" GROUP BY co.label, co.code, c.nom";
@ -108,10 +112,12 @@ if ($mode)
$tab='statsregion'; //onglet $tab='statsregion'; //onglet
$data = array(); //tableau de donnée $data = array(); //tableau de donnée
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, co.code, co.label, r.nom as label2"; $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 LEFT JOIN ".MAIN_DB_PREFIX."c_departements as c on d.state_id = c.rowid"; $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_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."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.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql.=" AND d.statut = 1";
$sql.=" GROUP BY co.label, co.code, r.nom"; //+ $sql.=" GROUP BY co.label, co.code, r.nom"; //+
@ -124,9 +130,10 @@ if ($mode)
$tab='statstown'; $tab='statstown';
$data = array(); $data = array();
$sql.="SELECT COUNT(d.rowid) as nb, MAX(d.datevalid) as lastdate, c.code, c.label, d.town as label2"; $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.=" 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."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.=" WHERE d.entity IN (".getEntity('adherent').")";
$sql.=" AND d.statut = 1"; $sql.=" AND d.statut = 1";
$sql.=" GROUP BY c.label, c.code, d.town"; $sql.=" GROUP BY c.label, c.code, d.town";
@ -154,7 +161,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("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, 'code'=>$obj->code,
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate) 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbyregion') //+ if ($mode == 'memberbyregion') //+
@ -164,7 +172,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("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")), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate) 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbystate') if ($mode == 'memberbystate')
@ -173,7 +182,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("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")), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate) 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
if ($mode == 'memberbytown') if ($mode == 'memberbytown')
@ -182,7 +192,8 @@ if ($mode)
'label_en'=>(($obj->code && $langsen->transnoentitiesnoconv("Country".$obj->code)!="Country".$obj->code)?$langsen->transnoentitiesnoconv("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")), 'label2'=>($obj->label2?$obj->label2:$langs->trans("Unknown")),
'nb'=>$obj->nb, 'nb'=>$obj->nb,
'lastdate'=>$db->jdate($obj->lastdate) 'lastdate'=>$db->jdate($obj->lastdate),
'lastsubscriptiondate'=>$db->jdate($obj->lastsubscriptiondate)
); );
} }
@ -233,7 +244,7 @@ else
// Show graphics // Show graphics
if (count($arrayjs) && $mode == 'memberbycountry') if (count($arrayjs) && $mode == 'memberbycountry')
{ {
$color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/graph-color.php'; $color_file = DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
if (is_readable($color_file)) include_once $color_file; if (is_readable($color_file)) include_once $color_file;
// Assume we've already included the proper headers so just call our script inline // Assume we've already included the proper headers so just call our script inline
@ -289,9 +300,9 @@ if ($mode)
if ($label2) print '<td align="center">'.$label2.'</td>'; if ($label2) print '<td align="center">'.$label2.'</td>';
print '<td class="right">'.$langs->trans("NbOfMembers").'</td>'; print '<td class="right">'.$langs->trans("NbOfMembers").'</td>';
print '<td align="center">'.$langs->trans("LastMemberDate").'</td>'; print '<td align="center">'.$langs->trans("LastMemberDate").'</td>';
print '<td align="center">'.$langs->trans("LatestSubscriptionDate").'</td>';
print '</tr>'; print '</tr>';
$oldyear=0;
foreach ($data as $val) foreach ($data as $val)
{ {
$year = $val['year']; $year = $val['year'];
@ -300,8 +311,8 @@ if ($mode)
if ($label2) print '<td align="center">'.$val['label2'].'</td>'; if ($label2) print '<td align="center">'.$val['label2'].'</td>';
print '<td class="right">'.$val['nb'].'</td>'; print '<td class="right">'.$val['nb'].'</td>';
print '<td align="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>'; print '<td align="center">'.dol_print_date($val['lastdate'], 'dayhour').'</td>';
print '<td align="center">'.dol_print_date($val['lastsubscriptiondate'], 'dayhour').'</td>';
print '</tr>'; print '</tr>';
$oldyear=$year;
} }
print '</table>'; print '</table>';

View File

@ -50,8 +50,8 @@ $type = 'bankaccount';
//Order display of bank account //Order display of bank account
if ($action == 'setbankorder') { if ($action == 'setbankorder') {
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0)
GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) { {
header("Location: " . $_SERVER["PHP_SELF"]); header("Location: " . $_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -62,8 +62,8 @@ if ($action == 'setbankorder') {
//Auto report last num releve on conciliate //Auto report last num releve on conciliate
if ($action == 'setreportlastnumreleve') { if ($action == 'setreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0, if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0, '', $conf->entity) > 0)
'', $conf->entity) > 0) { {
header("Location: " . $_SERVER["PHP_SELF"]); header("Location: " . $_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -72,8 +72,8 @@ if ($action == 'setreportlastnumreleve') {
} }
} }
elseif ($action == 'unsetreportlastnumreleve') { elseif ($action == 'unsetreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, '', $conf->entity) > 0)
'', $conf->entity) > 0) { {
header("Location: " . $_SERVER["PHP_SELF"]); header("Location: " . $_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -100,8 +100,7 @@ if ($action == 'specimen') {
$filefound = 0; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) { foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php", $file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php", 0);
0);
if (file_exists($file)) { if (file_exists($file)) {
$filefound = 1; $filefound = 1;
$classname = "pdf_" . $modele; $classname = "pdf_" . $modele;
@ -142,8 +141,7 @@ elseif ($action == 'del') {
} }
// Set default model // Set default model
elseif ($action == 'setdoc') { elseif ($action == 'setdoc') {
if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '', if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) {
$conf->entity)) {
// The constant that was read before the new set // The constant that was read before the new set
// We therefore requires a variable to have a coherent view // We therefore requires a variable to have a coherent view
$conf->global->BANKADDON_PDF = $value; $conf->global->BANKADDON_PDF = $value;
@ -169,8 +167,7 @@ $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", $langs->trans("BankSetupModule")); llxHeader("", $langs->trans("BankSetupModule"));
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, 'title_setup');
'title_setup');
$head = bank_admin_prepare_head(null); $head = bank_admin_prepare_head(null);
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account'); dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account');
@ -252,7 +249,7 @@ if ($resql) {
while ($i < $num_rows) { while ($i < $num_rows) {
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
array_push($def, $array[0]); array_push($def, $array[0]);
$i ++; $i++;
} }
} }
else { else {
@ -285,8 +282,7 @@ foreach ($dirmodels as $reldir) {
arsort($filelist); arsort($filelist);
foreach ($filelist as $file) { foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
$file)) {
if (file_exists($dir . '/' . $file)) { if (file_exists($dir . '/' . $file)) {
$name = substr($file, 4, dol_strlen($file) - 16); $name = substr($file, 4, dol_strlen($file) - 16);
@ -296,11 +292,9 @@ foreach ($dirmodels as $reldir) {
$module = new $classname($db); $module = new $classname($db);
$modulequalified = 1; $modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
< 2)
$modulequalified = 0; $modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
< 1)
$modulequalified = 0; $modulequalified = 0;
if ($modulequalified) { if ($modulequalified) {
@ -317,27 +311,23 @@ foreach ($dirmodels as $reldir) {
if (in_array($name, $def)) { if (in_array($name, $def)) {
print '<td class="center">' . "\n"; print '<td class="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">';
print img_picto($langs->trans("Enabled"), print img_picto($langs->trans("Enabled"), 'switch_on');
'switch_on');
print '</a>'; print '</a>';
print '</td>'; print '</td>';
} }
else { else {
print '<td class="center">' . "\n"; print '<td class="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
'switch_off') . '</a>';
print "</td>"; print "</td>";
} }
// Default // Default
print '<td class="center">'; print '<td class="center">';
if ($conf->global->BANKADDON_PDF == $name) { if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), print img_picto($langs->trans("Default"), 'on');
'on');
} }
else { else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scan_dir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
'off') . '</a>';
} }
print '</td>'; print '</td>';
@ -348,30 +338,25 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur; $htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
} }
$htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>'; $htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, $htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1); //$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1); //$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, $htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
1, 1);
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); // $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); // $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1); //$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
print '<td class="center">'; print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, print $form->textwithpicto('', $htmltooltip, 1, 0);
0);
print '</td>'; print '</td>';
// Preview // Preview
print '<td class="center">'; print '<td class="center">';
if ($module->type == 'pdf') { if ($module->type == 'pdf') {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'bill') . '</a>';
'bill') . '</a>';
} }
else { else {
print img_object($langs->trans("PreviewNotAvailable"), print img_object($langs->trans("PreviewNotAvailable"), 'generic');
'generic');
} }
print '</td>'; print '</td>';
@ -423,8 +408,7 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
else else
{ {
print '<td class="center">' . "\n"; print '<td class="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setreportlastnumreleve">' . img_picto($langs->trans("Disabled"), print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setreportlastnumreleve">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
'switch_off') . '</a>';
print "</td>"; print "</td>";
} }

View File

@ -44,7 +44,12 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'setbarcodeproducton') if ($action == 'setbarcodeproducton')
{ {
$res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", GETPOST('value'), 'chaine', 0, '', $conf->entity); $barcodenumberingmodule = GETPOST('value', 'alpha');
$res=dolibarr_set_const($db, "BARCODE_PRODUCT_ADDON_NUM", $barcodenumberingmodule, 'chaine', 0, '', $conf->entity);
if ($barcodenumberingmodule == 'mod_barcode_product_standard' && empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK))
{
$res=dolibarr_set_const($db, "BARCODE_STANDARD_PRODUCT_MASK", '020{000000000}', 'chaine', 0, '', $conf->entity);
}
} }
elseif ($action == 'setbarcodeproductoff') elseif ($action == 'setbarcodeproductoff')
{ {
@ -406,13 +411,13 @@ if ($conf->produit->enabled)
if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file")
{ {
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;value='.$file.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproductoff&amp;value='.$file.'">';
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>'; print '</a></td>';
} }
else else
{ {
print '<td class="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;value='.$file.'">'; print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setbarcodeproducton&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off'); print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>'; print '</a></td>';
} }

560
htdocs/admin/bom.php Normal file
View File

@ -0,0 +1,560 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/bom.php
* \ingroup bom
* \brief Setup page of module BOM
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('admin', 'errors', 'mrp', 'other'));
if (! $user->admin) accessforbidden();
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scan_dir', 'alpha');
$type = 'bom';
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if ($action == 'updateMask')
{
$maskconstbom=GETPOST('maskconstBom', 'alpha');
$maskbom=GETPOST('maskBom', 'alpha');
if ($maskconstbom) $res = dolibarr_set_const($db, $maskconstbom, $maskbom, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'specimen')
{
$modele=GETPOST('module', 'alpha');
$bom = new BOM($db);
$bom->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/bom/doc/pdf_".$modele.".modules.php", 0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db);
if ($module->write_file($bom, $langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
elseif ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
elseif ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->BOM_ADDON_PDF == "$value") dolibarr_del_const($db, 'BOM_ADDON_PDF', $conf->entity);
}
}
// Set default model
elseif ($action == 'setdoc')
{
if (dolibarr_set_const($db, "BOM_ADDON_PDF", $value, 'chaine', 0, '', $conf->entity))
{
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->BOM_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
elseif ($action == 'setmod')
{
// TODO Check if numbering module chosen can be activated
// by calling method canBeActivated
dolibarr_set_const($db, "BOM_ADDON", $value, 'chaine', 0, '', $conf->entity);
}
elseif ($action == 'set_BOM_DRAFT_WATERMARK')
{
$draft = GETPOST("BOM_DRAFT_WATERMARK");
$res = dolibarr_set_const($db, "BOM_DRAFT_WATERMARK", trim($draft), 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'set_BOM_FREE_TEXT')
{
$freetext = GETPOST("BOM_FREE_TEXT", 'none'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "BOM_FREE_TEXT", $freetext, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
} elseif ($action=="setshippableiconinlist") {
// Activate Set Shippable Icon In List
$setshippableiconinlist = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SHIPPABLE_BOM_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
/*
* View
*/
$form=new Form($db);
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("", $langs->trans("BOMsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BOMsSetup"), $linkback, 'title_setup');
$head = bomAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("BOMs"), -1, 'bom');
/*
* BOMs Numbering model
*/
print load_fiche_titre($langs->trans("BOMsNumberingModules"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
print '</tr>'."\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/bom/");
if (is_dir($dir))
{
$handle = opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 8) == 'mod_bom_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, dol_strlen($file)-4);
require_once $dir.$file.'.php';
$module = new $file($db);
// Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled())
{
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info();
print '</td>';
// Show example of numbering model
print '<td class="nowrap">';
$tmp=$module->getExample();
if (preg_match('/^Error/', $tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
else print $tmp;
print '</td>'."\n";
print '<td class="center">';
if ($conf->global->BOM_ADDON == $file)
{
print img_picto($langs->trans("Activated"), 'switch_on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a>';
}
print '</td>';
$bom=new BOM($db);
$bom->initAsSpecimen();
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$bom->type=0;
$nextval=$module->getNextValue($mysoc, $bom);
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
$htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) {
if (preg_match('/^Error/', $nextval) || $nextval=='NotConfigured')
$nextval = $langs->trans($nextval);
$htmltooltip.=$nextval.'<br>';
} else {
$htmltooltip.=$langs->trans($module->error).'<br>';
}
}
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
}
}
print "</table><br>\n";
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
/*
* Document templates generators
*/
print load_fiche_titre($langs->trans("BOMsModelModule"), '', '');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
if ($resql)
{
$i = 0;
$num_rows=$db->num_rows($resql);
while ($i < $num_rows)
{
$array = $db->fetch_array($resql);
array_push($def, $array[0]);
$i++;
}
}
else
{
dol_print_error($db);
}
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach (array('','/doc') as $valdir)
{
$dir = dol_buildpath($reldir."core/modules/bom".$valdir);
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
$filelist[]=$file;
}
closedir($handle);
arsort($filelist);
foreach($filelist as $file)
{
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
{
if (file_exists($dir.'/'.$file))
{
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db);
$modulequalified=1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
if ($modulequalified)
{
$var = !$var;
print '<tr class="oddeven"><td width="100">';
print (empty($module->name)?$name:$module->name);
print "</td><td>\n";
if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
}
else
{
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Default
print '<td class="center">';
if ($conf->global->BOM_ADDON_PDF == $name)
{
print img_picto($langs->trans("Default"), 'on');
}
else
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
// Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf')
{
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg, 1, 1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftBOMs").': '.yn($module->option_draft_watermark, 1, 1);
print '<td class="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print '</td>';
// Preview
print '<td class="center">';
if ($module->type == 'pdf')
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"), 'bill').'</a>';
}
else
{
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
}
print '</td>';
print "</tr>\n";
}
}
}
}
}
}
}
}
print '</table>';
print "<br>";
/*
* Other options
*/
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60">'.$langs->trans("Value").'</td>';
print "<td>&nbsp;</td>\n";
print "</tr>\n";
$substitutionarray=pdf_getSubstitutionArray($langs, null, null, 2);
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
$htmltext.='</i>';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_BOM_FREE_TEXT">';
print '<tr class="oddeven"><td colspan="2">';
print $form->textwithpicto($langs->trans("FreeLegalTextOnBOMs"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'<br>';
$variablename='BOM_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
}
else
{
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes');
print $doleditor->Create();
}
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
//Use draft Watermark
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_BOM_DRAFT_WATERMARK\">";
print '<tr class="oddeven"><td>';
print $form->textwithpicto($langs->trans("WatermarkOnDraftBOMs"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
print '</td><td>';
print '<input class="flat minwidth200" type="text" name="BOM_DRAFT_WATERMARK" value="'.$conf->global->BOM_DRAFT_WATERMARK.'">';
print '</td><td class="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
print '</table>';
print '<br>';
}
/*
* Notifications
*/
/*
print load_fiche_titre($langs->trans("Notifications"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="center" width="60"></td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr class="oddeven"><td colspan="2">';
print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'<br>';
print '</td><td class="right">';
print "</td></tr>\n";
print '</table>';
*/
// End of page
llxFooter();
$db->close();

View File

@ -300,7 +300,7 @@ foreach ($dirmodels as $reldir)
if ($module->isEnabled()) if ($module->isEnabled())
{ {
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n"; print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
print $module->info(); print $module->info();
print '</td>'; print '</td>';

View File

@ -1912,7 +1912,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '')
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
} }
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td class="maxxxx"><input type="text" class="flat minwidth75" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>'; print '<td class="maxxxx"><input type="text" class="flat minwidth75 maxwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
} }
elseif ($fieldlist[$field]=='unit') { elseif ($fieldlist[$field]=='unit') {
print '<td>'; print '<td>';

View File

@ -69,7 +69,7 @@ class PrestaShopWebservice
* @param string $key Authentification key * @param string $key Authentification key
* @param mixed $debug Debug mode Activated (true) or deactivated (false) * @param mixed $debug Debug mode Activated (true) or deactivated (false)
*/ */
function __construct($url, $key, $debug = true) public function __construct($url, $key, $debug = true)
{ {
if (!extension_loaded('curl')) if (!extension_loaded('curl'))
throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library');
@ -77,7 +77,7 @@ class PrestaShopWebservice
$this->key = $key; $this->key = $key;
$this->debug = $debug; $this->debug = $debug;
$this->version = 'unknown'; $this->version = 'unknown';
} }
/** /**
* Take the status code and throw an exception if the server didn't return 200 or 201 code * Take the status code and throw an exception if the server didn't return 200 or 201 code

View File

@ -54,7 +54,7 @@ class Dolistore
* *
* @param boolean $debug Enable debug of request on screen * @param boolean $debug Enable debug of request on screen
*/ */
function __construct($debug = false) public function __construct($debug = false)
{ {
global $conf, $langs; global $conf, $langs;
@ -77,7 +77,7 @@ class Dolistore
* @param array $options Options * @param array $options Options
* @return void * @return void
*/ */
function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) public function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0))
{ {
global $conf, $langs; global $conf, $langs;
@ -163,14 +163,14 @@ class Dolistore
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return tree of Dolistore categories. $this->categories must have been loaded before. * Return tree of Dolistore categories. $this->categories must have been loaded before.
* *
* @param int $parent Id of parent category * @param int $parent Id of parent category
* @return string * @return string
*/ */
function get_categories($parent = 0) public function get_categories($parent = 0)
{ {
// phpcs:enable // phpcs:enable
if (!isset($this->categories)) die('not possible'); if (!isset($this->categories)) die('not possible');
@ -212,13 +212,13 @@ class Dolistore
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of product formated for output * Return list of product formated for output
* *
* @return string HTML output * @return string HTML output
*/ */
function get_products() public function get_products()
{ {
// phpcs:enable // phpcs:enable
global $langs, $conf; global $langs, $conf;
@ -291,44 +291,44 @@ class Dolistore
</td> </td>
<td class="margeCote">'.$download_link.'</td> <td class="margeCote">'.$download_link.'</td>
</tr>'; </tr>';
} }
return $html; return $html;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get previous link * get previous link
* *
* @param string $text symbol previous * @param string $text symbol previous
* @return string html previous link * @return string html previous link
*/ */
function get_previous_link($text = '<<') public function get_previous_link($text = '<<')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_previous_url().'" class="button">'.$text.'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get next link * get next link
* *
* @param string $text symbol next * @param string $text symbol next
* @return string html next link * @return string html next link
*/ */
function get_next_link($text = '>>') public function get_next_link($text = '>>')
{ {
// phpcs:enable // phpcs:enable
return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>'; return '<a href="'.$this->get_next_url().'" class="button">'.$text.'</a>';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get previous url * get previous url
* *
* @return string previous url * @return string previous url
*/ */
function get_previous_url() public function get_previous_url()
{ {
// phpcs:enable // phpcs:enable
$param_array = array(); $param_array = array();
if ($this->start < $this->per_page) { if ($this->start < $this->per_page) {
@ -343,15 +343,15 @@ class Dolistore
} }
$param = http_build_query($param_array); $param = http_build_query($param_array);
return $this->url."&".$param; return $this->url."&".$param;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* get next url * get next url
* *
* @return string next url * @return string next url
*/ */
function get_next_url() public function get_next_url()
{ {
// phpcs:enable // phpcs:enable
$param_array = array(); $param_array = array();
@ -369,7 +369,7 @@ class Dolistore
return $this->url."&".$param; return $this->url."&".$param;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* version compare * version compare
* *
@ -377,7 +377,7 @@ class Dolistore
* @param string $v2 version 2 * @param string $v2 version 2
* @return int result of compare * @return int result of compare
*/ */
function version_compare($v1, $v2) public function version_compare($v1, $v2)
{ {
// phpcs:enable // phpcs:enable
$v1 = explode('.', $v1); $v1 = explode('.', $v1);

View File

@ -307,7 +307,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'clone') { if ($action == 'clone') {
// Create an array for form // Create an array for form
$formquestion = array(); $formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneMyObject'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEmailCollector', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
} }
// Confirmation of action process // Confirmation of action process

View File

@ -77,8 +77,7 @@ if ($action == 'updateMask')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'specimen')
if ($action == 'specimen')
{ {
$modele=GETPOST('module', 'alpha'); $modele=GETPOST('module', 'alpha');
@ -122,7 +121,6 @@ if ($action == 'specimen')
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
// Activate a model // Activate a model
elseif ($action == 'set') elseif ($action == 'set')
{ {
@ -137,7 +135,6 @@ elseif ($action == 'del')
if ($conf->global->FACTURE_ADDON_PDF == "$value") dolibarr_del_const($db, 'FACTURE_ADDON_PDF', $conf->entity); if ($conf->global->FACTURE_ADDON_PDF == "$value") dolibarr_del_const($db, 'FACTURE_ADDON_PDF', $conf->entity);
} }
} }
// Set default model // Set default model
elseif ($action == 'setdoc') elseif ($action == 'setdoc')
{ {
@ -155,7 +152,6 @@ elseif ($action == 'setdoc')
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
} }
elseif ($action == 'setmod') elseif ($action == 'setmod')
{ {
// TODO Verifier si module numerotation choisi peut etre active // TODO Verifier si module numerotation choisi peut etre active
@ -163,8 +159,7 @@ elseif ($action == 'setmod')
dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "FACTURE_ADDON", $value, 'chaine', 0, '', $conf->entity);
} }
elseif ($action == 'setribchq')
if ($action == 'setribchq')
{ {
$rib = GETPOST('rib', 'alpha'); $rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha'); $chq = GETPOST('chq', 'alpha');
@ -183,8 +178,7 @@ if ($action == 'setribchq')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'set_FACTURE_DRAFT_WATERMARK')
if ($action == 'set_FACTURE_DRAFT_WATERMARK')
{ {
$draft = GETPOST('FACTURE_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('FACTURE_DRAFT_WATERMARK', 'alpha');
@ -202,7 +196,7 @@ if ($action == 'set_FACTURE_DRAFT_WATERMARK')
} }
} }
if ($action == 'set_INVOICE_FREE_TEXT') elseif ($action == 'set_INVOICE_FREE_TEXT')
{ {
$freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('INVOICE_FREE_TEXT', 'none'); // No alpha here, we want exact string
@ -219,8 +213,7 @@ if ($action == 'set_INVOICE_FREE_TEXT')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'setforcedate')
if ($action == 'setforcedate')
{ {
$forcedate = GETPOST('forcedate', 'alpha'); $forcedate = GETPOST('forcedate', 'alpha');
@ -237,8 +230,7 @@ if ($action == 'setforcedate')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'setDefaultPDFModulesByType')
if ($action == 'setDefaultPDFModulesByType')
{ {
$invoicetypemodels = GETPOST('invoicetypemodels'); $invoicetypemodels = GETPOST('invoicetypemodels');

View File

@ -155,7 +155,7 @@ print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'handler', $langs->trans("Menus"), -1); dol_fiche_head($head, 'handler', $langs->trans("Menus"), -1);
print $langs->trans("MenusDesc")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("MenusDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -237,7 +237,7 @@ $h++;
dol_fiche_head($head, 'editor', $langs->trans("Menus"), -1); dol_fiche_head($head, 'editor', $langs->trans("Menus"), -1);
print $langs->trans("MenusEditorDesc")."<br>\n"; print '<span class="opacitymedium">'.$langs->trans("MenusEditorDesc")."</span><br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -457,10 +457,10 @@ if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouM
print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup'); print load_fiche_titre($langs->trans("ModulesSetup"), $moreinfo, 'title_setup');
// Start to show page // Start to show page
if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n"; if ($mode=='common') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDesc")."</span><br>\n";
if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n"; if ($mode=='marketplace') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n"; if ($mode=='deploy') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n"; if ($mode=='develop') print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
$head = modules_prepare_head(); $head = modules_prepare_head();

View File

@ -173,7 +173,7 @@ if ($action == 'specimen')
} }
// Set default model // Set default model
else if ($action == 'setdoc') elseif ($action == 'setdoc')
{ {
if (dolibarr_set_const($db, "PAYMENTORDER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "PAYMENTORDER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {

View File

@ -69,8 +69,7 @@ if ($action == 'updateMask')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'specimen')
if ($action == 'specimen')
{ {
$modele=GETPOST('module', 'alpha'); $modele=GETPOST('module', 'alpha');
@ -114,8 +113,26 @@ if ($action == 'specimen')
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
elseif ($action == 'setribchq')
{
$rib = GETPOST('rib', 'alpha');
$chq = GETPOST('chq', 'alpha');
if ($action == 'set_PROPALE_DRAFT_WATERMARK') $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
elseif ($action == 'set_PROPALE_DRAFT_WATERMARK')
{ {
$draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha'); $draft = GETPOST('PROPALE_DRAFT_WATERMARK', 'alpha');
@ -131,8 +148,7 @@ if ($action == 'set_PROPALE_DRAFT_WATERMARK')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'set_PROPOSAL_FREE_TEXT')
if ($action == 'set_PROPOSAL_FREE_TEXT')
{ {
$freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string $freetext = GETPOST('PROPOSAL_FREE_TEXT', 'none'); // No alpha here, we want exact string
@ -149,8 +165,7 @@ if ($action == 'set_PROPOSAL_FREE_TEXT')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'setdefaultduration')
if ($action == 'setdefaultduration')
{ {
$res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "PROPALE_VALIDITY_DURATION", $value, 'chaine', 0, '', $conf->entity);
@ -166,7 +181,7 @@ if ($action == 'setdefaultduration')
} }
} }
if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
{ {
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL", $value, 'chaine', 0, '', $conf->entity);
@ -181,13 +196,11 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
// Activate a model // Activate a model
if ($action == 'set') elseif ($action == 'set')
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
elseif ($action == 'del') elseif ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
@ -456,7 +469,7 @@ foreach ($dirmodels as $reldir)
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = $langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
@ -499,6 +512,106 @@ foreach ($dirmodels as $reldir)
} }
print '</table>'; print '</table>';
/*
* Payment mode
*/
if (empty($conf->facture->enabled))
{
print '<br>';
print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInProposal"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>';
print '<input type="hidden" name="action" value="setribchq">';
print $langs->trans("PaymentMode").'</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByRIBOnAccount")."</td>";
print "<td>";
if (! empty($conf->banque->enabled))
{
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE clos = 0";
$sql.= " AND courant = 1";
$sql.= " AND entity IN (".getEntity('bank_account').")";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<select name="rib" class="flat" id="rib">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_RIB_NUMBER == $row[0] ? ' selected':'';
print '>'.$row[1].'</option>';
$i++;
}
print "</select>";
}
else
{
print "<i>".$langs->trans("NoActiveBankAccountDefined")."</i>";
}
}
}
else
{
print $langs->trans("BankModuleNotActive");
}
print "</td></tr>";
print '<tr class="oddeven">';
print "<td>".$langs->trans("SuggestPaymentByChequeToAddress")."</td>";
print "<td>";
print '<select class="flat" name="chq" id="chq">';
print '<option value="0">'.$langs->trans("DoNotSuggestPaymentMode").'</option>';
print '<option value="-1"'.($conf->global->FACTURE_CHQ_NUMBER?' selected':'').'>'.$langs->trans("MenuCompanySetup").' ('.($mysoc->name?$mysoc->name:$langs->trans("NotDefined")).')</option>';
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE clos = 0";
$sql.= " AND courant = 1";
$sql.= " AND entity IN (".getEntity('bank_account').")";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$row = $db->fetch_row($resql);
print '<option value="'.$row[0].'"';
print $conf->global->FACTURE_CHQ_NUMBER == $row[0] ? ' selected':'';
print '>'.$langs->trans("OwnerOfBankAccount", $row[1]).'</option>';
$i++;
}
}
print "</select>";
print "</td></tr>";
print "</table>";
print "</form>";
}
print '<br>'; print '<br>';

View File

@ -81,7 +81,7 @@ if ($action == 'addprinter' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->AddPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter); $result= $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) if (! $error)
@ -107,7 +107,7 @@ if ($action == 'deleteprinter' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->DeletePrinter($printerid); $result= $printer->deletePrinter($printerid);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) if (! $error)
@ -133,7 +133,7 @@ if ($action == 'updateprinter' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->UpdatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid); $result= $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) { if (! $error) {
@ -156,7 +156,7 @@ if ($action == 'testprinter' && $user->admin) {
if (! $error) { if (! $error) {
// test // test
$ret = $printer->SendTestToPrinter($printerid); $ret = $printer->sendTestToPrinter($printerid);
if ($ret == 0) { if ($ret == 0) {
setEventMessages($langs->trans("TestSentToPrinter", $printername), null); setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
} else { } else {
@ -176,7 +176,7 @@ if ($action == 'updatetemplate' && $user->admin) {
} }
if (! $error) { if (! $error) {
$result= $printer->UpdateTemplate($templatename, $template, $templateid); $result= $printer->updateTemplate($templatename, $template, $templateid);
if ($result > 0) $error++; if ($result > 0) $error++;
if (! $error) { if (! $error) {

View File

@ -212,7 +212,7 @@ if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/(modGeneratePass[a-z]+)\.class\.php/i', $file, $reg)) if (preg_match('/(modGeneratePass[a-z]+)\.class\.php$/i', $file, $reg))
{ {
// Charging the numbering class // Charging the numbering class
$classname = $reg[1]; $classname = $reg[1];
@ -398,7 +398,6 @@ print '<td align="center">'.$langs->trans("Action").'</td>';
print '</tr>'; print '</tr>';
// Disable clear password in database // Disable clear password in database
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>'; print '<td colspan="3">'.$langs->trans("DoNotStoreClearPassword").'</td>';
print '<td align="center" width="60">'; print '<td align="center" width="60">';
@ -413,6 +412,8 @@ if (! $conf->global->DATABASE_PWD_ENCRYPTED)
print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>'; print '<a href="security.php?action=activate_encrypt">'.$langs->trans("Activate").'</a>';
print "</td>"; print "</td>";
} }
// Database conf file encryption
if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) if (! empty($conf->global->DATABASE_PWD_ENCRYPTED))
{ {
print '<td align="center" width="100">'; print '<td align="center" width="100">';
@ -494,9 +495,21 @@ print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
print '<br>';
if (GETPOST('info', 'int') > 0)
//print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></td></tr>'; {
if (function_exists('password_hash'))
{
print $langs->trans("Note: The function password_hash exists on your PHP")."<br>\n";
}
else
{
print $langs->trans("Note: The function password_hash does not exists on your PHP")."<br>\n";
}
print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."<br>\n";
print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."<br>\n";
}
print '</div>'; print '</div>';

View File

@ -339,8 +339,8 @@ if (! $error && $xml)
$out.='<td>'.$i.'</td>' . "\n"; $out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename']; $out.='<td>'.$file['filename'];
if (! preg_match('/^win/i', PHP_OS)) { if (! preg_match('/^win/i', PHP_OS)) {
$htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']); $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename']
$out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'); $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
} }
$out.='</td>' . "\n"; $out.='</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n"; $out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";

View File

@ -19,7 +19,7 @@
/** /**
* \file admin/ticket.php * \file admin/ticket.php
* \ingroup ticket * \ingroup ticket
* \brief This file is a module setup page * \brief Page to setup module ticket
*/ */
require '../main.inc.php'; require '../main.inc.php';
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php"; require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
// Load translation files required by the page // Load translation files required by the page
$langs->load("ticket"); $langs->loadLangs(array("admin", "ticket"));
// Access control // Access control
if (!$user->admin) { if (!$user->admin) {
@ -91,16 +91,6 @@ if ($action == 'updateMask') {
$error++; $error++;
} }
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha'); $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) { if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
@ -121,36 +111,6 @@ if ($action == 'updateMask') {
$error++; $error++;
} }
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha'); $text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) { if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
@ -163,26 +123,14 @@ if ($action == 'updateMask') {
} }
if ($action == 'setvarother') { if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
} }
$param_disable_email = GETPOST('TICKET_DISABLE_ALL_MAILS', 'alpha'); $param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_ALL_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_activate_log_by_email = GETPOST('TICKET_ACTIVATE_LOG_BY_EMAIL', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ACTIVATE_LOG_BY_EMAIL', $param_activate_log_by_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
} }
@ -242,9 +190,7 @@ $head = ticketAdminPrepareHead();
dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket"); dol_fiche_head($head, 'settings', $langs->trans("Module56000Name"), -1, "ticket");
print $langs->trans("TicketSetupDictionaries") . ' : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>'; print '<span class="opacitymedium">'.$langs->trans("TicketSetupDictionaries") . '</span> : <a href="' . dol_buildpath('/admin/dict.php', 1) . '" >' . dol_buildpath('/admin/dict.php', 2) . '</a><br>';
print $langs->trans("TicketPublicAccess") . ' : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
dol_fiche_end(); dol_fiche_end();
@ -353,80 +299,19 @@ if (!$conf->use_javascript_ajax) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">'; print '<input type="hidden" name="action" value="setvarother">';
} }
print load_fiche_titre($langs->trans("TicketParamPublicInterface"));
print '<table class="noborder" width="100%">';
// Activate public interface
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsActivatePublicInterface") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ENABLE_PUBLIC_INTERFACE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_ENABLE_PUBLIC_INTERFACE", $arrval, $conf->global->TICKET_ENABLE_PUBLIC_INTERFACE);
}
print '</td>';
print '<td class="center">';
print $form->textwithpicto('', $langs->trans("TicketsActivatePublicInterfaceHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
}*/
// Show logo for company
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
print load_fiche_titre($langs->trans("TicketParams")); print load_fiche_titre($langs->trans("TicketParams"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>' . $langs->trans("Parameter") . '</td>';
print '<td></td>';
print '<td></td>';
print "</tr>\n";
// Activate email notifications // Activate email notifications
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsDisableEmail") . '</td>'; /*
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableEmail") . '</td>';
print '<td class="left">'; print '<td class="left">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS'); print ajax_constantonoff('TICKET_DISABLE_ALL_MAILS');
@ -441,7 +326,7 @@ print '</td>';
print '</tr>'; print '</tr>';
// Activate log by email // Activate log by email
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLogEnableEmail") . '</td>'; print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<td class="left">'; print '<td class="left">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL'); print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
@ -454,11 +339,12 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/
// Also send to main email address // Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{ {
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>'; print '<tr class="oddeven"><td>' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<td class="left">'; print '<td class="left">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS'); print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
@ -474,7 +360,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
} }
// Limiter la vue des tickets à ceux assignés à l'utilisateur // Limiter la vue des tickets à ceux assignés à l'utilisateur
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>'; /*
print '<tr class="pair"><td>' . $langs->trans("TicketsLimitViewAssignedOnly") . '</td>';
print '<td class="left">'; print '<td class="left">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY'); print ajax_constantonoff('TICKET_LIMIT_VIEW_ASSIGNED_ONLY');
@ -487,14 +374,15 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketsLimitViewAssignedOnlyHelp"), 1, 'help');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/
if (!$conf->use_javascript_ajax) { /*if (!$conf->use_javascript_ajax) {
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>'; print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>'; print '</tr>';
} }*/
// Auto assign ticket at user who created it // Auto assign ticket at user who created it
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>'; print '<tr class="oddeven"><td>' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<td class="left">'; print '<td class="left">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
@ -515,7 +403,7 @@ if (!$conf->use_javascript_ajax) {
} }
// Admin var of module // Admin var of module
print load_fiche_titre($langs->trans("TicketParamMail")); print load_fiche_titre($langs->trans("Notification"));
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -533,17 +421,26 @@ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
print "</tr>\n"; print "</tr>\n";
} }
// Email d'envoi des notifications // Activate log by email
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>'; /*print '<tr class="pair"><td>' . $langs->trans("TicketsLogEnableEmail") . '</td>';
print '<td class="left">'; print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>'; if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_ACTIVATE_LOG_BY_EMAIL');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_ACTIVATE_LOG_BY_EMAIL", $arrval, $conf->global->TICKET_ACTIVATE_LOG_BY_EMAIL);
}
print '</td>';
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketsLogEnableEmailHelp"), 1, 'help');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
*/
// @TODO Use module notification instead...
// Email de réception des notifications // Email de réception des notifications
print '<tr class="pair"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>'; print '<tr class="oddeven"><td>' . $langs->trans("TicketEmailNotificationTo") . '</td>';
print '<td class="left">'; print '<td class="left">';
print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>'; print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_TO" value="' . (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) ? $conf->global->TICKET_NOTIFICATION_EMAIL_TO : $conf->global->TICKET_NOTIFICATION_EMAIL_FROM) . '" size="20" ></td>';
print '<td align="center">'; print '<td align="center">';
@ -551,21 +448,18 @@ print $form->textwithpicto('', $langs->trans("TicketEmailNotificationToHelp"), 1
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Texte de création d'un ticket // Email d'envoi des notifications
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody'); print '<tr class="oddeven"><td>' . $langs->trans("TicketEmailNotificationFrom") . '</td>';
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>'; print '<td class="left">';
print '</td><td>'; print '<input type="text" name="TICKET_NOTIFICATION_EMAIL_FROM" value="' . $conf->global->TICKET_NOTIFICATION_EMAIL_FROM . '" size="20" ></td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">'; print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketEmailNotificationFromHelp"), 1, 'help');
print '</td></tr>'; print '</td>';
print '</tr>';
// Texte d'introduction // Texte d'introduction
$mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText'); $mail_intro = $conf->global->TICKET_MESSAGE_MAIL_INTRO ? $conf->global->TICKET_MESSAGE_MAIL_INTRO : $langs->trans('TicketMessageMailIntroText');
print '<tr><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>'; print '<tr class="oddeven"><td>' . $langs->trans("TicketMessageMailIntroLabelAdmin") . '</label>';
print '</td><td>'; print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_INTRO', $mail_intro, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
@ -577,7 +471,7 @@ print '</td></tr>';
// Texte de signature // Texte de signature
$mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText'); $mail_signature = $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->trans('TicketMessageMailSignatureText');
print '<tr><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>'; print '<tr class="oddeven"><td>' . $langs->trans("TicketMessageMailSignatureLabelAdmin") . '</label>';
print '</td><td>'; print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70); $doleditor = new DolEditor('TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
@ -587,58 +481,12 @@ print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help'); print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelpAdmin"), 1, 'help');
print '</td></tr>'; print '</td></tr>';
print '<tr class="liste_titre">'; print '</table>';
print '<td colspan="3">' . $langs->trans("PublicInterface") . '</td>';
print "</tr>\n";
// Url public interface print '<div class="center">';
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE; print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>'; print '</div>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>';
// Texte d'accueil homepage
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte d'aide à la saisie du message
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>';
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
print '</table><br>';
print '</form>'; print '</form>';
// End of page // End of page

View File

@ -0,0 +1,453 @@
<?php
/* Copyright (C) 2013-2018 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file admin/ticket_public.php
* \ingroup ticket
* \brief Page to public interface of module Ticket
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/ticket.lib.php";
// Load translation files required by the page
$langs->loadLangs(array("admin", "ticket"));
// Access control
if (!$user->admin) {
accessforbidden();
}
// Parameters
$value = GETPOST('value', 'alpha');
$action = GETPOST('action', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'ticket';
if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE')
{
if (GETPOST('value')) dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 1, 'chaine', 0, '', $conf->entity);
else dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', 0, 'chaine', 0, '', $conf->entity);
}
if ($action == 'setvar') {
include_once DOL_DOCUMENT_ROOT . "/core/lib/files.lib.php";
$notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha');
if (!empty($notification_email)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
// altairis : differentiate notification email FROM and TO
$notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha');
if (!empty($notification_email_to)) {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_new_ticket = GETPOST('TICKET_MESSAGE_MAIL_NEW', 'alpha');
if (!empty($mail_new_ticket)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $mail_new_ticket, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_NEW', $langs->trans('TicketMessageMailNewText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'alpha');
if (!empty($mail_intro)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$url_interface = GETPOST('TICKET_URL_PUBLIC_INTERFACE', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', $url_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_URL_PUBLIC_INTERFACE', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$topic_interface = GETPOST('TICKET_PUBLIC_INTERFACE_TOPIC', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', $topic_interface, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_INTERFACE_TOPIC', '', 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_home = GETPOST('TICKET_PUBLIC_TEXT_HOME', 'alpha');
if (!empty($mail_signature)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $text_home, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HOME', $langs->trans('TicketPublicInterfaceTextHome'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
$text_help = GETPOST('TICKET_PUBLIC_TEXT_HELP_MESSAGE', 'alpha');
if (!empty($text_help)) {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $text_help, 'chaine', 0, '', $conf->entity);
} else {
$res = dolibarr_set_const($db, 'TICKET_PUBLIC_TEXT_HELP_MESSAGE', $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'), 'chaine', 0, '', $conf->entity);
}
if (!$res > 0) {
$error++;
}
}
if ($action == 'setvarother') {
$param_enable_public_interface = GETPOST('TICKET_ENABLE_PUBLIC_INTERFACE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_ENABLE_PUBLIC_INTERFACE', $param_enable_public_interface, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_disable_email = GETPOST('TICKET_DISABLE_CUSTOMER_MAILS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_DISABLE_CUSTOMER_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
$param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
$param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha');
$res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity);
if (!$res > 0) {
$error++;
}
}
/*
* View
*/
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
$form = new Form($db);
$help_url = "FR:Module_Ticket";
$page_name = "TicketSetup";
llxHeader('', $langs->trans($page_name), $help_url);
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
// Configuration header
$head = ticketAdminPrepareHead();
dol_fiche_head($head, 'public', $langs->trans("Module56000Name"), -1, "ticket");
print '<span class="opacitymedium">'.$langs->trans("TicketPublicAccess") . '</span> : <a href="' . dol_buildpath('/public/ticket/index.php', 1) . '" target="_blank" >' . dol_buildpath('/public/ticket/index.php', 2) . '</a>';
dol_fiche_end();
$enabledisablehtml = $langs->trans("TicketsActivatePublicInterface").' ';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
// Button off, click to enable
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=1'.$param.'">';
$enabledisablehtml.=img_picto($langs->trans("Disabled"), 'switch_off');
$enabledisablehtml.='</a>';
}
else
{
// Button on, click to disable
$enabledisablehtml.='<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setTICKET_ENABLE_PUBLIC_INTERFACE&value=0'.$param.'">';
$enabledisablehtml.=img_picto($langs->trans("Activated"), 'switch_on');
$enabledisablehtml.='</a>';
}
print $enabledisablehtml;
print '<input type="hidden" id="TICKET_ENABLE_PUBLIC_INTERFACE" name="TICKET_ENABLE_PUBLIC_INTERFACE" value="'.(empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)?0:1).'">';
print '<br><br>';
if (! empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
if (!$conf->use_javascript_ajax) {
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvarother">';
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Parameters") . '</td>';
print '<td class="left">';
print '</td>';
print '<td class="center">';
print '</td>';
print '</tr>';
// Check if email exists
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailMustExist") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_EMAIL_MUST_EXISTS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_EMAIL_MUST_EXISTS", $arrval, $conf->global->TICKET_EMAIL_MUST_EXISTS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailMustExistHelp"), 1, 'help');
print '</td>';
print '</tr>';
/*if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
// Show logo for module
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowModuleLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_MODULE_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_MODULE_LOGO", $arrval, $conf->global->TICKET_SHOW_MODULE_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowModuleLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
}*/
// Show logo for company
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsShowCompanyLogo") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_SHOW_COMPANY_LOGO');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_SHOW_COMPANY_LOGO", $arrval, $conf->global->TICKET_SHOW_COMPANY_LOGO);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsShowCompanyLogoHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsEmailAlsoSendToMainAddress") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS", $arrval, $conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsEmailAlsoSendToMainAddressHelp"), 1, 'help');
print '</td>';
print '</tr>';
}
if (!$conf->use_javascript_ajax) {
print '<tr class="impair"><td colspan="3" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
// Auto assign ticket at user who created it
print '<tr class="pair"><td width="70%">' . $langs->trans("TicketsAutoAssignTicket") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsAutoAssignTicketHelp"), 1, 'help');
print '</td>';
print '</tr>';
print '</table><br>';
if (!$conf->use_javascript_ajax) {
print '</form>';
}
// Admin var of module
print load_fiche_titre($langs->trans("TicketParamMail"));
print '<table class="noborder" width="100%">';
print '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" enctype="multipart/form-data" >';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="setvar">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans("Parameter") . '</td>';
print "</tr>\n";
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
print '<tr>';
print '<td colspan="3"><div class="info">' . $langs->trans("TicketCkEditorEmailNotActivated") . '</div></td>';
print "</tr>\n";
}
// Url public interface
$url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE;
print '<tr><td>' . $langs->trans("TicketUrlPublicInterfaceLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_URL_PUBLIC_INTERFACE" value="' . $conf->global->TICKET_URL_PUBLIC_INTERFACE . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help');
print '</td></tr>';
// Interface topic
$url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC;
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTopicLabelAdmin") . '</label>';
print '</td><td>';
print '<input type="text" name="TICKET_PUBLIC_INTERFACE_TOPIC" value="' . $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC . '" size="40" ></td>';
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help');
print '</td></tr>';
// Texte d'accueil homepage
$public_text_home = $conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans('TicketPublicInterfaceTextHome');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHomeLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HOME', $public_text_home, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHomeHelpAdmin"), 1, 'help');
print '</td></tr>';
// Texte d'aide à la saisie du message
$public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe');
print '<tr><td>' . $langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_PUBLIC_TEXT_HELP_MESSAGE', $public_text_help_message, '100%', 180, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTextHelpMessageHelpAdmin"), 1, 'help');
print '</td></tr>';
// Activate email creation to user
print '<tr class="pair"><td>' . $langs->trans("TicketsDisableCustomerEmail") . '</td>';
print '<td class="left">';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('TICKET_DISABLE_CUSTOMER_MAILS');
} else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("TICKET_DISABLE_CUSTOMER_MAILS", $arrval, $conf->global->TICKET_DISABLE_CUSTOMER_MAILS);
}
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketsDisableEmailHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Texte de création d'un ticket
$mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody');
print '<tr><td>' . $langs->trans("TicketNewEmailBodyLabel") . '</label>';
print '</td><td>';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
$doleditor = new DolEditor('TICKET_MESSAGE_MAIL_NEW', $mail_mesg_new, '100%', 120, 'dolibarr_mailings', '', false, true, $conf->global->FCKEDITOR_ENABLE_MAIL, ROWS_2, 70);
$doleditor->Create();
print '</td>';
print '<td align="center">';
print $form->textwithpicto('', $langs->trans("TicketNewEmailBodyHelp"), 1, 'help');
print '</td></tr>';
print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '"></div>';
print '</form>';
}
// End of page
llxFooter();
$db->close();

View File

@ -37,7 +37,7 @@ class DolibarrApi
/** /**
* @var Restler $r Restler object * @var Restler $r Restler object
*/ */
var $r; public $r;
/** /**
* Constructor * Constructor
@ -46,7 +46,7 @@ class DolibarrApi
* @param string $cachedir Cache dir * @param string $cachedir Cache dir
* @param boolean $refreshCache Update cache * @param boolean $refreshCache Update cache
*/ */
function __construct($db, $cachedir = '', $refreshCache = false) public function __construct($db, $cachedir = '', $refreshCache = false)
{ {
global $conf, $dolibarr_main_url_root; global $conf, $dolibarr_main_url_root;
@ -87,16 +87,16 @@ class DolibarrApi
); );
}*/ }*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
// Remove $db object property for object // Remove $db object property for object
unset($object->db); unset($object->db);
unset($object->isextrafieldmanaged); unset($object->isextrafieldmanaged);
@ -208,6 +208,7 @@ class DolibarrApi
return $object; return $object;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Check user access to a resource * Check user access to a resource
* *
@ -222,9 +223,9 @@ class DolibarrApi
* @return bool * @return bool
* @throws RestException * @throws RestException
*/ */
static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') protected static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid')
{ {
// phpcs:enable
// Features/modules to check // Features/modules to check
$featuresarray = array($resource); $featuresarray = array($resource);
if (preg_match('/&/', $resource)) { if (preg_match('/&/', $resource)) {
@ -240,16 +241,18 @@ class DolibarrApi
} }
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select); return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Return if a $sqlfilters parameter is valid * Return if a $sqlfilters parameter is valid
* *
* @param string $sqlfilters sqlfilter string * @param string $sqlfilters sqlfilter string
* @return boolean True if valid, False if not valid * @return boolean True if valid, False if not valid
*/ */
function _checkFilters($sqlfilters) protected function _checkFilters($sqlfilters)
{ {
// phpcs:enable
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; //$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
$tmp=$sqlfilters; $tmp=$sqlfilters;
@ -271,14 +274,15 @@ class DolibarrApi
return true; return true;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Function to forge a SQL criteria * Function to forge a SQL criteria
* *
* @param array $matches Array of found string by regex search * @param array $matches Array of found string by regex search
* @return string Forged criteria. Example: "t.field like 'abc%'" * @return string Forged criteria. Example: "t.field like 'abc%'"
*/ */
static function _forge_criteria_callback($matches) protected static function _forge_criteria_callback($matches)
{ {
// phpcs:enable // phpcs:enable
global $db; global $db;

View File

@ -173,20 +173,20 @@ class DolibarrApiAccess implements iAuthenticate
* @example Digest * @example Digest
* @example OAuth * @example OAuth
*/ */
public function __getWWWAuthenticateString() public function __getWWWAuthenticateString()
{ {
// phpcs:enable // phpcs:enable
return ''; return '';
} }
/** /**
* Verify access * Verify access
* *
* @param array $m Properties of method * @param array $m Properties of method
* *
* @access private * @access private
* @return bool * @return bool
*/ */
public static function verifyAccess(array $m) public static function verifyAccess(array $m)
{ {
$requires = isset($m['class']['DolibarrApiAccess']['properties']['requires']) $requires = isset($m['class']['DolibarrApiAccess']['properties']['requires'])

View File

@ -43,7 +43,7 @@ class Documents extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;
@ -67,7 +67,7 @@ class Documents extends DolibarrApi
* *
* @url GET /download * @url GET /download
*/ */
public function index($module_part, $original_file='') public function index($module_part, $original_file = '')
{ {
global $conf, $langs; global $conf, $langs;
@ -82,12 +82,11 @@ class Documents extends DolibarrApi
$entity=$conf->entity; $entity=$conf->entity;
$check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'read'); $check_access = dol_check_secure_access_document($module_part, $original_file, $entity, DolibarrApiAccess::$user, '', 'read');
$accessallowed = $check_access['accessallowed']; $accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file']; $original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
{
throw new RestException(401); throw new RestException(401);
} }
if (!$accessallowed) { if (!$accessallowed) {
@ -127,7 +126,7 @@ class Documents extends DolibarrApi
* *
* @url PUT /builddoc * @url PUT /builddoc
*/ */
public function builddoc($module_part, $original_file='', $doctemplate='', $langcode='') public function builddoc($module_part, $original_file = '', $doctemplate = '', $langcode = '')
{ {
global $conf, $langs; global $conf, $langs;
@ -153,7 +152,7 @@ class Documents extends DolibarrApi
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
$original_file = $check_access['original_file']; $original_file = $check_access['original_file'];
if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file)) { if (preg_match('/\.\./', $original_file) || preg_match('/[<>|]/', $original_file)) {
throw new RestException(401); throw new RestException(401);
} }
if (!$accessallowed) { if (!$accessallowed) {
@ -245,7 +244,7 @@ class Documents extends DolibarrApi
* *
* @url GET / * @url GET /
*/ */
function getDocumentsListByElement($modulepart, $id=0, $ref='', $sortfield='', $sortorder='') public function getDocumentsListByElement($modulepart, $id = 0, $ref = '', $sortfield = '', $sortorder = '')
{ {
global $conf; global $conf;
@ -275,7 +274,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id; $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id;
} }
else if ($modulepart == 'adherent' || $modulepart == 'member') elseif ($modulepart == 'adherent' || $modulepart == 'member')
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@ -291,7 +290,7 @@ class Documents extends DolibarrApi
$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');
} }
else if ($modulepart == 'propal' || $modulepart == 'proposal') elseif ($modulepart == 'propal' || $modulepart == 'proposal')
{ {
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
@ -307,7 +306,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal');
} }
else if ($modulepart == 'commande' || $modulepart == 'order') elseif ($modulepart == 'commande' || $modulepart == 'order')
{ {
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
@ -323,7 +322,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande'); $upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande');
} }
else if ($modulepart == 'shipment' || $modulepart == 'expedition') elseif ($modulepart == 'shipment' || $modulepart == 'expedition')
{ {
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
@ -339,7 +338,7 @@ class Documents extends DolibarrApi
$upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment'); $upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment');
} }
else if ($modulepart == 'facture' || $modulepart == 'invoice') elseif ($modulepart == 'facture' || $modulepart == 'invoice')
{ {
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
@ -355,7 +354,23 @@ class Documents extends DolibarrApi
$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
} }
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') elseif ($modulepart == 'produit' || $modulepart == 'product')
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (!DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}
$object = new Product($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
throw new RestException(404, 'Product not found');
}
$upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product');
}
elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{ {
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
@ -376,7 +391,7 @@ class Documents extends DolibarrApi
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
} }
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
if (empty($filearray)) { if (empty($filearray)) {
throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.'); throw new RestException(404, 'Search for modulepart '.$modulepart.' with Id '.$object->id.(! empty($object->Ref)?' or Ref '.$object->ref:'').' does not return any document.');
} }
@ -412,6 +427,7 @@ class Documents extends DolibarrApi
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided) * @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)
* @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'} * @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) {@example '' or 'base64'}
* @param int $overwriteifexists Overwrite file if exists (1 by default) * @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return string
* *
* @throws 200 * @throws 200
* @throws 400 * @throws 400
@ -421,7 +437,7 @@ class Documents extends DolibarrApi
* *
* @url POST /upload * @url POST /upload
*/ */
public function post($filename, $modulepart, $ref='', $subdir='', $filecontent='', $fileencoding='', $overwriteifexists=0) public function post($filename, $modulepart, $ref = '', $subdir = '', $filecontent = '', $fileencoding = '', $overwriteifexists = 0)
{ {
global $db, $conf; global $db, $conf;
@ -501,7 +517,7 @@ class Documents extends DolibarrApi
if($result == 0) if($result == 0)
{ {
throw new RestException(404, "Object with ref '".$ref."' was not found."); throw new RestException(404, "Object with ref '".$ref."' was not found.");
} }
elseif ($result < 0) elseif ($result < 0)
{ {
throw new RestException(500, 'Error while fetching object.'); throw new RestException(500, 'Error while fetching object.');
@ -576,6 +592,7 @@ class Documents extends DolibarrApi
return dol_basename($destfile); return dol_basename($destfile);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
@ -583,7 +600,9 @@ class Documents extends DolibarrApi
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate_file($data) { private function _validate_file($data)
{
// phpcs:enable
$result = array(); $result = array();
foreach (Documents::$DOCUMENT_FIELDS as $field) { foreach (Documents::$DOCUMENT_FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field]))

View File

@ -29,11 +29,11 @@ class Login
/** /**
* Constructor of the class * Constructor of the class
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;
} }
/** /**
* Login * Login
@ -136,5 +136,5 @@ class Login
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') 'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
) )
); );
} }
} }

View File

@ -38,7 +38,7 @@ class Setup extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db; global $db;
$this->db = $db; $this->db = $db;
@ -61,7 +61,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException * @throws 400 RestException
* @throws 200 OK * @throws 200 OK
*/ */
function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -76,7 +76,7 @@ class Setup extends DolibarrApi
{ {
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters); throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
} }
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
} }
@ -128,7 +128,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '') public function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -195,7 +195,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getCountryByID($id, $lang = '') public function getCountryByID($id, $lang = '')
{ {
$country = new Ccountry($this->db); $country = new Ccountry($this->db);
@ -228,7 +228,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException * @throws 400 RestException
* @throws 200 OK * @throws 200 OK
*/ */
function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -273,14 +273,16 @@ class Setup extends DolibarrApi
return $list; return $list;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
unset($object->error); unset($object->error);
@ -334,7 +336,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '') public function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -397,7 +399,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '') public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -442,7 +444,7 @@ class Setup extends DolibarrApi
return $list; return $list;
} }
/** /**
* Get the list of currencies. * Get the list of currencies.
* *
@ -458,10 +460,10 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
//TODO link with multicurrency module //TODO link with multicurrency module
$sql = "SELECT t.code_iso, t.label, t.unicode"; $sql = "SELECT t.code_iso, t.label, t.unicode";
$sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t";
$sql.= " WHERE t.active = ".$active; $sql.= " WHERE t.active = ".$active;
@ -516,7 +518,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '') public function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -595,7 +597,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '') public function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -659,7 +661,7 @@ class Setup extends DolibarrApi
* @throws 400 RestException * @throws 400 RestException
* @throws 200 OK * @throws 200 OK
*/ */
function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -720,7 +722,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
@ -780,13 +782,13 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
$sql = "SELECT rowid, code, pos, label, use_default, color, description"; $sql = "SELECT rowid, code, pos, label, use_default, color, description";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t";
$sql.= " WHERE t.active = ".$active; $sql.= " WHERE t.active = ".$active;
// Add sql filters // Add sql filters
if ($sqlfilters) if ($sqlfilters)
{ {
@ -840,13 +842,13 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '')
{ {
$list = array(); $list = array();
$sql = "SELECT rowid, code, pos, label, use_default, description"; $sql = "SELECT rowid, code, pos, label, use_default, description";
$sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_type as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_type as t";
$sql.= " WHERE t.active = ".$active; $sql.= " WHERE t.active = ".$active;
if ($type) $sql.=" AND t.type LIKE '%" . $this->db->escape($type) . "%'"; if ($type) $sql.=" AND t.type LIKE '%" . $this->db->escape($type) . "%'";
if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'"; if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'";
// Add sql filters // Add sql filters
@ -898,7 +900,7 @@ class Setup extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function getCheckIntegrity($target) public function getCheckIntegrity($target)
{ {
global $langs, $conf; global $langs, $conf;

View File

@ -31,7 +31,7 @@ class Status
* *
* @return array * @return array
*/ */
function index() public function index()
{ {
global $conf; global $conf;

View File

@ -23,8 +23,6 @@
*/ */
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/** /**
* Class for Asset * Class for Asset
@ -312,7 +310,7 @@ class Asset extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs; global $db, $conf, $langs;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -369,12 +367,12 @@ class Asset extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status * @return string Label of status
*/ */
function getLibStatut($mode = 0) public function getLibStatut($mode = 0)
{ {
return $this->LibStatut($this->status, $mode); return $this->LibStatut($this->status, $mode);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return the status * Return the status
* *
@ -382,7 +380,7 @@ class Asset extends CommonObject
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status * @return string Label of status
*/ */
static function LibStatut($status, $mode = 0) public static function LibStatut($status, $mode = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $langs;
@ -425,7 +423,7 @@ class Asset extends CommonObject
* @param int $id Id of order * @param int $id Id of order
* @return void * @return void
*/ */
function info($id) public function info($id)
{ {
$sql = 'SELECT rowid, date_creation as datec, tms as datem,'; $sql = 'SELECT rowid, date_creation as datec, tms as datem,';
$sql.= ' fk_user_creat, fk_user_modif'; $sql.= ' fk_user_creat, fk_user_modif';

View File

@ -76,7 +76,7 @@ class AssetType extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -89,8 +89,8 @@ class AssetType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
function create($user, $notrigger = 0) public function create($user, $notrigger = 0)
{ {
global $conf; global $conf;
$error=0; $error=0;
@ -157,7 +157,7 @@ class AssetType extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Met a jour en base donnees du type * Met a jour en base donnees du type
@ -166,7 +166,7 @@ class AssetType extends CommonObject
* @param int $notrigger 1=do not execute triggers, 0 otherwise * @param int $notrigger 1=do not execute triggers, 0 otherwise
* @return int >0 if OK, < 0 if KO * @return int >0 if OK, < 0 if KO
*/ */
function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $conf, $hookmanager; global $conf, $hookmanager;
@ -233,7 +233,7 @@ class AssetType extends CommonObject
* *
* @return int >0 if OK, 0 if not found, < 0 if KO * @return int >0 if OK, 0 if not found, < 0 if KO
*/ */
function delete() public function delete()
{ {
global $user; global $user;
@ -267,7 +267,7 @@ class AssetType extends CommonObject
* @param int $rowid Id of member type to load * @param int $rowid Id of member type to load
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid) public function fetch($rowid)
{ {
$sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note"; $sql = "SELECT d.rowid, d.label as label, d.accountancy_code_asset, d.accountancy_code_depreciation_asset, d.accountancy_code_depreciation_expense, d.note";
$sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."asset_type as d";
@ -282,13 +282,13 @@ class AssetType extends CommonObject
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->label = $obj->label; $this->label = $obj->label;
$this->accountancy_code_asset = $obj->accountancy_code_asset; $this->accountancy_code_asset = $obj->accountancy_code_asset;
$this->accountancy_code_depreciation_asset = $obj->accountancy_code_depreciation_asset; $this->accountancy_code_depreciation_asset = $obj->accountancy_code_depreciation_asset;
$this->accountancy_code_depreciation_expense = $obj->accountancy_code_depreciation_expense; $this->accountancy_code_depreciation_expense = $obj->accountancy_code_depreciation_expense;
$this->note = $obj->note; $this->note = $obj->note;
} }
return 1; return 1;
@ -300,13 +300,13 @@ class AssetType extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of asset's type * Return list of asset's type
* *
* @return array List of types of members * @return array List of types of members
*/ */
function liste_array() public function liste_array()
{ {
// phpcs:enable // phpcs:enable
global $conf,$langs; global $conf,$langs;
@ -350,7 +350,7 @@ class AssetType extends CommonObject
* 2=Return array of asset id only * 2=Return array of asset id only
* @return mixed Array of asset or -1 on error * @return mixed Array of asset or -1 on error
*/ */
function listAssetForAssetType($excludefilter = '', $mode = 0) public function listAssetForAssetType($excludefilter = '', $mode = 0)
{ {
global $conf, $user; global $conf, $user;
@ -405,7 +405,7 @@ class AssetType extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) public function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0)
{ {
global $langs; global $langs;
@ -430,8 +430,8 @@ class AssetType extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
// Initialize parameters // Initialize parameters
@ -446,15 +446,15 @@ class AssetType extends CommonObject
$this->asset=array( $this->asset=array(
$user->id => $user $user->id => $user
); );
} }
/** /**
* getLibStatut * getLibStatut
* *
* @return string Return status of a type of asset * @return string Return status of a type of asset
*/ */
function getLibStatut() public function getLibStatut()
{ {
return ''; return '';
} }
} }

View File

@ -53,7 +53,7 @@ class BlockedLogAuthority
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
/** /**
* Get the blockchain * Get the blockchain
@ -76,7 +76,7 @@ class BlockedLogAuthority
} }
return $this->blockchain; return $this->blockchain;
} }
/** /**
* Get hash of the block chain to check * Get hash of the block chain to check
@ -87,7 +87,7 @@ class BlockedLogAuthority
{ {
return md5($this->signature.$this->blockchain); return md5($this->signature.$this->blockchain);
} }
/** /**
* Get hash of the block chain to check * Get hash of the block chain to check
@ -99,7 +99,7 @@ class BlockedLogAuthority
{ {
return ($hash === $this->getBlockchainHash() ); return ($hash === $this->getBlockchainHash() );
} }
/** /**
* Add a new block to the chain * Add a new block to the chain
@ -111,7 +111,7 @@ class BlockedLogAuthority
{ {
$this->blockchain.=$block; $this->blockchain.=$block;
} }
/** /**
* hash already exist into chain ? * hash already exist into chain ?
@ -132,7 +132,7 @@ class BlockedLogAuthority
else{ else{
return false; return false;
} }
} }
/** /**
@ -191,7 +191,7 @@ class BlockedLogAuthority
$this->error=$this->db->error(); $this->error=$this->db->error();
return -1; return -1;
} }
} }
/** /**
* Create authority in database. * Create authority in database.
@ -245,7 +245,7 @@ class BlockedLogAuthority
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* Create authority in database. * Create authority in database.
@ -283,7 +283,7 @@ class BlockedLogAuthority
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
} }
/** /**
* For cron to sync to authority. * For cron to sync to authority.
@ -326,6 +326,6 @@ class BlockedLogAuthority
} }
} }
return 1; return 1;
} }
} }

View File

@ -291,8 +291,7 @@ class BlockedLog
} }
elseif ($this->action == 'MODULE_RESET') elseif ($this->action == 'MODULE_RESET')
{ {
if ($this->signature == '0000000000') if ($this->signature == '0000000000') {
{
return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>'; return '<i class="opacitymedium">System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken.</i>';
} }
else else
@ -387,14 +386,15 @@ class BlockedLog
$arrayoffieldstoexclude = array( $arrayoffieldstoexclude = array(
'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id', 'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id',
'table_element_line','ismultientitymanaged','isextrafieldmanaged', 'table_element_line','ismultientitymanaged','isextrafieldmanaged',
'linkedObjectsIds','linkedObjects','fk_delivery_address', 'linkedObjectsIds',
'linkedObjects',
'fk_delivery_address',
'context', 'context',
'projet' // There is already ->fk_project 'projet' // There is already ->fk_project
); );
// Add more fields to exclude depending on object type // Add more fields to exclude depending on object type
if ($this->element == 'cashcontrol') if ($this->element == 'cashcontrol') {
{ $arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
$arrayoffieldstoexclude = array_merge($arrayoffieldstoexclude, array(
'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code', 'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code',
'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2', 'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2',
'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id', 'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id',
@ -727,15 +727,12 @@ class BlockedLog
*/ */
public function dolDecodeBlockedData($data, $mode = 0) public function dolDecodeBlockedData($data, $mode = 0)
{ {
try try {
{
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
//include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$aaa = unserialize($data); $aaa = unserialize($data);
//$aaa = unserialize($data); //$aaa = unserialize($data);
} } catch(Exception $e) {
catch(Exception $e)
{
//print $e->getErrs); //print $e->getErrs);
} }
return $aaa; return $aaa;
@ -1064,14 +1061,14 @@ class BlockedLog
} }
/** /**
* Check if module was already used or not for at least one recording. * Check if module was already used or not for at least one recording.
* *
* @param int $ignoresystem Ignore system events for the test * @param int $ignoresystem Ignore system events for the test
* @return bool * @return bool
*/ */
function alreadyUsed($ignoresystem = 0) public function alreadyUsed($ignoresystem = 0)
{ {
global $conf; global $conf;
$result = false; $result = false;
@ -1092,5 +1089,5 @@ class BlockedLog
dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result); dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".$result);
return $result; return $result;
} }
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr> * Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -23,28 +24,14 @@
*/ */
// Load Dolibarr environment // Load Dolibarr environment
$res=0; require '../../main.inc.php';
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
global $langs, $user;
// Libraries // Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php"; require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once '../lib/bom.lib.php'; require_once '../lib/bom.lib.php';
//require_once "../class/myclass.class.php"; //require_once "../class/myclass.class.php";
// Translations // Translations
$langs->loadLangs(array("admin", "bom@bom")); $langs->loadLangs(array("admin", "mrp"));
// Access control // Access control
if (! $user->admin) accessforbidden(); if (! $user->admin) accessforbidden();
@ -62,11 +49,7 @@ $arrayofparameters=array(
/* /*
* Actions * Actions
*/ */
if ((float) DOL_VERSION >= 6) include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
{
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
}
/* /*
* View * View
@ -78,11 +61,11 @@ llxHeader('', $langs->trans($page_name));
// Subheader // Subheader
$linkback = '<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.($backtopage?$backtopage:DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom@bom'); print load_fiche_titre($langs->trans($page_name), $linkback, 'object_bom');
// Configuration header // Configuration header
$head = bomAdminPrepareHead(); $head = bomAdminPrepareHead();
dol_fiche_head($head, 'settings', '', -1, "bom@bom"); dol_fiche_head($head, 'settings', '', -1, "bom");
// Setup page goes here // Setup page goes here
echo $langs->trans("BomSetupPage").'<br><br>'; echo $langs->trans("BomSetupPage").'<br><br>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -17,53 +17,20 @@
*/ */
/** /**
* \file bom_card.php * \file htdocs/bom/bom_card.php
* \ingroup bom * \ingroup bom
* \brief Page to create/edit/view bom * \brief Page to create/edit/view bom
*/ */
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session). This include the NOIPCHECK too.
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("FORCECSP")) define('FORCECSP','none'); // Disable all Content Security Policies
// Load Dolibarr environment // Load Dolibarr environment
$res=0; require '../main.inc.php';
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
dol_include_once('/bom/class/bom.class.php'); require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
dol_include_once('/bom/lib/bom_bom.lib.php'); require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bom@bom","other")); $langs->loadLangs(array("mrp","other"));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
@ -75,7 +42,7 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects // Initialize technical objects
$object=new BillOfMaterials($db); $object=new BOM($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('bomcard', 'globalcard')); // Note that conf->hooks_modules contains array
@ -88,7 +55,7 @@ $search_all=trim(GETPOST("search_all", 'alpha'));
$search=array(); $search=array();
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha');
} }
if (empty($action) && empty($id) && empty($ref)) $action='view'; if (empty($action) && empty($id) && empty($ref)) $action='view';
@ -105,8 +72,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu
/* /*
* Actions * Actions
*
* Put here all code to do according to value of "action" parameter
*/ */
$parameters=array(); $parameters=array();
@ -115,29 +80,29 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
if (empty($reshook)) if (empty($reshook))
{ {
$error=0; $error=0;
$permissiontoadd = $user->rights->bom->write; $permissiontoadd = $user->rights->bom->write;
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0); $permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
$backurlforlist = dol_buildpath('/bom/bom_list.php', 1); $backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
if (empty($backtopage)) { if (empty($backtopage)) {
if (empty($id)) $backtopage = $backurlforlist; if (empty($id)) $backtopage = $backurlforlist;
else $backtopage = dol_buildpath('/bom/bom_card.php',1).($id > 0 ? $id : '__ID__'); else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id;
} }
$triggermodname = 'BILLOFMATERIALS_BILLOFMATERIALS_MODIFY'; // Name of trigger action code to execute when we modify record $triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, delete or clone // Actions cancel, add, update, delete or clone
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
// Actions when linking object each other // Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
// Actions when printing a doc from card // Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to send emails // Actions to send emails
$trigger_name='BILLOFMATERIALS_SENTBYMAIL'; $trigger_name='BOM_SENTBYMAIL';
$autocopy='MAIN_MAIL_AUTOCOPY_BILLOFMATERIALS_TO'; $autocopy='MAIN_MAIL_AUTOCOPY_BOM_TO';
$trackid='bom'.$object->id; $trackid='bom'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
} }
@ -154,7 +119,7 @@ if (empty($reshook))
$form=new Form($db); $form=new Form($db);
$formfile=new FormFile($db); $formfile=new FormFile($db);
llxHeader('', 'BillOfMaterials', ''); llxHeader('', 'NewBOM', '');
// Example : Adding jquery code // Example : Adding jquery code
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
@ -175,7 +140,7 @@ jQuery(document).ready(function() {
// Part to create // Part to create
if ($action == 'create') if ($action == 'create')
{ {
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("BillOfMaterials"))); print load_fiche_titre($langs->trans("NewBOM"));
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -243,7 +208,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$res = $object->fetch_optionals(); $res = $object->fetch_optionals();
$head = bomPrepareHead($object); $head = bomPrepareHead($object);
dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); dol_fiche_head($head, 'card', $langs->trans("BillOfMaterials"), -1, 'bom');
$formconfirm = ''; $formconfirm = '';
@ -257,7 +222,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'clone') { if ($action == 'clone') {
// Create an array for form // Create an array for form
$formquestion = array(); $formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneBillOfMaterials'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneBillOfMaterials', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
} }
// Confirmation of action xxxx // Confirmation of action xxxx

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -23,29 +23,16 @@
*/ */
// Load Dolibarr environment // Load Dolibarr environment
$res=0; require '../main.inc.php';
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
dol_include_once('/bom/class/bom.class.php'); require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
dol_include_once('/bom/lib/bom_bom.lib.php'); require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bom@bom","companies","other","mails")); $langs->loadLangs(array("mrp","companies","other","mails"));
$action=GETPOST('action', 'aZ09'); $action=GETPOST('action', 'aZ09');
@ -71,7 +58,7 @@ if (! $sortfield) $sortfield="name";
//if (! $sortfield) $sortfield="position_name"; //if (! $sortfield) $sortfield="position_name";
// Initialize technical objects // Initialize technical objects
$object=new BillOfMaterials($db); $object=new BOM($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('bomdocument', 'globalcard')); // Note that conf->hooks_modules contains array
@ -110,7 +97,7 @@ if ($object->id)
*/ */
$head = bomPrepareHead($object); $head = bomPrepareHead($object);
dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); dol_fiche_head($head, 'document', $langs->trans("BillOfMaterials"), -1, 'bom');
// Build file list // Build file list

View File

@ -17,52 +17,19 @@
*/ */
/** /**
* \file bom_list.php * \file htdocs/bom/bom_list.php
* \ingroup bom * \ingroup bom
* \brief List page for bom * \brief List page for bom
*/ */
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Do not create database handler $db
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Do not load object $user
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); // Do not load object $mysoc
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Do not load object $langs
//if (! defined('NOSCANGETFORINJECTION')) define('NOSCANGETFORINJECTION','1'); // Do not check injection attack on GET parameters
//if (! defined('NOSCANPOSTFORINJECTION')) define('NOSCANPOSTFORINJECTION','1'); // Do not check injection attack on POST parameters
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOIPCHECK')) define('NOIPCHECK','1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
//if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT','auto'); // Force lang to a particular value
//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE','aloginmodule'); // Force authentication handler
//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN',1); // The main.inc.php does not make a redirect if not logged, instead show simple error message
//if (! defined("XFRAMEOPTIONS_ALLOWALL")) define('XFRAMEOPTIONS_ALLOWALL',1); // Do not add the HTTP header 'X-Frame-Options: SAMEORIGIN' but 'X-Frame-Options: ALLOWALL'
// Load Dolibarr environment // Load Dolibarr environment
$res=0; require '../main.inc.php';
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/bom/class/bom.class.php'); require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bom@bom", "other")); $langs->loadLangs(array("mrp", "other"));
$action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $action = GETPOST('action', 'aZ09')?GETPOST('action', 'aZ09'):'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
@ -89,7 +56,7 @@ $pagenext = $page + 1;
//if (! $sortorder) $sortorder="DESC"; //if (! $sortorder) $sortorder="DESC";
// Initialize technical objects // Initialize technical objects
$object = new BillOfMaterials($db); $object = new BOM($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction = $conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('bomlist')); // Note that conf->hooks_modules contains array
@ -150,7 +117,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
* Actions * Actions
*/ */
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array(); $parameters=array();
@ -163,7 +130,7 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // 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 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
{ {
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
@ -179,7 +146,7 @@ if (empty($reshook))
} }
// Mass actions // Mass actions
$objectclass='BillOfMaterials'; $objectclass='BOM';
$objectlabel='BillOfMaterials'; $objectlabel='BillOfMaterials';
$permtoread = $user->rights->bom->read; $permtoread = $user->rights->bom->read;
$permtodelete = $user->rights->bom->delete; $permtodelete = $user->rights->bom->delete;
@ -199,7 +166,7 @@ $now=dol_now();
//$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials"; //$help_url="EN:Module_BillOfMaterials|FR:Module_BillOfMaterials_FR|ES:Módulo_BillOfMaterials";
$help_url=''; $help_url='';
$title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("BillOfMaterialss")); $title = $langs->trans('ListOfBOMs');
// Build and execute select // Build and execute select
@ -365,7 +332,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
// Add code for pre mass action (confirmation or email presend form) // Add code for pre mass action (confirmation or email presend form)
$topicmail="SendBillOfMaterialsRef"; $topicmail="SendBillOfMaterialsRef";
$modelmail="bom"; $modelmail="bom";
$objecttmp=new BillOfMaterials($db); $objecttmp=new BOM($db);
$trackid='xxxx'.$object->id; $trackid='xxxx'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
@ -408,6 +375,7 @@ foreach($object->fields as $key => $val)
$cssforfield=''; $cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>'; if (! empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($cssforfield?' '.$cssforfield:'').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
} }
@ -434,6 +402,7 @@ foreach($object->fields as $key => $val)
$cssforfield=''; $cssforfield='';
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (! empty($arrayfields['t.'.$key]['checked'])) if (! empty($arrayfields['t.'.$key]['checked']))
{ {
@ -478,19 +447,19 @@ while ($i < min($num, $limit))
if (isset($obj->$key)) $object->$key = $obj->$key; if (isset($obj->$key)) $object->$key = $obj->$key;
} }
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; print '<tr class="oddeven">';
foreach($object->fields as $key => $val) foreach($object->fields as $key => $val)
{ {
$cssforfield=''; $cssforfield='';
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield.=($cssforfield?' ':'').'center'; if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center'; elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap'; if (! empty($arrayfields['t.'.$key]['checked']))
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap'; {
if (! empty($arrayfields['t.'.$key]['checked']))
{
print '<td'; print '<td';
if ($cssforfield || $val['css']) print ' class="'; if ($cssforfield || $val['css']) print ' class="';
print $cssforfield; print $cssforfield;
@ -498,7 +467,9 @@ while ($i < min($num, $limit))
print $val['css']; print $val['css'];
if ($cssforfield || $val['css']) print '"'; if ($cssforfield || $val['css']) print '"';
print '>'; print '>';
print $object->showOutputField($val, $key, $obj->$key, ''); if ($key == 'status') print $object->getLibStatut(5);
elseif (in_array($val['type'], array('date','datetime','timestamp'))) print $object->showOutputField($val, $key, $db->jdate($obj->$key), '');
else print $object->showOutputField($val, $key, $obj->$key, '');
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
if (! empty($val['isameasure'])) if (! empty($val['isameasure']))
@ -506,8 +477,8 @@ while ($i < min($num, $limit))
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key;
$totalarray['val']['t.'.$key] += $obj->$key; $totalarray['val']['t.'.$key] += $obj->$key;
} }
} }
} }
// Extra fields // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook // Fields from hook

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email--- * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -23,25 +23,12 @@
*/ */
// Load Dolibarr environment // Load Dolibarr environment
$res=0; require '../main.inc.php';
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php';
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1;
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; }
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include substr($tmp, 0, ($i+1))."/main.inc.php";
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include dirname(substr($tmp, 0, ($i+1)))."/main.inc.php";
// Try main.inc.php using relative path
if (! $res && file_exists("../main.inc.php")) $res=@include "../main.inc.php";
if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php";
if (! $res && file_exists("../../../main.inc.php")) $res=@include "../../../main.inc.php";
if (! $res) die("Include of main fails");
dol_include_once('/bom/class/bom.class.php');
dol_include_once('/bom/lib/bom_bom.lib.php');
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bom@bom","companies")); $langs->loadLangs(array("mrp","companies"));
// Get parameters // Get parameters
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
@ -51,7 +38,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
// Initialize technical objects // Initialize technical objects
$object=new BillOfMaterials($db); $object=new BOM($db);
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id; $diroutputmassaction=$conf->bom->dir_output . '/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->hooks_modules contains array $hookmanager->initHooks(array('bomnote','globalcard')); // Note that conf->hooks_modules contains array
@ -95,7 +82,7 @@ if ($id > 0 || ! empty($ref))
$head = bomPrepareHead($object); $head = bomPrepareHead($object);
dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom@bom'); dol_fiche_head($head, 'note', $langs->trans("BillOfMaterials"), -1, 'bom');
// Object card // Object card
// ------------------------------------------------------------ // ------------------------------------------------------------

View File

@ -18,12 +18,11 @@
use Luracast\Restler\RestException; use Luracast\Restler\RestException;
dol_include_once('/bom/class/bom.class.php'); require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
/** /**
* \file bom/class/api_bom.class.php * \file bom/class/api_boms.class.php
* \ingroup bom * \ingroup bom
* \brief File for API management of bom. * \brief File for API management of bom.
*/ */
@ -31,36 +30,32 @@ dol_include_once('/bom/class/bom.class.php');
/** /**
* API class for bom bom * API class for bom bom
* *
* @smart-auto-routing false
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
*/ */
class BillOfMaterialsApi extends DolibarrApi class BOMs extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'name', 'label'
); );
/** /**
* @var BillOfMaterials $bom {@type BillOfMaterials} * @var BOM $bom {@type BOM}
*/ */
public $bom; public $bom;
/** /**
* Constructor * Constructor
*
* @url GET /
*
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
$this->bom = new BillOfMaterials($this->db); $this->bom = new BOM($this->db);
} }
/** /**
@ -71,10 +66,10 @@ class BillOfMaterialsApi extends DolibarrApi
* @param int $id ID of bom * @param int $id ID of bom
* @return array|mixed data without useless information * @return array|mixed data without useless information
* *
* @url GET boms/{id} * @url GET {id}
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->bom->read) { if(! DolibarrApiAccess::$user->rights->bom->read) {
throw new RestException(401); throw new RestException(401);
@ -82,7 +77,7 @@ class BillOfMaterialsApi extends DolibarrApi
$result = $this->bom->fetch($id); $result = $this->bom->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found'); throw new RestException(404, 'BOM not found');
} }
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
@ -106,10 +101,8 @@ class BillOfMaterialsApi extends DolibarrApi
* @return array Array of order objects * @return array Array of order objects
* *
* @throws RestException * @throws RestException
*
* @url GET /boms/
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -134,7 +127,7 @@ class BillOfMaterialsApi extends DolibarrApi
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
$tmpobject = new BillOfMaterials($db); $tmpobject = new BOM($db);
if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')'; if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')';
if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid; if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid;
@ -169,11 +162,12 @@ class BillOfMaterialsApi extends DolibarrApi
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$bom_static = new BillOfMaterials($db); $bom_static = new BOM($db);
if($bom_static->fetch($obj->rowid)) { if ($bom_static->fetch($obj->rowid)) {
$obj_ret[] = $this->_cleanObjectDatas($bom_static); $obj_ret[] = $this->_cleanObjectDatas($bom_static);
} }
$i++; $i++;
@ -193,10 +187,8 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @param array $request_data Request datas * @param array $request_data Request datas
* @return int ID of bom * @return int ID of bom
*
* @url POST boms/
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->bom->create) { if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401); throw new RestException(401);
@ -208,7 +200,7 @@ class BillOfMaterialsApi extends DolibarrApi
$this->bom->$field = $value; $this->bom->$field = $value;
} }
if( ! $this->bom->create(DolibarrApiAccess::$user)) { if( ! $this->bom->create(DolibarrApiAccess::$user)) {
throw new RestException(500); throw new RestException(500, "Error creating BOM", array_merge(array($this->bom->error), $this->bom->errors));
} }
return $this->bom->id; return $this->bom->id;
} }
@ -218,11 +210,10 @@ class BillOfMaterialsApi extends DolibarrApi
* *
* @param int $id Id of bom to update * @param int $id Id of bom to update
* @param array $request_data Datas * @param array $request_data Datas
* @return int
* *
* @url PUT boms/{id} * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->bom->create) { if(! DolibarrApiAccess::$user->rights->bom->create) {
throw new RestException(401); throw new RestException(401);
@ -230,7 +221,7 @@ class BillOfMaterialsApi extends DolibarrApi
$result = $this->bom->fetch($id); $result = $this->bom->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'BillOfMaterials not found'); throw new RestException(404, 'BOM not found');
} }
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
@ -238,59 +229,64 @@ class BillOfMaterialsApi extends DolibarrApi
} }
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
if ($field == 'id') continue;
$this->bom->$field = $value; $this->bom->$field = $value;
} }
if($this->bom->update($id, DolibarrApiAccess::$user)) if($this->bom->update($id, DolibarrApiAccess::$user) > 0)
{
return $this->get($id); return $this->get($id);
}
return false; else
{
throw new RestException(500, $this->commande->error);
}
} }
/** /**
* Delete bom * Delete bom
* *
* @param int $id BillOfMaterials ID * @param int $id BOM ID
* @return array * @return array
*
* @url DELETE bom/{id}
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->bom->delete) { if (! DolibarrApiAccess::$user->rights->bom->delete) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->bom->fetch($id); $result = $this->bom->fetch($id);
if( ! $result ) { if (! $result) {
throw new RestException(404, 'BillOfMaterials not found'); throw new RestException(404, 'BOM not found');
} }
if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( !$this->bom->delete(DolibarrApiAccess::$user, 0)) if (! $this->bom->delete(DolibarrApiAccess::$user))
{ {
throw new RestException(500); throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error);
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'message' => 'BillOfMaterials deleted' 'message' => 'BOM deleted'
) )
); );
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param object $object Object to clean * @param object $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
/*unset($object->note); /*unset($object->note);
@ -306,15 +302,15 @@ class BillOfMaterialsApi extends DolibarrApi
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
* @param array $data Data to validate * @param array $data Array of data to validate
* @return array * @return array
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$bom = array(); $bom = array();
foreach (BillOfMaterialsApi::$FIELDS as $field) { foreach (BOMs::$FIELDS as $field) {
if (!isset($data[$field])) if (!isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$bom[$field] = $data[$field]; $bom[$field] = $data[$field];

View File

@ -1,6 +1,5 @@
<?php <?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,7 +18,7 @@
/** /**
* \file class/bom.class.php * \file class/bom.class.php
* \ingroup bom * \ingroup bom
* \brief This file is a CRUD class file for BillOfMaterials (Create/Read/Update/Delete) * \brief This file is a CRUD class file for BOM (Create/Read/Update/Delete)
*/ */
// Put here all includes required by your class file // Put here all includes required by your class file
@ -28,9 +27,9 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
/** /**
* Class for BillOfMaterials * Class for BOM
*/ */
class BillOfMaterials extends CommonObject class BOM extends CommonObject
{ {
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object
@ -45,7 +44,7 @@ class BillOfMaterials extends CommonObject
/** /**
* @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int Does bom support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/ */
public $ismultientitymanaged = 0; public $ismultientitymanaged = 1;
/** /**
* @var int Does bom support extrafields ? 0=No, 1=Yes * @var int Does bom support extrafields ? 0=No, 1=Yes
@ -55,14 +54,22 @@ class BillOfMaterials extends CommonObject
/** /**
* @var string String with name of icon for bom. Must be the part after the 'object_' into object_bom.png * @var string String with name of icon for bom. Must be the part after the 'object_' into object_bom.png
*/ */
public $picto = 'bom@bom'; public $picto = 'bom';
public $table_element_line = 'bom_bomline';
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;
const STATUS_DISABLED = -1;
/** /**
* 'type' if the field format. * 'type' if the field format.
* 'label' the translation key. * 'label' the translation key.
* 'enabled' is a condition when the field must be managed. * 'enabled' is a condition when the field must be managed.
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing) * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'default' is a default value for creation (can still be replaced by the global setup of default values) * 'default' is a default value for creation (can still be replaced by the global setup of default values)
* 'index' if we want an index in database. * 'index' if we want an index in database.
@ -83,19 +90,21 @@ class BillOfMaterials extends CommonObject
*/ */
public $fields=array( public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>'1',), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'1',),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>61, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>62, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>500, 'notnull'=>1,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',), 'date_valid' => array('type'=>'datetime', 'label'=>'DateValid', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
'fk_user_creat' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'llx_user.rowid',),
'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,), 'fk_user_modif' => array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'fk_user_valid' => array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>512, 'notnull'=>0,),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'position'=>1000, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Actif', '-1'=>'Inactif')), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1,), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'isameasure'=>'1',), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1',),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'notnull'=>1, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Enabled', '-1'=>'Disabled')),
); );
public $rowid; public $rowid;
public $ref; public $ref;
@ -114,7 +123,6 @@ class BillOfMaterials extends CommonObject
// END MODULEBUILDER PROPERTIES // END MODULEBUILDER PROPERTIES
// If this object has a subtable with lines // If this object has a subtable with lines
/** /**
@ -276,14 +284,14 @@ class BillOfMaterials extends CommonObject
* *
* @return int <0 if KO, 0 if not found, >0 if OK * @return int <0 if KO, 0 if not found, >0 if OK
*/ */
/*public function fetchLines() public function fetchLines()
{ {
$this->lines=array(); $this->lines=array();
// Load lines with object BillOfMaterialsLine // Load lines with object BOMLine
return count($this->lines)?1:0; return count($this->lines)?1:0;
}*/ }
/** /**
* Load list of objects in memory from the database. * Load list of objects in memory from the database.
@ -388,6 +396,189 @@ class BillOfMaterials extends CommonObject
//return $this->deleteCommon($user, $notrigger, 1); //return $this->deleteCommon($user, $notrigger, 1);
} }
/**
* Validate bom
*
* @param User $user User making status change
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <=0 if OK, 0=Nothing done, >0 if KO
*/
public function valid($user, $notrigger = 0)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error=0;
// Protection
if ($this->statut == self::STATUS_VALIDATED)
{
dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
return 0;
}
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->create))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
{
$this->error='NotEnoughPermissions';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
return -1;
}*/
$now=dol_now();
$this->db->begin();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef();
}
else
{
$num = $this->ref;
}
$this->newref = $num;
// Validate
$sql = "UPDATE ".MAIN_DB_PREFIX."bom_bom";
$sql.= " SET ref = '".$this->db->escape($num)."',";
$sql.= " status = ".self::STATUS_VALIDATED.",";
$sql.= " date_valid='".$this->db->idate($now)."',";
$sql.= " fk_user_valid = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::valid()", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
dol_print_error($this->db);
$this->error=$this->db->lasterror();
$error++;
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BOM_VALIDATE', $user);
if ($result < 0) $error++;
// End call triggers
}
if (! $error)
{
$this->oldref = $this->ref;
// Rename directory if dir was a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
{
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
// in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->bom->dir_output.'/'.$oldref;
$dirdest = $conf->bom->dir_output.'/'.$newref;
if (file_exists($dirsource))
{
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest))
{
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles=dol_dir_list($conf->bom->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
foreach($listoffiles as $fileentry)
{
$dirsource=$fileentry['name'];
$dirdest=preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
$dirsource=$fileentry['path'].'/'.$dirsource;
$dirdest=$fileentry['path'].'/'.$dirdest;
@rename($dirsource, $dirdest);
}
}
}
}
}
// Set new ref and current status
if (! $error)
{
$this->ref = $num;
$this->status = self::STATUS_VALIDATED;
}
if (! $error)
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
return -1;
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set draft status
*
* @param User $user Object user that modify
* @return int <0 if KO, >0 if OK
*/
public function setDraft($user)
{
//phpcs:enable
global $conf,$langs;
$error=0;
// Protection
if ($this->status <= self::STATUS_DRAFT)
{
return 0;
}
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
{
$this->error='Permission denied';
return -1;
}*/
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."bom";
$sql.= " SET status = ".self::STATUS_DRAFT;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::setDraft", LOG_DEBUG);
if ($this->db->query($sql))
{
if (!$error) {
// Call trigger
$result=$this->call_trigger('BOM_UNVALIDATE', $user);
if ($result < 0) $error++;
}
if (!$error) {
$this->status=self::STATUS_DRAFT;
$this->db->commit();
return 1;
}else {
$this->db->rollback();
return -1;
}
}
else
{
$this->error=$this->db->error();
$this->db->rollback();
return -1;
}
}
/** /**
* Return a link to the object card (with optionaly the picto) * Return a link to the object card (with optionaly the picto)
* *
@ -398,7 +589,7 @@ class BillOfMaterials extends CommonObject
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
@ -487,7 +678,7 @@ class BillOfMaterials extends CommonObject
if (empty($this->labelstatus)) if (empty($this->labelstatus))
{ {
global $langs; global $langs;
//$langs->load("bom"); //$langs->load("mrp");
$this->labelstatus[1] = $langs->trans('Enabled'); $this->labelstatus[1] = $langs->trans('Enabled');
$this->labelstatus[0] = $langs->trans('Disabled'); $this->labelstatus[0] = $langs->trans('Disabled');
} }
@ -588,7 +779,8 @@ class BillOfMaterials extends CommonObject
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
$this->initAsSpecimenCommon(); $this->initAsSpecimenCommon();
$this->date = $this->date_creation;
} }
@ -625,9 +817,9 @@ class BillOfMaterials extends CommonObject
/** /**
* Class for BillOfMaterialsLine * Class for BOMLine
*/ */
class BillOfMaterialsLine extends CommonObject class BOMLine extends CommonObject
{ {
/** /**
* @var string ID to identify managed object * @var string ID to identify managed object
@ -850,24 +1042,10 @@ class BillOfMaterialsLine extends CommonObject
public function fetch($id, $ref = null) public function fetch($id, $ref = null)
{ {
$result = $this->fetchCommon($id, $ref); $result = $this->fetchCommon($id, $ref);
if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); //if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines();
return $result; return $result;
} }
/**
* Load object lines in memory from the database
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
/*public function fetchLines()
{
$this->lines=array();
// Load lines with object BillOfMaterialsLineLine
return count($this->lines)?1:0;
}*/
/** /**
* Load list of objects in memory from the database. * Load list of objects in memory from the database.
* *
@ -979,11 +1157,11 @@ class BillOfMaterialsLine extends CommonObject
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @param string $morecss Add more css on link * @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 $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
{ {
global $db, $conf, $langs, $hookmanager; global $db, $conf, $langs, $hookmanager;
global $dolibarr_main_authentication, $dolibarr_main_demo; global $dolibarr_main_authentication, $dolibarr_main_demo;
global $menumanager; global $menumanager;
@ -995,7 +1173,7 @@ class BillOfMaterialsLine extends CommonObject
$label.= '<br>'; $label.= '<br>';
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; $label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
$url = dol_buildpath('/bom/bomline_card.php',1).'?id='.$this->id; $url = dol_buildpath('/bom/bomline_card.php', 1).'?id='.$this->id;
if ($option != 'nolink') if ($option != 'nolink')
{ {
@ -1043,7 +1221,7 @@ class BillOfMaterialsLine extends CommonObject
else $result .= $hookmanager->resPrint; else $result .= $hookmanager->resPrint;
return $result; return $result;
} }
/** /**
* Return label of the status * Return label of the status
@ -1070,7 +1248,7 @@ class BillOfMaterialsLine extends CommonObject
if (empty($this->labelstatus)) if (empty($this->labelstatus))
{ {
global $langs; global $langs;
//$langs->load("bom"); //$langs->load("mrp");
$this->labelstatus[1] = $langs->trans('Enabled'); $this->labelstatus[1] = $langs->trans('Enabled');
$this->labelstatus[0] = $langs->trans('Disabled'); $this->labelstatus[0] = $langs->trans('Disabled');
} }
@ -1179,7 +1357,7 @@ class BillOfMaterialsLine extends CommonObject
* Action executed by scheduler * Action executed by scheduler
* CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters' * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
* *
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/ */
//public function doScheduledJob($param1, $param2, ...) //public function doScheduledJob($param1, $param2, ...)
public function doScheduledJob() public function doScheduledJob()

View File

@ -1,5 +1,6 @@
<?php <?php
/* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr> /* Copyright (C) 2019 Maxime Kohlhaas <maxime@atm-consulting.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,7 +17,7 @@
*/ */
/** /**
* \file bom/lib/bom.lib.php * \file htdocs/bom/lib/bom.lib.php
* \ingroup bom * \ingroup bom
* \brief Library files with common functions for BillOfMaterials * \brief Library files with common functions for BillOfMaterials
*/ */
@ -30,17 +31,17 @@ function bomAdminPrepareHead()
{ {
global $langs, $conf; global $langs, $conf;
$langs->load("bom@bom"); $langs->load("mrp");
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath("/bom/admin/setup.php", 1); $head[$h][0] = DOL_URL_ROOT."/admin/bom.php";
$head[$h][1] = $langs->trans("Settings"); $head[$h][1] = $langs->trans("Settings");
$head[$h][2] = 'settings'; $head[$h][2] = 'settings';
$h++; $h++;
/*$head[$h][0] = dol_buildpath("/bom/admin/about.php", 1); /*$head[$h][0] = DOL_URL_ROOT."/bom/admin/about.php";
$head[$h][1] = $langs->trans("About"); $head[$h][1] = $langs->trans("About");
$head[$h][2] = 'about'; $head[$h][2] = 'about';
$h++; $h++;
@ -72,12 +73,12 @@ function bomPrepareHead($object)
{ {
global $db, $langs, $conf; global $db, $langs, $conf;
$langs->load("bom@bom"); $langs->load("mrp");
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = dol_buildpath("/bom/bom_card.php", 1).'?id='.$object->id; $head[$h][0] = DOL_URL_ROOT."/bom/bom_card.php?id=".$object->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
@ -87,7 +88,7 @@ function bomPrepareHead($object)
$nbNote = 0; $nbNote = 0;
if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_private)) $nbNote++;
if (!empty($object->note_public)) $nbNote++; if (!empty($object->note_public)) $nbNote++;
$head[$h][0] = dol_buildpath('/bom/bom_note.php', 1).'?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/bom/bom_note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note'; $head[$h][2] = 'note';
@ -99,13 +100,13 @@ function bomPrepareHead($object)
$upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->bom->dir_output . "/bom/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id); $nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = dol_buildpath("/bom/bom_document.php", 1).'?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/bom/bom_document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
$head[$h][2] = 'document'; $head[$h][2] = 'document';
$h++; $h++;
$head[$h][0] = dol_buildpath("/bom/bom_agenda.php", 1).'?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/bom/bom_agenda.php?id='.$object->id;
$head[$h][1] = $langs->trans("Events"); $head[$h][1] = $langs->trans("Events");
$head[$h][2] = 'agenda'; $head[$h][2] = 'agenda';
$h++; $h++;
@ -118,7 +119,7 @@ function bomPrepareHead($object)
//$this->tabs = array( //$this->tabs = array(
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__' // 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to remove a tab //); // to remove a tab
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@bom'); complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom');
return $head; return $head;
} }

View File

@ -82,7 +82,7 @@ class Bookmark extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -93,7 +93,7 @@ class Bookmark extends CommonObject
* @param int $id Bookmark Id Loader * @param int $id Bookmark Id Loader
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id) public function fetch($id)
{ {
global $conf; global $conf;
@ -135,7 +135,7 @@ class Bookmark extends CommonObject
* *
* @return int <0 si ko, rowid du bookmark cree si ok * @return int <0 si ko, rowid du bookmark cree si ok
*/ */
function create() public function create()
{ {
global $conf; global $conf;
@ -192,7 +192,7 @@ class Bookmark extends CommonObject
* *
* @return int <0 if KO, > if OK * @return int <0 if KO, > if OK
*/ */
function update() public function update()
{ {
// Clean parameters // Clean parameters
$this->url=trim($this->url); $this->url=trim($this->url);
@ -227,7 +227,7 @@ class Bookmark extends CommonObject
* @param int $id Id removed bookmark * @param int $id Id removed bookmark
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function remove($id) public function remove($id)
{ {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE rowid = ".$id; $sql .= " WHERE rowid = ".$id;
@ -268,7 +268,7 @@ class Bookmark extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status * @return string Label of contact status
*/ */
function getLibStatut($mode) public function getLibStatut($mode)
{ {
return ''; return '';
} }

View File

@ -60,7 +60,7 @@ class Auth
* @param string $aPasswd Password * @param string $aPasswd Password
* @return void * @return void
*/ */
function passwd($aPasswd) public function passwd($aPasswd)
{ {
$this->passwd = $aPasswd; $this->passwd = $aPasswd;
} }

View File

@ -53,7 +53,7 @@ class Categories extends DolibarrApi
/** /**
* Constructor * Constructor
*/ */
function __construct() public function __construct()
{ {
global $db, $conf; global $db, $conf;
$this->db = $db; $this->db = $db;
@ -70,7 +70,7 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function get($id) public function get($id)
{ {
if (! DolibarrApiAccess::$user->rights->categorie->lire) { if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401); throw new RestException(401);
@ -103,7 +103,7 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '') public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '')
{ {
global $db, $conf; global $db, $conf;
@ -173,7 +173,7 @@ class Categories extends DolibarrApi
* @param array $request_data Request data * @param array $request_data Request data
* @return int ID of category * @return int ID of category
*/ */
function post($request_data = null) public function post($request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->categorie->creer) { if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401); throw new RestException(401);
@ -198,7 +198,7 @@ class Categories extends DolibarrApi
* @param array $request_data Datas * @param array $request_data Datas
* @return int * @return int
*/ */
function put($id, $request_data = null) public function put($id, $request_data = null)
{ {
if(! DolibarrApiAccess::$user->rights->categorie->creer) { if(! DolibarrApiAccess::$user->rights->categorie->creer) {
throw new RestException(401); throw new RestException(401);
@ -234,7 +234,7 @@ class Categories extends DolibarrApi
* @param int $id Category ID * @param int $id Category ID
* @return array * @return array
*/ */
function delete($id) public function delete($id)
{ {
if(! DolibarrApiAccess::$user->rights->categorie->supprimer) { if(! DolibarrApiAccess::$user->rights->categorie->supprimer) {
throw new RestException(401); throw new RestException(401);
@ -261,15 +261,16 @@ class Categories extends DolibarrApi
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Clean sensible object datas * Clean sensible object datas
* *
* @param Categorie $object Object to clean * @param Categorie $object Object to clean
* @return array Array of cleaned object properties * @return array Array of cleaned object properties
*/ */
function _cleanObjectDatas($object) protected function _cleanObjectDatas($object)
{ {
// phpcs:enable
$object = parent::_cleanObjectDatas($object); $object = parent::_cleanObjectDatas($object);
// Remove fields not relevent to categories // Remove fields not relevent to categories
@ -324,7 +325,7 @@ class Categories extends DolibarrApi
* *
* @throws RestException * @throws RestException
*/ */
function _validate($data) private function _validate($data)
{ {
$category = array(); $category = array();
foreach (Categories::$FIELDS as $field) { foreach (Categories::$FIELDS as $field) {

View File

@ -10,7 +10,7 @@
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com> * Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -107,7 +107,7 @@ class Categorie extends CommonObject
'account' => 'account', // old for bank_account 'account' => 'account', // old for bank_account
'bank_account' => 'account', 'bank_account' => 'account',
'project' => 'project', 'project' => 'project',
); );
/** /**
* @var array Category tables mapping from type string * @var array Category tables mapping from type string
@ -221,7 +221,7 @@ class Categorie extends CommonObject
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -234,7 +234,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', '...') or (0, 1, ...) * @param string $type Type of category ('product', '...') or (0, 1, ...)
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id, $label = '', $type = null) public function fetch($id, $label = '', $type = null)
{ {
global $conf; global $conf;
@ -297,15 +297,15 @@ class Categorie extends CommonObject
} }
/** /**
* Add category into database * Add category into database
* *
* @param User $user Object user * @param User $user Object user
* @return int -1 : SQL error * @return int -1 : SQL error
* -2 : new ID unknown * -2 : new ID unknown
* -3 : Invalid category * -3 : Invalid category
* -4 : category already exists * -4 : category already exists
*/ */
function create($user) public function create($user)
{ {
global $conf,$langs,$hookmanager; global $conf,$langs,$hookmanager;
$langs->load('categories'); $langs->load('categories');
@ -426,7 +426,7 @@ class Categorie extends CommonObject
* -1 : SQL error * -1 : SQL error
* -2 : invalid category * -2 : invalid category
*/ */
function update(User $user) public function update(User $user)
{ {
global $conf, $langs,$hookmanager; global $conf, $langs,$hookmanager;
@ -501,7 +501,7 @@ class Categorie extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 KO >0 OK * @return int <0 KO >0 OK
*/ */
function delete($user, $notrigger = 0) public function delete($user, $notrigger = 0)
{ {
global $conf,$langs; global $conf,$langs;
@ -580,7 +580,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Link an object to the category * Link an object to the category
* *
@ -588,7 +588,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('product', ...) * @param string $type Type of category ('product', ...)
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/ */
function add_type($obj, $type) public function add_type($obj, $type)
{ {
// phpcs:enable // phpcs:enable
global $user,$langs,$conf; global $user,$langs,$conf;
@ -682,7 +682,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Delete object from category * Delete object from category
* *
@ -691,7 +691,7 @@ class Categorie extends CommonObject
* *
* @return int 1 if OK, -1 if KO * @return int 1 if OK, -1 if KO
*/ */
function del_type($obj, $type) public function del_type($obj, $type)
{ {
// phpcs:enable // phpcs:enable
global $user,$langs,$conf; global $user,$langs,$conf;
@ -747,9 +747,9 @@ class Categorie extends CommonObject
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @param int $onlyids Return only ids of objects (consume less memory) * @param int $onlyids Return only ids of objects (consume less memory)
* @return array|int -1 if KO, array of instance of object if OK * @return array|int -1 if KO, array of instance of object if OK
* @see containsObject * @see containsObject()
*/ */
function getObjectsInCateg($type, $onlyids = 0) public function getObjectsInCateg($type, $onlyids = 0)
{ {
$objs = array(); $objs = array();
@ -794,9 +794,9 @@ class Categorie extends CommonObject
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @param int $object_id Id of the object to search * @param int $object_id Id of the object to search
* @return int Number of occurrences * @return int Number of occurrences
* @see getObjectsInCateg * @see getObjectsInCateg()
*/ */
function containsObject($type, $object_id) public function containsObject($type, $object_id)
{ {
$sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type]; $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id; $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id;
@ -821,7 +821,7 @@ class Categorie extends CommonObject
* @param int $page Page number * @param int $page Page number
* @return array|int Array of categories, 0 if no cat, -1 on error * @return array|int Array of categories, 0 if no cat, -1 on error
*/ */
function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{ {
global $conf; global $conf;
@ -907,13 +907,13 @@ class Categorie extends CommonObject
return $categories; return $categories;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return childs of a category * Return childs of a category
* *
* @return array|int <0 KO, array ok * @return array|int <0 KO, array ok
*/ */
function get_filles() public function get_filles()
{ {
// phpcs:enable // phpcs:enable
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
@ -974,7 +974,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Rebuilding the category tree as an array * Rebuilding the category tree as an array
* Return an array of table('id','id_mere',...) trie selon arbre et avec: * Return an array of table('id','id_mere',...) trie selon arbre et avec:
@ -990,7 +990,7 @@ class Categorie extends CommonObject
* *
* @return array|int Array of categories. this->cats and this->motherof are set, -1 on error * @return array|int Array of categories. this->cats and this->motherof are set, -1 on error
*/ */
function get_full_arbo($type, $markafterid = 0) public function get_full_arbo($type, $markafterid = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf, $langs; global $conf, $langs;
@ -1068,7 +1068,7 @@ class Categorie extends CommonObject
return $this->cats; return $this->cats;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* For category id_categ and its childs available in this->cats, define property fullpath and fulllabel * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel
* *
@ -1076,10 +1076,10 @@ class Categorie extends CommonObject
* @param int $protection Deep counter to avoid infinite loop * @param int $protection Deep counter to avoid infinite loop
* @return void * @return void
*/ */
function build_path_from_id_categ($id_categ, $protection = 1000) public function build_path_from_id_categ($id_categ, $protection = 1000)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG);
if (! empty($this->cats[$id_categ]['fullpath'])) if (! empty($this->cats[$id_categ]['fullpath']))
{ {
@ -1109,16 +1109,16 @@ class Categorie extends CommonObject
// We count number of _ to have level // We count number of _ to have level
$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i', '', $this->cats[$id_categ]['fullpath'])); $this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i', '', $this->cats[$id_categ]['fullpath']));
return; return;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Display content of $this->cats * Display content of $this->cats
* *
* @return void * @return void
*/ */
function debug_cats() public function debug_cats()
{ {
// phpcs:enable // phpcs:enable
// Display $this->cats // Display $this->cats
@ -1135,7 +1135,7 @@ class Categorie extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns all categories * Returns all categories
* *
@ -1143,7 +1143,7 @@ class Categorie extends CommonObject
* @param boolean $parent Just parent categories if true * @param boolean $parent Just parent categories if true
* @return array|int Table of Object Category, -1 on error * @return array|int Table of Object Category, -1 on error
*/ */
function get_all_categories($type = null, $parent = false) public function get_all_categories($type = null, $parent = false)
{ {
// phpcs:enable // phpcs:enable
if (! is_numeric($type)) $type = $this->MAP_ID[$type]; if (! is_numeric($type)) $type = $this->MAP_ID[$type];
@ -1174,13 +1174,13 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Check if no category with same label already exists for this cat's parent or root and for this cat's type * Check if no category with same label already exists for this cat's parent or root and for this cat's type
* *
* @return integer 1 if already exist, 0 otherwise, -1 if error * @return integer 1 if already exist, 0 otherwise, -1 if error
*/ */
function already_exists() public function already_exists()
{ {
// phpcs:enable // phpcs:enable
$type=$this->type; $type=$this->type;
@ -1225,20 +1225,20 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns the top level categories (which are not girls) * Returns the top level categories (which are not girls)
* *
* @param int $type Type of category (0, 1, ...) * @param int $type Type of category (0, 1, ...)
* @return array * @return array
*/ */
function get_main_categories($type = null) public function get_main_categories($type = null)
{ {
// phpcs:enable // phpcs:enable
return $this->get_all_categories($type, true); return $this->get_all_categories($type, true);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns the path of the category, with the names of the categories * Returns the path of the category, with the names of the categories
* separated by $sep (" >> " by default) * separated by $sep (" >> " by default)
@ -1248,7 +1248,7 @@ class Categorie extends CommonObject
* @param int $nocolor 0 * @param int $nocolor 0
* @return array * @return array
*/ */
function print_all_ways($sep = " &gt;&gt; ", $url = '', $nocolor = 0) public function print_all_ways($sep = " &gt;&gt; ", $url = '', $nocolor = 0)
{ {
// phpcs:enable // phpcs:enable
$ways = array(); $ways = array();
@ -1297,13 +1297,13 @@ class Categorie extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns an array containing the list of parent categories * Returns an array containing the list of parent categories
* *
* @return int|array <0 KO, array OK * @return int|array <0 KO, array OK
*/ */
function get_meres() public function get_meres()
{ {
// phpcs:enable // phpcs:enable
$parents = array(); $parents = array();
@ -1333,14 +1333,14 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Returns in a table all possible paths to get to the category * Returns in a table all possible paths to get to the category
* starting with the major categories represented by Tables of categories * starting with the major categories represented by Tables of categories
* *
* @return array * @return array
*/ */
function get_all_ways() public function get_all_ways()
{ {
// phpcs:enable // phpcs:enable
$ways = array(); $ways = array();
@ -1374,9 +1374,9 @@ class Categorie extends CommonObject
* @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...) * @param string|int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category * @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs * labels, 'id'= Get array of category IDs
* @return array|int Array of category objects or < 0 if KO * @return Categorie[]|int Array of category objects or < 0 if KO
*/ */
function containing($id, $type, $mode = 'object') public function containing($id, $type, $mode = 'object')
{ {
$cats = array(); $cats = array();
@ -1456,9 +1456,9 @@ class Categorie extends CommonObject
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated. * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param boolean $exact Exact string search (true/false) * @param boolean $exact Exact string search (true/false)
* @param boolean $case Case sensitive (true/false) * @param boolean $case Case sensitive (true/false)
* @return array|int Array of category id, -1 if error * @return Categorie[]|int Array of Categorie, -1 if error
*/ */
function rechercher($id, $nom, $type, $exact = false, $case = false) public function rechercher($id, $nom, $type, $exact = false, $case = false)
{ {
// Deprecation warning // Deprecation warning
if (is_numeric($type)) { if (is_numeric($type)) {
@ -1467,15 +1467,15 @@ class Categorie extends CommonObject
$cats = array(); $cats = array();
// For backward compatibility // For backward compatibility
if (is_numeric($type)) { if (is_numeric($type)) {
// We want to reverse lookup // We want to reverse lookup
$map_type = array_flip($this->MAP_ID); $map_type = array_flip($this->MAP_ID);
$type = $map_type[$type]; $type = $map_type[$type];
dol_syslog(get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", LOG_WARNING); dol_syslog(get_class($this) . "::rechercher(): numeric types are deprecated, please use string instead", LOG_WARNING);
} }
// Generation requete recherche // Generation requete recherche
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie"; $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie";
$sql .= " WHERE type = " . $this->MAP_ID[$type]; $sql .= " WHERE type = " . $this->MAP_ID[$type];
$sql .= " AND entity IN (" . getEntity('category') . ")"; $sql .= " AND entity IN (" . getEntity('category') . ")";
@ -1521,7 +1521,7 @@ class Categorie extends CommonObject
* @param int $maxlength Max length of text * @param int $maxlength Max length of text
* @return string Chaine avec URL * @return string Chaine avec URL
*/ */
function getNomUrl($withpicto = 0, $option = '', $maxlength = 0) public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0)
{ {
global $langs; global $langs;
@ -1548,7 +1548,7 @@ class Categorie extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Deplace fichier uploade sous le nom $files dans le repertoire sdir * Deplace fichier uploade sous le nom $files dans le repertoire sdir
* *
@ -1556,7 +1556,7 @@ class Categorie extends CommonObject
* @param string $file Nom du fichier uploade * @param string $file Nom du fichier uploade
* @return void * @return void
*/ */
function add_photo($sdir, $file) public function add_photo($sdir, $file)
{ {
// phpcs:enable // phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1599,7 +1599,7 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return tableau de toutes les photos de la categorie * Return tableau de toutes les photos de la categorie
* *
@ -1607,7 +1607,7 @@ class Categorie extends CommonObject
* @param int $nbmax Nombre maximum de photos (0=pas de max) * @param int $nbmax Nombre maximum de photos (0=pas de max)
* @return array Tableau de photos * @return array Tableau de photos
*/ */
function liste_photos($dir, $nbmax = 0) public function liste_photos($dir, $nbmax = 0)
{ {
// phpcs:enable // phpcs:enable
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
@ -1656,14 +1656,14 @@ class Categorie extends CommonObject
return $tabobj; return $tabobj;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Efface la photo de la categorie et sa vignette * Efface la photo de la categorie et sa vignette
* *
* @param string $file Path to file * @param string $file Path to file
* @return void * @return void
*/ */
function delete_photo($file) public function delete_photo($file)
{ {
// phpcs:enable // phpcs:enable
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1686,14 +1686,14 @@ class Categorie extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load size of image file * Load size of image file
* *
* @param string $file Path to file * @param string $file Path to file
* @return void * @return void
*/ */
function get_image_size($file) public function get_image_size($file)
{ {
// phpcs:enable // phpcs:enable
$infoImg = getimagesize($file); // Recuperation des infos de l'image $infoImg = getimagesize($file); // Recuperation des infos de l'image
@ -1708,7 +1708,7 @@ class Categorie extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setMultiLangs($user) public function setMultiLangs($user)
{ {
global $langs; global $langs;
@ -1789,7 +1789,7 @@ class Categorie extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function getMultiLangs() public function getMultiLangs()
{ {
global $langs; global $langs;
@ -1828,7 +1828,7 @@ class Categorie extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of contact status * @return string Label of contact status
*/ */
function getLibStatut($mode) public function getLibStatut($mode)
{ {
return ''; return '';
} }
@ -1841,7 +1841,7 @@ class Categorie extends CommonObject
* *
* @return void * @return void
*/ */
function initAsSpecimen() public function initAsSpecimen()
{ {
dol_syslog(get_class($this)."::initAsSpecimen"); dol_syslog(get_class($this)."::initAsSpecimen");
@ -1855,20 +1855,20 @@ class Categorie extends CommonObject
$this->type = self::TYPE_PRODUCT; $this->type = self::TYPE_PRODUCT;
} }
/** /**
* Function used to replace a thirdparty id with another one. * Function used to replace a thirdparty id with another one.
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id * @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id * @param int $dest_id New thirdparty id
* @return bool * @return bool
*/ */
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{ {
$tables = array( $tables = array(
'categorie_societe' 'categorie_societe'
); );
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1);
} }
} }

Some files were not shown because too many files have changed in this diff Show More