diff --git a/ChangeLog b/ChangeLog index 4b97d3a6b89..31ddbd56bdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,8 +11,32 @@ Following changes may create regression for some external modules, but were nece * The trigger USER_SETINGROUP and USER_REMOVEFROMGROUP has been replaced with trigger USER_MODIFY. * The page societe/soc.php was renamed into societe/card.php to match page naming conventions. * The page compta/facture.php was renamed into compta/facture/card.php to match page naming conventions. +* The signature of method ->delete() of class Product and PriceExpression was changed from + ->delete($id, notrigger) to ->delete(User, notrigger) to match standard dev rules. +***** ChangeLog for 5.0.1 compared to 5.0.0 ***** +FIX: #6503: SQL error in "Last pending payment invoices" +FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled +FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access +FIX: #6533 #6590 +FIX: #6535 +FIX: bank account not visible on payment card +FIX: colspan +FIX: Data lost during merge of thirdparties +FIX: Detection of color brightness +FIX: Filter on date lost after submit on time spent page +FIX: forgottent fk_unit field on llx_supplier_propaldet +FIX: list of projects +FIX: LOG_ERROR does not exists. Use LOG_ERR. +FIX: Missing total on project overview. +FIX: multicurrency management on supplier order/invoice +FIX: Notification sending was broken. +FIX: origin & origin id on supplier order line +FIX: param php doc +FIX: Picto of project on dol_banner and box +FIX: Some errors when downloading files. + ***** ChangeLog for 5.0.0 compared to 4.0.* ***** For users: NEW: Add module mulicurrency. @@ -165,6 +189,42 @@ Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful o feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. +***** ChangeLog for 4.0.5 to 4.0.4 ***** +FIX: #6234 +FIX: #6259 +FIX: #6330 +FIX: #6360 +FIX: #6411 +FIX: #6443 +FIX: #6444 +FIX: #6453 +FIX: #6503: SQL error in "Last pending payment invoices" +FIX: #6505 Project elements page shows greyed-out links even if the option to show actions not available is disabled +FIX: #6507: Statistics counter show wrong total Contract numbers when the user does not have full access +FIX: #6533 #6590 +FIX: #6619 Template invoices list do not respect restricted thirdparty user rights +FIX: #6621 Documents tab shows greyed out upload form even if the option to show actions not available is disabled +FIX: add entity param to document link +FIX: Can use quote into supplier ref on order line add +FIX: Change the customer code only if error on duplicate +FIX: Creation of credit note on invoice with deposit stole the discount. +FIX: delete bank class lines when we delete bank_categ +FIX: deletion of bank tag +FIX: detail of deposit and credit not was not visible into final invoice +FIX: Error management during bank account creation +FIX: error management in bank account deletion. +FIX: event status is not modified when assign an user +FIX: forgotten fk_facture_fourn attribute on supplierinvoice line object +FIX: If bank module on, field must be required to register payment of expense report. +FIX: load multicurrency informations on supplier order and bill lines fetch +FIX: Missing total on project overview. +FIX: multicurrency_subprice +FIX: param billed when we change page +FIX: protection against infinite loop on hierarchy +FIX: Supplier Order list filter by project +FIX: the dolCopyDir fails if target dir does not exists. +FIX: use param for http links + ***** ChangeLog for 4.0.4 to 4.0.3 ***** FIX: #6227 Document models table header "Unit" is shown in 2 lines in Spanish FIX: #6230 diff --git a/build/debian/control b/build/debian/control index 75ffb43b2c0..970f192f094 100755 --- a/build/debian/control +++ b/build/debian/control @@ -10,12 +10,13 @@ Build-Depends: debhelper (>= 9), po-debconf Package: dolibarr Architecture: all -Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5, - php5-cli, +# For debian 7 or 8 or 9 +Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | php5 | libapache2-mod-php | libapache2-mod-phpfilter | php-cgi | php-fpm | php, + php5-cli | php-cli, # Required PHP extensions - php5-mysql | php5-mysqli, php5-curl, php5-gd, php5-ldap, + php5-mysql | php5-mysqli | php-mysql | php-mysqli, php5-curl | php-curl, php5-gd | php-gd, php5-ldap | php-gd, # Required PHP libraries - php-pear, php-mail-mime, + php-pear, php-mail-mime, # php-tcpdf, # libfpdf-tpl-php, php-fpdf, # libphp-adodb, @@ -30,7 +31,9 @@ Depends: libapache2-mod-php5 | libapache2-mod-php5filter | php5-cgi | php5-fpm | ${misc:Depends}, ${perl:Depends} Recommends: apache2 | lighttpd | httpd, - mariadb-server | virtual-mysql-server + mariadb-server | virtual-mysql-server, +# Required PHP extensions for debian 9 but we can't add them into a Depends, it does not exists on debian 7 and 8 + php-xml, php-mbstring Suggests: www-browser, php5-geoip Description: Web based software to manage a company or foundation Dolibarr ERP & CRM is an easy to use open source/free software package for diff --git a/build/debian/dolibarr.postinst b/build/debian/dolibarr.postinst index 4b946fda433..6ee2a89931f 100644 --- a/build/debian/dolibarr.postinst +++ b/build/debian/dolibarr.postinst @@ -61,7 +61,7 @@ apache_install() { # Enable dolibarr conf if which a2enconf >/dev/null 2>&1 ;then # a2enconf exists for ubuntu only - echo "Enable link for Apache config file with a3enconf" + echo "Enable link for Apache config file with a2enconf" a2enconf dolibarr else if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then diff --git a/build/debian/install.forced.php.install b/build/debian/install.forced.php.install index 56eef3287a6..e55ffae138e 100644 --- a/build/debian/install.forced.php.install +++ b/build/debian/install.forced.php.install @@ -7,7 +7,7 @@ // $force_install_packager='deb'; -$force_install_noedit=2; +$force_install_noedit=1; $force_install_message='KeepDefaultValuesDeb'; #$force_install_main_data_root='/usr/share/dolibarr/documents'; $force_install_main_data_root='/var/lib/dolibarr/documents'; diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index d287afe4b86..b1282719cda 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -509,7 +509,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`; # Removed known external modules to avoid any error when packaging from env where external modules are tested - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom/*`; # For custom we want to keep dir + #$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \;`; # For custom we want to keep dir $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`; @@ -550,6 +550,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/doc`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/example`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mike42/escpos-php/test`; + $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/mobiledetect/mobiledetectlib/.gitmodules`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`; diff --git a/dev/skeletons/README.md b/dev/skeletons/README.md new file mode 100644 index 00000000000..68fe9c093fb --- /dev/null +++ b/dev/skeletons/README.md @@ -0,0 +1 @@ +Files and tools were moved into htdocs/modulebuilder/skeletons \ No newline at end of file diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index f566938d7e0..bb3430eb22c 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -300,6 +300,8 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^BoxTitleLatest/', $value)) $qualifiedforclean=0; // install.lang if (preg_match('/^KeepDefaultValues/', $value)) $qualifiedforclean=0; + // mail.lang + if (preg_match('/MailingModuleDesc/i', $value)) $qualifiedforclean=0; // main.lang if (preg_match('/^Duration/', $value)) $qualifiedforclean=0; if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 4e05b019d08..7f909cd2f13 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -242,20 +242,8 @@ if ($resql) print '
'; print ''."\n"; - print ''; - - 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.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.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder); - 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); - 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="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - // Line for search fields - print ''; + print ''; if (! empty($arrayfields['aa.account_number']['checked'])) print ''; if (! empty($arrayfields['aa.label']['checked'])) print ''; if (! empty($arrayfields['aa.account_parent']['checked'])) print ''; @@ -268,8 +256,16 @@ if ($resql) print ''; print ''; - $var = false; - + print ''; + 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.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.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'],$_SERVER["PHP_SELF"],'aa.pcg_type','',$param,'',$sortfield,$sortorder); + 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); + 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 "\n"; + $accountstatic = new AccountingAccount($db); $accountparent = new AccountingAccount($db); @@ -281,7 +277,7 @@ if ($resql) $accountstatic->label = $obj->label; $accountstatic->account_number = $obj->account_number; - print ''; + print ''; // Account number if (! empty($arrayfields['aa.account_number']['checked'])) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 75d3be10444..0b4aa70e548 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -901,8 +901,8 @@ if ($id) if ($id == 4) print ''; print ''; print ''; print ''; @@ -911,11 +911,9 @@ if ($id) // Lines with values while ($i < $num) { - $var = ! $var; - $obj = $db->fetch_object($resql); //print_r($obj); - print ''; + print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { print ''; @@ -1198,14 +1196,13 @@ else { if ($showemptyline) { - $var=!$var; - print ''; + print ''; $showemptyline=0; } - $var=!$var; + $value=$tabname[$i]; - print ''; + print ''; print ''; print ''; print ''; // Title line with search boxes - print ''; + print ''; $filterfound=0; foreach ($fieldlist as $field => $value) { @@ -831,25 +831,25 @@ if ($id) } if ($id == 4) print ''; print ''; - print ''; + print ''; + print ''; - print ''; + print ''; if ($num) { // Lines with values while ($i < $num) { - $var = ! $var; - $obj = $db->fetch_object($resql); //print_r($obj); - print ''; + print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { $tmpaction='edit'; @@ -860,7 +860,9 @@ if ($id) // Show fields if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); - print ''; + print ''; + print ''; print '\n"; if (! empty($user->admin)) { // TO DO Mutualize code for yes/no constants - $var = ! $var; - print ""; + print ''; print ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { print ''; - $var = ! $var; - print ""; + print ''; print ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; - $var = ! $var; - print ""; + print ''; print ''; if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { print ''; - $var = ! $var; - print ""; + print ''; print ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { print ''; + print ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; @@ -305,7 +299,7 @@ print '
transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")); +print '
'.$langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")).'
'; print '
'; print ''; diff --git a/htdocs/accountancy/admin/journal.php b/htdocs/accountancy/admin/journal.php index 2a868969c3d..8e19a3e3e87 100644 --- a/htdocs/accountancy/admin/journal.php +++ b/htdocs/accountancy/admin/journal.php @@ -125,9 +125,8 @@ print '
'; print "\n"; foreach ( $list as $key ) { - $var = ! $var; - print ''; + print ''; // Param $label = $langs->trans($key); @@ -167,8 +166,6 @@ if ($resql) { while ( $i < $numr ) { $objp = $db->fetch_object($resql); - $var = ! $var; - $bankaccountstatic->rowid = $objp->rowid; $bankaccountstatic->id = $objp->rowid; $bankaccountstatic->ref = $objp->ref; @@ -177,7 +174,7 @@ if ($resql) { $bankaccountstatic->account_number = $objp->account_number; $bankaccountstatic->accountancy_journal = $objp->accountancy_journal; - print ''; + print ''; // Param print '"; print "\n"; - $var = true; $r = ''; $expensereportstatic = new ExpenseReport($db); @@ -468,7 +467,7 @@ if (empty($action) || $action == 'view') { $accountingaccount->fetch(null, $k, true); if ($mt) { - print ""; + print ''; print ""; print ""; print ""; @@ -494,7 +493,7 @@ if (empty($action) || $action == 'view') { // VAT foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { - print ""; + print ''; print ""; print ""; print ""; @@ -512,7 +511,7 @@ if (empty($action) || $action == 'view') { print ""; } } - print ""; + print ''; // Third party foreach ( $tabttc[$key] as $k => $mt ) { @@ -534,8 +533,6 @@ if (empty($action) || $action == 'view') { print '"; } print ""; - - $var = ! $var; } print "
'; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; + $searchpicto=$form->showFilterAndCheckAddButtons(0); + print $searchpicto; print '
   
   
'; + print '
'; if (! empty($tabcond[$i])) { print ''.$langs->trans($tablib[$i]).''; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 85c342992c0..19c33d848c8 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -146,8 +146,7 @@ if ($action == 'display' || $action == 'delete') { if (is_array($accountingcategory->lines_display) && count($accountingcategory->lines_display) > 0) { foreach ( $accountingcategory->lines_display as $cpt ) { - $var = ! $var; - print '
' . length_accountg($cpt->account_number) . '' . $cpt->label . ''; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 3a775149987..0580a9688ed 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -806,7 +806,7 @@ if ($id) print '
'; + print ''; if ($filterfound) { $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; } print '
'; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 08ce543c525..4b733bee5a6 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -135,9 +135,8 @@ print ''; print ''; foreach ( $list_account as $key ) { - $var = ! $var; - print ''; + print ''; // Param $label = $langs->trans($key); print ''; diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 9e57830b94d..eaf69f34f1f 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -130,7 +130,7 @@ print ''; print ''; print ''; -dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron'); +dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'cron'); $var = true; @@ -148,9 +148,8 @@ $var = ! $var; $num = count($main_option); if ($num) { foreach ( $main_option as $key ) { - $var = ! $var; - print ''; + print ''; // Param $label = $langs->trans($key); @@ -178,7 +177,7 @@ print ''; $var = ! $var; -print ''; +print ''; print ''; if (! $conf->use_javascript_ajax) { print ''; } - print ''; + print ''; print ''; if (! $conf->use_javascript_ajax) { print '"; - foreach ( $model_option as $key ) { - $var = ! $var; - - print ''; + foreach ( $model_option as $key ) { + print ''; // Param $label = $langs->trans($key); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 4b2b57ee7db..507a68a3c01 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -125,7 +125,7 @@ if ($result) { while ( $i < $num && $i < $max ) { $obj = $db->fetch_object($result); $fiscalyearstatic->id = $obj->rowid; - print ''; + print ''; print ''; print ''; print ''; @@ -136,7 +136,7 @@ if ($result) { $i ++; } } else { - print ''; + print ''; } print '
' . $label . '
' . $langs->trans("Selectmodelcsv") . ''; @@ -212,7 +211,7 @@ if ($num2) { print '
' . $langs->trans('OptionsDeactivatedForThisExportModel') . '
' . $langs->trans("Selectformat") . ''; @@ -230,10 +229,8 @@ if ($num2) { } print "
' . img_object($langs->trans("ShowFiscalYear"), "technic") . ' ' . $obj->rowid . '' . $obj->label . '' . dol_print_date($db->jdate($obj->date_start), 'day') . '
' . $langs->trans("None") . '
' . $langs->trans("None") . '
'; } else { diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 99b491688cb..4a6c82cb581 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -145,8 +145,7 @@ if ($result) { $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); - $var = ! $var; - print ''; + print '
'; print $objp->accounting; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index e6bae2f73d8..899aaa1a3d2 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -171,7 +171,7 @@ print ''; print ''; print ''; -dol_fiche_head($head, 'general', $langs->trans("Configuration"), 0, 'cron'); +dol_fiche_head($head, 'general', $langs->trans("Configuration"), -1, 'cron'); // Default mode for calculating turnover (parameter ACCOUNTING_MODE) @@ -214,8 +214,7 @@ print "
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; @@ -228,8 +227,7 @@ if (! empty($user->admin)) } print '
' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; @@ -242,8 +240,7 @@ if (! empty($user->admin)) } print '
' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; @@ -256,8 +253,7 @@ if (! empty($user->admin)) } print '
' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; @@ -275,9 +271,7 @@ if (! empty($user->admin)) // Param a user $user->rights->accountancy->chartofaccount can access foreach ($list as $key) { - $var = ! $var; - - print '
' . $langs->trans('Journaux') . '
" . $langs->trans("Credit") . "
" . $date . "" . $expensereportstatic->getNomUrl(1) . "
" . $date . "" . $expensereportstatic->getNomUrl(1) . "
' . ($mt >= 0 ? price($mt) : '') . "
"; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 9790d124d56..a00fc9a70d8 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -498,7 +498,6 @@ if (empty($action) || $action == 'view') { print "" . $langs->trans("Type") . "" . $langs->trans("Debit") . "" . $langs->trans("Credit") . ""; print "\n"; - $var = true; $r = ''; $invoicestatic = new FactureFournisseur($db); @@ -521,7 +520,7 @@ if (empty($action) || $action == 'view') { $accountingaccount->fetch(null, $k, true); if ($mt) { - print ""; + print ''; print ""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; @@ -545,7 +544,7 @@ if (empty($action) || $action == 'view') { // VAT foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { - print ""; + print ''; print ""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; @@ -563,7 +562,7 @@ if (empty($action) || $action == 'view') { print ""; } } - print ""; + print ''; // Third party foreach ( $tabttc[$key] as $k => $mt ) { @@ -588,8 +587,6 @@ if (empty($action) || $action == 'view') { print '' . ($mt >= 0 ? price($mt) : '') . ""; } print ""; - - $var = ! $var; } print ""; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index fc3a511d670..235af8eeb41 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -517,7 +517,6 @@ if (empty($action) || $action == 'view') { print "" . $langs->trans("Credit") . ""; print "\n"; - $var = true; $r = ''; $invoicestatic = new Facture($db); @@ -532,7 +531,7 @@ if (empty($action) || $action == 'view') { // Third party foreach ( $tabttc[$key] as $k => $mt ) { - print ""; + print ''; print ""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; @@ -562,7 +561,7 @@ if (empty($action) || $action == 'view') { $accountingaccount->fetch(null, $k, true); if ($mt) { - print ""; + print ''; print ""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; @@ -585,7 +584,7 @@ if (empty($action) || $action == 'view') { // VAT foreach ( $tabtva[$key] as $k => $mt ) { if ($mt) { - print ""; + print ''; print ""; print "" . $date . ""; print "" . $invoicestatic->getNomUrl(1) . ""; @@ -604,8 +603,6 @@ if (empty($action) || $action == 'view') { print ""; } } - - $var = ! $var; } print ""; diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index 317b7193ff3..a487cb641ff 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -127,7 +127,6 @@ if (!empty($cats)) $position = -1; $code = -1; foreach($cpts as $i => $cpt){ - $var = ! $var; $position = $cpt['position']; $code = $cpt['code']; @@ -149,7 +148,7 @@ if (!empty($cats)) } $sommes[$code]['NP'] += $resultNP; $sommes[$code]['N'] += $resultN; - print ''; + print ''; print '' . $cpt['account_number'] . ''; print '' . $cpt['name_cpt'] . ''; print '' . price($resultNP) . ''; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 02b7a6aee59..b7c5979aa7a 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -76,7 +76,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) { /* * View */ -llxHeader("", $langs->trans(FicheVentilation)); +llxHeader("", $langs->trans('FicheVentilation')); if ($cancel == $langs->trans("Cancel")) { $action = ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index a747342a508..2d36399c9b5 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -215,8 +215,7 @@ if ($resql) { while ( $row = $db->fetch_row($resql)) { - $var = ! $var; - print '' . length_accountg($row[0]) . ''; + print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; for($i = 2; $i <= 12; $i ++) { print '' . price($row[$i]) . ''; @@ -270,8 +269,7 @@ if ($resql) { while ( $row = $db->fetch_row($resql)) { - $var = ! $var; - print '' . length_accountg($row[0]) . ''; + print '' . length_accountg($row[0]) . ''; print '' . $row[1] . ''; for($i = 2; $i <= 12; $i ++) { print '' . price($row[$i]) . ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 121ba0e9f46..1f0d06fbec6 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -239,21 +239,7 @@ if ($result) { print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); - //print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre('', '', '', '', '', 'align="center"'); - print "\n"; - - print ''; + print ''; print ''; print ''; print ''; @@ -265,18 +251,32 @@ if ($result) { print ''; print ''; print ''; print "\n"; + print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + //print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); + $checkpicto=$form->showCheckAddButtons(); + print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print "\n"; + $facturefournisseur_static = new FactureFournisseur($db); $product_static = new Product($db); - $var = True; - while ( $i < min($num_lines, $limit) ) { + while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); - $var = ! $var; + $codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label; $facturefournisseur_static->ref = $objp->facnumber; @@ -287,7 +287,7 @@ if ($result) { $product_static->type = $objp->type; $product_static->label = $objp->product_label; - print ''; + print ''; print ''; @@ -320,7 +320,7 @@ if ($result) { print img_edit(); print ''; - print ''; + print ''; print ""; $i ++; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 19ef52f0d85..beae148c01b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -267,24 +267,11 @@ if ($result) { $moreforfilter = ''; print '
'; - print '
'; - $searchpitco=$form->showFilterAndCheckAddButtons(1); - print $searchpitco; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; print '
' . $objp->rowid . '
'."\n"; - print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); - //print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); - print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); - print_liste_field_titre('', '', '', '', '', 'align="center"'); - print "\n"; + + print '
'."\n"; // We add search filter - print ''; + print ''; print ''; print ''; print ''; @@ -297,11 +284,28 @@ if ($result) { print ''; print ''; print ''; print ''; + print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + //print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); + print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); + $checkpicto=''; + if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); + print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); + print "\n"; + $facturefourn_static = new FactureFournisseur($db); $productfourn_static = new ProductFournisseur($db); $form = new Form($db); @@ -309,7 +313,6 @@ if ($result) { $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); - $var = ! $var; // product_type: 0 = service ? 1 = product // if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service @@ -351,7 +354,7 @@ if ($result) { // $objp->code_buy_p is now code of product/service // $objp->code_buy_l is now default code of product/service - print ''; + print ''; // Line id print ''; diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 8e265eb70f7..2754c2d3690 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -125,15 +125,13 @@ print ''; print ''; print ''; print "\n"; -$var=true; // Login/Pass required for members -$var=!$var; print ''; print ''; print ''; print ''; -print '\n"; print ''; // Mail required for members -$var=!$var; print ''; print ''; print ''; print ''; -print '\n"; print ''; // Send mail information is on by default -$var=!$var; print ''; print ''; print ''; print ''; -print '\n"; print ''; // Insert subscription into bank account -$var=!$var; print ''; print ''; print ''; print ''; -print ''; +print ''; $arraychoices=array('0'=>$langs->trans("None")); if (! empty($conf->banque->enabled)) $arraychoices['bankdirect']=$langs->trans("MoreActionBankDirect"); if (! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $arraychoices['invoiceonly']=$langs->trans("MoreActionInvoiceOnly"); @@ -188,12 +183,11 @@ print ''; // Use vat for invoice creation if ($conf->facture->enabled) { - $var=!$var; print ''; print ''; print ''; print ''; - print ''; + print ''; if (! empty($conf->banque->enabled)) { print ''; + print ''; print ''; print ''; print ''; print "\n"; -$var=true; // Allow public form -$var=! $var; print ''; -print '\n"; -// Type -/*$var=! $var; +// Force Type +$adht = new AdherentType($db); print ''; -print '\n"; */ +$listofval = array(-1 => $langs->trans("Undefined")); +$listofval += $adht->liste_array(); +$forcetype = $conf->global->MEMBER_NEWFORM_FORCETYPE ?: -1; +print $form->selectarray("MEMBER_NEWFORM_FORCETYPE", $listofval, $forcetype, count($listetype)>1?1:0); +print "\n"; // Amount -$var=! $var; print ''; -print '\n"; // Can edit -$var=! $var; print ''; -print '\n"; if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) { // Jump to an online payment page - $var=! $var; - print ''; } + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $generated_password=getRandomPassword(false); + print ''; + } + // Type print ''; - // Password - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generated_password=getRandomPassword(false); - print ''; - } - // Address print ''; } + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } // Morphy $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Morale"); @@ -1122,13 +1127,7 @@ else print ''; // EMail - print ''; - - // Password - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - } + print ''; // Address print '"; + print ''; print ""; print ""; print ""; @@ -267,9 +266,6 @@ print "
'; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); - print $searchpitco; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; print '
' . $objp->rowid . ''.$langs->trans("Description").''.$langs->trans("Value").''.$langs->trans("Action").'
'.$langs->trans("AdherentLoginRequired").''; +print '
'.$langs->trans("AdherentLoginRequired").''; print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)?0:1),1); print ''; print ''; @@ -141,12 +139,11 @@ print "
'.$langs->trans("AdherentMailRequired").''; +print '
'.$langs->trans("AdherentMailRequired").''; print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_MAIL_REQUIRED)?$conf->global->ADHERENT_MAIL_REQUIRED:0),1); print ''; print ''; @@ -154,12 +151,11 @@ print "
'.$langs->trans("MemberSendInformationByMailByDefault").''; +print '
'.$langs->trans("MemberSendInformationByMailByDefault").''; print $form->selectyesno('constvalue',(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?$conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL:0),1); print ''; print ''; @@ -167,12 +163,11 @@ print "
'.$langs->trans("MoreActionsOnSubscription").'
'.$langs->trans("MoreActionsOnSubscription").'
'.$langs->trans("VATToUseForSubscriptions").'
'.$langs->trans("VATToUseForSubscriptions").''; @@ -213,12 +207,11 @@ if ($conf->facture->enabled) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { - $var=!$var; print ''; print ''; print ''; print ''; - print '
'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").'
'.$langs->trans("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS").''; $form->select_produits($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS, 'constvalue_ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS'); print ''; diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index a23c1f40def..5c16a34793c 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -29,6 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $langs->load("members"); $langs->load("admin"); @@ -49,12 +50,15 @@ if ($action == 'update') $editamount=GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $payonline=GETPOST('MEMBER_NEWFORM_PAYONLINE'); $email=GETPOST('MEMBER_PAYONLINE_SENDEMAIL'); + $forcetype=GETPOST('MEMBER_NEWFORM_FORCETYPE'); $res=dolibarr_set_const($db, "MEMBER_ENABLE_PUBLIC",$public,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_AMOUNT",$amount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT",$editamount,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE",$payonline,'chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "MEMBER_PAYONLINE_SENDEMAIL",$email,'chaine',0,'',$conf->entity); + if ($forcetype < 0) $res=dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE",$conf->entity); + else $res=dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE",$forcetype,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; @@ -141,39 +145,38 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; +print '
'; print $langs->trans("EnablePublicSubscriptionForm"); print ''; print $form->selectyesno("MEMBER_ENABLE_PUBLIC",(! empty($conf->global->MEMBER_ENABLE_PUBLIC)?$conf->global->MEMBER_ENABLE_PUBLIC:0),1); print "
'; -print $langs->trans("EnablePublicSubscriptionForm"); +print '
'; +print $langs->trans("ForceMemberType"); print ''; -print $form->selectyesno("forcedate",$conf->global->MEMBER_NEWFORM_FORCETYPE,1); -print "
'; +print '
'; print $langs->trans("DefaultAmount"); print ''; print ''; print "
'; +print '
'; print $langs->trans("CanEditAmount"); print ''; print $form->selectyesno("MEMBER_NEWFORM_EDITAMOUNT",(! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)?$conf->global->MEMBER_NEWFORM_EDITAMOUNT:0),1); @@ -182,8 +185,7 @@ print "
'; + print '
'; print $langs->trans("MEMBER_NEWFORM_PAYONLINE"); print ''; $listofval=array(); @@ -196,8 +198,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) { // Jump to an online payment page - $var=! $var; - print '
'; + print '
'; print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL"); print ''; print ''; diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 74f9e8234ad..145bcf4e497 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $langs->load("companies"); $langs->load("members"); -$id = GETPOST('id','int'); +$id = GETPOST('id','int')?GETPOST('id','int'):GETPOST('rowid','int'); // Security check $result=restrictedArea($user,'adherent',$id); @@ -85,50 +85,20 @@ if ($object->id > 0) if (! empty($conf->notification->enabled)) $langs->load("mails"); $head = member_prepare_head($object); - dol_fiche_head($head, 'agenda', $langs->trans("Member"),0,'user'); + dol_fiche_head($head, 'agenda', $langs->trans("Member"), -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'rowid', $linkback); - print '
'; - - print '
'; - print ''; - - // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { - print ''; - } - - // Type - print '\n"; - - // Morphy - print ''; - /*print '';*/ - print ''; - - // Company - print ''; - - // Civility - print ''; - print ''; - - print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().''; - print $form->showphoto('memberphoto',$member); - print '
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'; - + print '
'; - print '
'; + print '
'; $object->info($id); print dol_print_object_info($object, 1); - - print '
'; + print '
'; dol_fiche_end(); @@ -141,36 +111,17 @@ if ($object->id > 0) if (! empty($conf->agenda->enabled)) { - print ''; + print ''; } print ''; - print '
'; - $out=''; - /*$objthirdparty=$object->thirdparty; - $objcon=new stdClass(); - - $permok=$user->rights->agenda->myactions->create; - if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok) - { - $out.=''; - $out.=$langs->trans("AddAnAction").' '; - $out.=img_picto($langs->trans("AddAnAction"),'filenew'); - $out.=""; - }*/ - print load_fiche_titre($langs->trans("ActionsOnMember"),$out,''); - // List of todo actions - show_actions_todo($conf,$langs,$db,$object); - - // List of done actions - show_actions_done($conf,$langs,$db,$object); + // List of actions + show_actions_done($conf,$langs,$db,$object,null,0,'',''); } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 48461c64b02..270430c899f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -307,7 +307,7 @@ if (empty($reshook)) $object->phone = trim($_POST["phone"]); $object->phone_perso = trim($_POST["phone_perso"]); $object->phone_mobile= trim($_POST["phone_mobile"]); - $object->email = trim($_POST["email"]); + $object->email = trim($_POST["member_email"]); $object->skype = trim($_POST["skype"]); $object->birth = $birthdate; @@ -825,6 +825,16 @@ else print '
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Password").''; + print ''; + print '
'.$langs->trans("MemberType").''; $listetype=$adht->liste_array(); @@ -862,16 +872,6 @@ else // EMail print '
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'
'.$langs->trans("Password").''; - print ''; - print '
'.$langs->trans("Address").''; print ''; @@ -1069,6 +1069,11 @@ else print '
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Password").'pass).'">
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">
'.$langs->trans("Password").'pass).'">
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">
'.$langs->trans("Address").''; diff --git a/htdocs/adherents/card.php.bak b/htdocs/adherents/card.php.bak new file mode 100644 index 00000000000..48461c64b02 --- /dev/null +++ b/htdocs/adherents/card.php.bak @@ -0,0 +1,1787 @@ + + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2004-2012 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2012 Marcos García + * Copyright (C) 2012-2016 Philippe Grand + * Copyright (C) 2015-2016 Alexandre Spangaro + * + * 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 . + */ + +/** + * \file htdocs/adherents/card.php + * \ingroup member + * \brief Page of member + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; +require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; + +$langs->load("companies"); +$langs->load("bills"); +$langs->load("members"); +$langs->load("users"); +$langs->load('other'); + +$action=GETPOST('action','alpha'); +$cancel=GETPOST('cancel','alpha'); +$backtopage=GETPOST('backtopage','alpha'); +$confirm=GETPOST('confirm','alpha'); +$rowid=GETPOST('rowid','int'); +$id=GETPOST('id')?GETPOST('id','int'):$rowid; +$typeid=GETPOST('typeid','int'); +$userid=GETPOST('userid','int'); +$socid=GETPOST('socid','int'); + +if (! empty($conf->mailmanspip->enabled)) +{ + include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; + + $langs->load('mailmanspip'); + + $mailmanspip = new MailmanSpip($db); +} + +$object = new Adherent($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels=$extrafields->fetch_name_optionals_label($object->table_element); + +// Get object canvas (By default, this is not defined, so standard usage of dolibarr) +$object->getCanvas($id); +$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); +$objcanvas=null; +if (! empty($canvas)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; + $objcanvas = new Canvas($db, $action); + $objcanvas->getCanvas('adherent', 'membercard', $canvas); +} + +// Security check +$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas); + +if ($id > 0) +{ + // Load member + $result = $object->fetch($id); + + // Define variables to know what current user can do on users + $canadduser=($user->admin || $user->rights->user->user->creer); + // Define variables to know what current user can do on properties of user linked to edited member + if ($object->user_id) + { + // $ User is the user who edits, $ object->user_id is the id of the related user in the edited member + $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer) + || (($user->id != $object->user_id) && $user->rights->user->user->creer)); + $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password) + || (($user->id != $object->user_id) && $user->rights->user->user->password)); + } +} + +// Define variables to determine what the current user can do on the members +$canaddmember=$user->rights->adherent->creer; +// Define variables to determine what the current user can do on the properties of a member +if ($id) +{ + $caneditfieldmember=$user->rights->adherent->creer; +} + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('membercard','globalcard')); + + + +/* + * Actions + */ + +if ($cancel) $action=''; + +$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) + { + $error=0; + if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only + { + if ($userid != $user->id && $userid != $object->user_id) + { + $error++; + setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); + } + } + + if (! $error) + { + if ($userid != $object->user_id) // If link differs from currently in database + { + $result=$object->setUserId($userid); + if ($result < 0) dol_print_error($object->db,$object->error); + $action=''; + } + } + } + + if ($action == 'setsocid') + { + $error=0; + if (! $error) + { + if ($socid != $object->fk_soc) // If link differs from currently in database + { + $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; + $sql.=" WHERE fk_soc = '".$socid."'"; + $sql.=" AND entity = ".$conf->entity; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj && $obj->rowid > 0) + { + $othermember=new Adherent($db); + $othermember->fetch($obj->rowid); + $thirdparty=new Societe($db); + $thirdparty->fetch($socid); + $error++; + setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty",$othermember->getFullName($langs),$othermember->login,$thirdparty->name), null, 'errors'); + } + } + + if (! $error) + { + $result=$object->setThirdPartyId($socid); + if ($result < 0) dol_print_error($object->db,$object->error); + $action=''; + } + } + } + } + + // Create user from a member + if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) + { + if ($result > 0) + { + // Creation user + $nuser = new User($db); + $result=$nuser->create_from_member($object,GETPOST('login')); + + if ($result < 0) + { + $langs->load("errors"); + setEventMessages($langs->trans($nuser->error), null, 'errors'); + } + } + else + { + setEventMessages($object->errors, $object->error, 'errors'); + } + } + + // Create third party from a member + if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) + { + if ($result > 0) + { + // User creation + $company = new Societe($db); + $result=$company->create_from_member($object,GETPOST('companyname')); + + if ($result < 0) + { + $langs->load("errors"); + setEventMessages($langs->trans($company->error), null, 'errors'); + setEventMessages($company->error, $company->errors, 'errors'); + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == 'confirm_sendinfo' && $confirm == 'yes') + { + if ($object->email) + { + $from=$conf->email_from; + if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; + + $result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent")); + + $langs->load("mails"); + setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs'); + } + } + + if ($action == 'update' && ! $cancel && $user->rights->adherent->creer) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $birthdate=''; + if (isset($_POST["birthday"]) && $_POST["birthday"] + && isset($_POST["birthmonth"]) && $_POST["birthmonth"] + && isset($_POST["birthyear"]) && $_POST["birthyear"]) + { + $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + } + $lastname=$_POST["lastname"]; + $firstname=$_POST["firstname"]; + $societe=$_POST["societe"]; + $morphy=$_POST["morphy"]; + $login=$_POST["login"]; + if ($morphy != 'mor' && empty($lastname)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors'); + } + if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); + } + if ($morphy == 'mor' && empty($societe)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); + } + // Test si le login existe deja + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + if (empty($login)) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + } + } + // Create new object + if ($result > 0 && ! $error) + { + $object->oldcopy = clone $object; + + // Change values + $object->civility_id = trim($_POST["civility_id"]); + $object->firstname = trim($_POST["firstname"]); + $object->lastname = trim($_POST["lastname"]); + $object->login = trim($_POST["login"]); + $object->pass = trim($_POST["pass"]); + + $object->societe = trim($_POST["societe"]); + $object->company = trim($_POST["societe"]); + + $object->address = trim($_POST["address"]); + $object->zip = trim($_POST["zipcode"]); + $object->town = trim($_POST["town"]); + $object->state_id = $_POST["state_id"]; + $object->country_id = $_POST["country_id"]; + + $object->phone = trim($_POST["phone"]); + $object->phone_perso = trim($_POST["phone_perso"]); + $object->phone_mobile= trim($_POST["phone_mobile"]); + $object->email = trim($_POST["email"]); + $object->skype = trim($_POST["skype"]); + $object->birth = $birthdate; + + $object->typeid = $_POST["typeid"]; + //$object->note = trim($_POST["comment"]); + $object->morphy = $_POST["morphy"]; + + if (GETPOST('deletephoto')) $object->photo=''; + elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); + + // Get status and public property + $object->statut = $_POST["statut"]; + $object->public = $_POST["public"]; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + + // Check if we need to also synchronize user information + $nosyncuser=0; + if ($object->user_id) // If linked to a user + { + if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser=1; // Disable synchronizing + } + + // Check if we need to also synchronize password information + $nosyncuserpass=0; + if ($object->user_id) // If linked to a user + { + if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass=1; // Disable synchronizing + } + + $result=$object->update($user,0,$nosyncuser,$nosyncuserpass); + + if ($result >= 0 && ! count($object->errors)) + { + $categories = GETPOST('memcats', 'array'); + $object->setCategories($categories); + + // Logo/Photo save + $dir= $conf->adherent->dir_output . '/' . get_exdir(0,0,0,1,$object,'member').'/photos'; + $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); + if ($file_OK) + { + if (GETPOST('deletephoto')) + { + require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + $fileimg=$conf->adherent->dir_output.'/'.get_exdir(0,0,0,1,$object,'member').'/photos/'.$object->photo; + $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir(0,0,0,1,$object,'member').'/photos/thumbs'; + dol_delete_file($fileimg); + dol_delete_dir_recursive($dirthumbs); + } + + if (image_format_supported($_FILES['photo']['name']) > 0) + { + dol_mkdir($dir); + + if (@is_dir($dir)) + { + $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'],$newfile,1,0,$_FILES['photo']['error']) > 0) + { + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + } + else + { + // Create thumbs + $object->addThumbs($newfile); + } + } + } + else + { + setEventMessages("ErrorBadImageFormat", null, 'errors'); + } + } + else + { + switch($_FILES['photo']['error']) + { + case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini + case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form + $errors[] = "ErrorFileSizeTooLarge"; + break; + case 3: //uploaded file was only partially uploaded + $errors[] = "ErrorFilePartiallyUploaded"; + break; + } + } + + $rowid=$object->id; + $id=$object->id; + $action=''; + + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $action=''; + } + } + else + { + $action='edit'; + } + } + + if ($action == 'add' && $user->rights->adherent->creer) + { + if ($canvas) $object->canvas=$canvas; + $birthdate=''; + if (isset($_POST["birthday"]) && $_POST["birthday"] + && isset($_POST["birthmonth"]) && $_POST["birthmonth"] + && isset($_POST["birthyear"]) && $_POST["birthyear"]) + { + $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + } + $datesubscription=''; + if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) + { + $datesubscription=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + } + + $typeid=$_POST["typeid"]; + $civility_id=$_POST["civility_id"]; + $lastname=$_POST["lastname"]; + $firstname=$_POST["firstname"]; + $societe=$_POST["societe"]; + $address=$_POST["address"]; + $zip=$_POST["zipcode"]; + $town=$_POST["town"]; + $state_id=$_POST["state_id"]; + $country_id=$_POST["country_id"]; + + $phone=$_POST["phone"]; + $phone_perso=$_POST["phone_perso"]; + $phone_mobile=$_POST["phone_mobile"]; + $skype=$_POST["member_skype"]; + $email=$_POST["member_email"]; + $login=$_POST["member_login"]; + $pass=$_POST["password"]; + $photo=$_POST["photo"]; + //$comment=$_POST["comment"]; + $morphy=$_POST["morphy"]; + $subscription=$_POST["subscription"]; + $public=$_POST["public"]; + + $userid=$_POST["userid"]; + $socid=$_POST["socid"]; + + $object->civility_id = $civility_id; + $object->firstname = $firstname; + $object->lastname = $lastname; + $object->societe = $societe; + $object->address = $address; + $object->zip = $zip; + $object->town = $town; + $object->state_id = $state_id; + $object->country_id = $country_id; + $object->phone = $phone; + $object->phone_perso = $phone_perso; + $object->phone_mobile= $phone_mobile; + $object->skype = $skype; + $object->email = $email; + $object->login = $login; + $object->pass = $pass; + $object->birth = $birthdate; + $object->photo = $photo; + $object->typeid = $typeid; + //$object->note = $comment; + $object->morphy = $morphy; + $object->user_id = $userid; + $object->fk_soc = $socid; + $object->public = $public; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + if ($ret < 0) $error++; + + // Check parameters + if (empty($morphy) || $morphy == "-1") { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors'); + } + // Tests if the login already exists + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + if (empty($login)) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + } + else { + $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; + $result = $db->query($sql); + if ($result) { + $num = $db->num_rows($result); + } + if ($num) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorLoginAlreadyExists",$login), null, 'errors'); + } + } + if (empty($pass)) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors'); + } + } + if ($morphy == 'mor' && empty($societe)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); + } + if ($morphy != 'mor' && empty($lastname)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors'); + } + if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); + } + if (! ($typeid > 0)) { // Keep () before ! + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); + } + if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadEMail",$email), null, 'errors'); + } + $public=0; + if (isset($public)) $public=1; + + if (! $error) + { + $db->begin(); + + // Email about right and login does not exist + $result=$object->create($user); + if ($result > 0) + { + // Foundation categories + $memcats = GETPOST('memcats', 'array'); + $object->setCategories($memcats); + + $db->commit(); + $rowid=$object->id; + $id=$object->id; + $action=''; + } + else + { + $db->rollback(); + + if ($object->error) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + + $action = 'create'; + } + } + else { + $action = 'create'; + } + } + + if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') + { + $result=$object->delete($id); + if ($result > 0) + { + if (! empty($backtopage)) + { + header("Location: ".$backtopage); + exit; + } + else + { + header("Location: list.php"); + exit; + } + } + else + { + $errmesg=$object->error; + } + } + + if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') + { + $error=0; + + $db->begin(); + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + $result=$object->validate($user); + + if ($result >= 0 && ! count($object->errors)) + { + // Send confirmation email (according to parameters of member type. Otherwise generic) + if ($object->email && GETPOST("send_mail")) + { + $result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } + else + { + $error++; + if ($object->error) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); + } + $action=''; + } + + if ($user->rights->adherent->supprimer && $action == 'confirm_resign') + { + $error = 0; + + if ($confirm == 'yes') + { + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + $result=$object->resiliate($user); + + if ($result >= 0 && ! count($object->errors)) + { + if ($object->email && GETPOST("send_mail")) + { + $result=$object->send_an_email($adht->getMailOnResiliate(),$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1); + } + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + else + { + $error++; + + if ($object->error) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + $action=''; + } + } + if (! empty($backtopage) && ! $error) + { + header("Location: ".$backtopage); + exit; + } + } + + // SPIP Management + if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') + { + if (! count($object->errors)) + { + if (!$mailmanspip->del_to_spip($object)) + { + setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors'); + } + } + } + + if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') + { + if (! count($object->errors)) + { + if (!$mailmanspip->add_to_spip($object)) + { + setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors'); + } + } + } + + // Actions to build doc + $upload_dir = $conf->adherent->dir_output; + $permissioncreate=$user->rights->adherent->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; +} + + +/* + * View + */ + +$form = new Form($db); +$formfile = new FormFile($db); +$formcompany = new FormCompany($db); + +$title=$langs->trans("Member") . " - " . $langs->trans("Card"); +$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +llxHeader('',$title,$help_url); + +$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; + +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) +{ + // ----------------------------------------- + // When used with CANVAS + // ----------------------------------------- + if (empty($object->error) && $id) + { + $object = new Adherent($db); + $result=$object->fetch($id); + if ($result <= 0) dol_print_error('',$object->error); + } + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template +} +else +{ + // ----------------------------------------- + // When used in standard mode + // ----------------------------------------- + + if ($action == 'create') + { + /* ************************************************************************** */ + /* */ + /* Creation mode */ + /* */ + /* ************************************************************************** */ + $object->canvas=$canvas; + $object->state_id = GETPOST('state_id', 'int'); + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id','int')?GETPOST('country_id','int'):$mysoc->country_id; + if ($object->country_id) + { + $tmparray=getCountry($object->country_id,'all'); + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; + } + + $adht = new AdherentType($db); + + print load_fiche_titre($langs->trans("NewMember")); + + if ($conf->use_javascript_ajax) + { + print "\n".''."\n"; + } + + print ''; + print ''; + print ''; + + dol_fiche_head(''); + + print ''; + print ''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Type + print '\n"; + + // Morphy + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Moral"); + print '\n"; + + // Company + print ''; + + // Civility + print ''; + print ''; + + // Lastname + print ''; + print ''; + + // Firstname + print ''; + print ''; + + // EMail + print ''; + + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $generated_password=getRandomPassword(false); + print ''; + } + + // Address + print ''; + + // Zip / Town + print ''; + + // Country + $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; + print ''; + + // State + if (empty($conf->global->MEMBER_DISABLE_STATE)) + { + print ''; + } + + // Pro phone + print ''; + + // Personal phone + print ''; + + // Mobile phone + print ''; + + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + } + + // Birthday + print "\n"; + + // Public profil + print "\n"; + + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + print '"; + } + + // Other attributes + $parameters=array(); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit'); + } + + /* + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; + } + + // Login Dolibarr + print ''; + */ + print ''; + print "
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("MemberType").''; + $listetype=$adht->liste_array(); + if (count($listetype)) + { + print $form->selectarray("typeid", $listetype, GETPOST('typeid','int')?GETPOST('typeid','int'):$typeid, count($listetype)>1?1:0); + } else { + print ''.$langs->trans("NoTypeDefinedGoToSetup").''; + } + print "
'.$langs->trans("Nature")."\n"; + print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1); + print "
'.$langs->trans("Company").'
'.$langs->trans("UserTitle").''; + print $formcompany->select_civility(GETPOST('civility_id','int')?GETPOST('civility_id','int'):$object->civility_id,'civility_id').'
'.$langs->trans("Lastname").'
'.$langs->trans("Firstname").'
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'
'.$langs->trans("Password").''; + print ''; + print '
'.$langs->trans("Address").''; + print ''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print $formcompany->select_ziptown((GETPOST('zipcode','alpha')?GETPOST('zipcode','alpha'):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); + print ' '; + print $formcompany->select_ziptown((GETPOST('town','alpha')?GETPOST('town','alpha'):$object->town),'town',array('zipcode','selectcountry_id','state_id')); + print '
'.$langs->trans('Country').''; + print $form->select_country(GETPOST('country_id','alpha')?GETPOST('country_id','alpha'):$object->country_id,'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print '
'.$langs->trans('State').''; + if ($object->country_id) + { + print $formcompany->select_state(GETPOST('state_id','int')?GETPOST('state_id','int'):$object->state_id,$object->country_code); + } + else + { + print $countrynotdefined; + } + print '
'.$langs->trans("PhonePro").'
'.$langs->trans("PhonePerso").'
'.$langs->trans("PhoneMobile").'
'.$langs->trans("Skype").'
".$langs->trans("Birthday")."\n"; + $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); + print "
".$langs->trans("Public")."\n"; + print $form->selectyesno("public",$object->public,1); + print "
' . fieldLabel('Categories', 'memcars') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); + print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%'); + print "
'.$langs->trans("LinkedToDolibarrThirdParty").''; + print $form->select_company($object->fk_soc,'socid','',1); + print '
'.$langs->trans("LinkedToDolibarrUser").''; + print $form->select_dolusers($object->user_id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print '
\n"; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print "\n"; + } + + if ($action == 'edit') + { + /******************************************** + * + * Edition mode + * + ********************************************/ + + $res=$object->fetch($id); + if ($res < 0) { + dol_print_error($db,$object->error); exit; + } + $res=$object->fetch_optionals($object->id,$extralabels); + if ($res < 0) { + dol_print_error($db); exit; + } + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + // We set country_id, and country_code, country of the chosen country + $country=GETPOST('country','int'); + if (!empty($country) || $object->country_id) + { + $sql = "SELECT rowid, code, label from ".MAIN_DB_PREFIX."c_country where rowid = ".(!empty($country)?$country:$object->country_id); + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + } + else + { + dol_print_error($db); + } + $object->country_id=$obj->rowid; + $object->country_code=$obj->code; + $object->country=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; + } + + $head = member_prepare_head($object); + + + if ($conf->use_javascript_ajax) + { + print "\n".''."\n"; + } + + print '
'; + print ''; + print ''; + print ''; + print ''; + if ($backtopage) print ''; + + dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); + + print ''; + + // Ref + print ''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Morphy + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Morale"); + print '"; + + // Type + print '"; + + // Company + print ''; + + // Civility + print ''; + print ''; + + // Lastname + print ''; + print ''; + + // Firstname + print ''; + print ''; + + // Photo + print ''; + print ''; + + // EMail + print ''; + + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Address + print ''; + + // Zip / Town + print ''; + + // Country + //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined + print ''; + + // State + if (empty($conf->global->MEMBER_DISABLE_STATE)) + { + print ''; + } + + // Pro phone + print ''; + + // Personal phone + print ''; + + // Mobile phone + print ''; + + // Skype + if (! empty($conf->skype->enabled)) + { + print ''; + } + + // Birthday + print "\n"; + + // Public profil + print "\n"; + + // Categories + if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) + { + print ''; + print '"; + } + + // Other attributes + $parameters=array("colspan"=>2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields,'edit',$parameters); + } + + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; + } + + // Login Dolibarr + print ''; + + print '
'.$langs->trans("Ref").''.$object->id.'
'.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">
'.$langs->trans("Nature").''; + print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); + print "
'.$langs->trans("Type").''; + if ($user->rights->adherent->creer) + { + print $form->selectarray("typeid", $adht->liste_array(), (isset($_POST["typeid"])?$_POST["typeid"]:$object->typeid)); + } + else + { + print $adht->getNomUrl(1); + print ''; + } + print "
'.$langs->trans("Company").'societe).'">
'.$langs->trans("UserTitle").''; + print $formcompany->select_civility(isset($_POST["civility_id"])?$_POST["civility_id"]:$object->civility_id)."\n"; + print '
'.$langs->trans("Lastname").'lastname).'">
'.$langs->trans("Firstname").'firstname).'">
'.$langs->trans("Photo").''; + print $form->showphoto('memberphoto',$object)."\n"; + if ($caneditfieldmember) + { + if ($object->photo) print "
\n"; + print ''; + if ($object->photo) print ''; + print ''; + print ''; + print '
'.$langs->trans("Delete").'

'.$langs->trans("PhotoFile").'
'; + } + print '
'.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">
'.$langs->trans("Password").'pass).'">
'.$langs->trans("Address").''; + print ''; + print '
'.$langs->trans("Zip").' / '.$langs->trans("Town").''; + print $formcompany->select_ziptown((isset($_POST["zipcode"])?GETPOST("zipcode",'',2):$object->zip),'zipcode',array('town','selectcountry_id','state_id'),6); + print ' '; + print $formcompany->select_ziptown((isset($_POST["town"])?GETPOST("town",'',2):$object->town),'town',array('zipcode','selectcountry_id','state_id')); + print '
'.$langs->trans('Country').''; + print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id,'country_id'); + if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); + print '
'.$langs->trans('State').''; + print $formcompany->select_state($object->state_id,isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id); + print '
'.$langs->trans("PhonePro").'phone).'">
'.$langs->trans("PhonePerso").'phone_perso).'">
'.$langs->trans("PhoneMobile").'phone_mobile).'">
'.$langs->trans("Skype").'skype).'">
".$langs->trans("Birthday")."\n"; + $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); + print "
".$langs->trans("Public")."\n"; + print $form->selectyesno("public",(isset($_POST["public"])?GETPOST("public",'',2):$object->public),1); + print "
' . fieldLabel('Categories', 'memcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_MEMBER); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print "
'.$langs->trans("LinkedToDolibarrThirdParty").''; + if ($object->fk_soc) + { + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + print $company->getNomUrl(1); + } + else + { + print $langs->trans("NoThirdPartyAssociatedToMember"); + } + print '
'.$langs->trans("LinkedToDolibarrUser").''; + if ($object->user_id) + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + } + else print $langs->trans("NoDolibarrAccess"); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; + + } + + if ($id > 0 && $action != 'edit') + { + /* ************************************************************************** */ + /* */ + /* View mode */ + /* */ + /* ************************************************************************** */ + + $res=$object->fetch($id); + if ($res < 0) { + dol_print_error($db,$object->error); exit; + } + $res=$object->fetch_optionals($object->id,$extralabels); + if ($res < 0) { + dol_print_error($db); exit; + } + + $adht = new AdherentType($db); + $res=$adht->fetch($object->typeid); + if ($res < 0) { + dol_print_error($db); exit; + } + + + /* + * Show tabs + */ + $head = member_prepare_head($object); + + dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); + + // Confirm create user + if ($action == 'create_user') + { + $login=$object->login; + if (empty($login)) + { + // Full firstname and name separated with a dot : firstname.name + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $login=dol_buildlogin($object->lastname,$object->firstname); + } + if (empty($login)) $login=strtolower(substr($object->firstname, 0, 4)) . strtolower(substr($object->lastname, 0, 4)); + + // Create a form array + $formquestion=array( + array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) + ); + $text=$langs->trans("ConfirmCreateLogin").'
'; + if (! empty($conf->societe->enabled)) + { + if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); + else $text.=$langs->trans("UserWillBeInternalUser"); + } + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrLogin"),$text,"confirm_create_user",$formquestion,'yes'); + } + + // Confirm create third party + if ($action == 'create_thirdparty') + { + $name = $object->getFullName($langs); + if (! empty($name)) + { + if ($object->societe) $name.=' ('.$object->societe.')'; + } + else + { + $name=$object->societe; + } + + // Create a form array + $formquestion=array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $name)); + + print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1); + } + + // Confirm validate member + if ($action == 'valid') + { + $langs->load("mails"); + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_VALID_SUBJECT); + $texttosend=$object->makeSubstitution($adht->getMailOnValid()); + + $tmp=$langs->trans("SendAnEMailToMember"); + $tmp.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; + $helpcontent=''; + $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent.=''.$langs->trans("Subject").':
'."\n"; + $helpcontent.=$subjecttosend."\n"; + $helpcontent.="
"; + $helpcontent.=''.$langs->trans("Content").':
'; + $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; + $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); + + // Create form popup + $formquestion=array(); + if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false)); + if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_MAILMAN)) { + $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); + } + if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { + $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); + } + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1); + } + + // Confirm send card by mail + if ($action == 'sendinfo') + { + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); + } + + // Confirm terminate + if ($action == 'resign') + { + $langs->load("mails"); + + $adht = new AdherentType($db); + $adht->fetch($object->typeid); + + $subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_RESIL_SUBJECT); + $texttosend=$object->makeSubstitution($adht->getMailOnResiliate()); + + $tmp=$langs->trans("SendAnEMailToMember"); + $tmp.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; + $helpcontent=''; + $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent.=''.$langs->trans("Subject").':
'."\n"; + $helpcontent.=$subjecttosend."\n"; + $helpcontent.="
"; + $helpcontent.=''.$langs->trans("Content").':
'; + $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; + $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); + + // Create an array + $formquestion=array(); + if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); + if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1); + } + + // Confirm remove member + if ($action == 'delete') + { + $formquestion=array(); + if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); + print $form->formconfirm("card.php?rowid=".$id,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1); + } + + // Confirm add in spip + if ($action == 'add_spip') + { + print $form->formconfirm("card.php?rowid=".$id, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip'); + } + // Confirm removed from spip + if ($action == 'del_spip') + { + print $form->formconfirm("card.php?rowid=$id", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); + } + + $rowspan=17; + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; + if (! empty($conf->societe->enabled)) $rowspan++; + + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($object, 'rowid', $linkback); + + print '
'; + print '
'; + + print '
'; + print ''; + + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + // Type + print '\n"; + + // Morphy + print ''; + print ''; + + // Company + print ''; + + // Civility + print ''; + print ''; + + // Password + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + print ''; + } + + print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Type").''.$adht->getNomUrl(1)."
'.$langs->trans("Nature").''.$object->getmorphylib().'
'.$langs->trans("Company").''.$object->societe.'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Password").''.preg_replace('/./i','*',$object->pass); + if ($object->pass) print preg_replace('/./i','*',$object->pass); + else + { + if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; + else print $langs->trans("Hidden"); + } + if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) + { + $langs->load("errors"); + $htmltext=$langs->trans("WarningPasswordSetWithNoAccount"); + print ' '.$form->textwithpicto('', $htmltext,1,'warning'); + } + print '
'; + + print '
'; + print '
'; + + print '
'; + print ''; + + // Birthday + print ''; + + // Public + print ''; + + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + print ''; + print ''; + } + + // Other attributes + $parameters=array('colspan'=>2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook) && ! empty($extrafields->attribute_label)) + { + print $object->showOptionals($extrafields, 'view', $parameters); + } + + // Date end subscription + print ''; + + // Third party Dolibarr + if (! empty($conf->societe->enabled)) + { + print ''; + } + + // Login Dolibarr + print ''; + + print "
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
'.$langs->trans("Public").''.yn($object->public).'
' . $langs->trans("Categories") . ''; + print $form->showCategories($object->id, 'member', 1); + print '
'.$langs->trans("SubscriptionEndDate").''; + if ($object->datefin) + { + print dol_print_date($object->datefin,'day'); + if ($object->hasDelay()) { + print " ".img_warning($langs->trans("Late")); + } + } + else + { + if (! $adht->subscription) + { + print $langs->trans("SubscriptionNotRecorded"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + else + { + print $langs->trans("SubscriptionNotReceived"); + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated + } + } + print '
'; + print ''; + if ($action != 'editthirdparty' && $user->rights->adherent->creer) print ''; + print '
'; + print $langs->trans("LinkedToDolibarrThirdParty"); + print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'
'; + print '
'; + if ($action == 'editthirdparty') + { + $htmlname='socid'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->select_company($object->fk_soc,'socid','',1); + print '
'; + } + else + { + if ($object->fk_soc) + { + $company=new Societe($db); + $result=$company->fetch($object->fk_soc); + print $company->getNomUrl(1); + } + else + { + print $langs->trans("NoThirdPartyAssociatedToMember"); + } + } + print '
'; + print ''; + if ($action != 'editlogin' && $user->rights->adherent->creer) + { + print ''; + } + print '
'; + print $langs->trans("LinkedToDolibarrUser"); + print ''; + if ($user->rights->user->user->creer) + { + print 'id.'">'.img_edit($langs->trans('SetLinkToUser'),1).''; + } + print '
'; + print '
'; + if ($action == 'editlogin') + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid',''); + } + else + { + if ($object->user_id) + { + $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none'); + } + else print $langs->trans("NoDolibarrAccess"); + } + print '
\n"; + + print "
\n"; + print '
'; + + dol_fiche_end(); + + + /* + * Hotbar + */ + + print '
'; + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been + if (empty($reshook)) { + if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty') + { + // Modify + if ($user->rights->adherent->creer) + { + print '"; + } + else + { + print '
'.$langs->trans("Modify").'
'; + } + + // Validate + if ($object->statut == -1) + { + if ($user->rights->adherent->creer) + { + print '\n"; + } + else + { + print '
'.$langs->trans("Validate").'
'; + } + } + + // Reactivate + if ($object->statut == 0) + { + if ($user->rights->adherent->creer) + { + print '\n"; + } + else + { + print '
'.$langs->trans("Reenable")."
"; + } + } + + // Send card by email + if ($user->rights->adherent->creer) + { + if ($object->statut >= 1) + { + if ($object->email) print '\n"; + else print '\n"; + } + else + { + print '
'.$langs->trans("SendCardByMail")."
"; + } + } + else + { + print '
'.$langs->trans("SendCardByMail")."
"; + } + + // Terminate + if ($object->statut >= 1) + { + if ($user->rights->adherent->supprimer) + { + print '\n"; + } + else + { + print '
'.$langs->trans("Resiliate")."
"; + } + } + + // Create third party + if (! empty($conf->societe->enabled) && ! $object->fk_soc) + { + if ($user->rights->societe->creer) + { + if ($object->statut != -1) print ''; + else print ''; + } + else + { + print '
'.$langs->trans("CreateDolibarrThirdParty")."
"; + } + } + + // Create user + if (! $user->societe_id && ! $object->user_id) + { + if ($user->rights->user->user->creer) + { + if ($object->statut != -1) print ''; + else print ''; + } + else + { + print '
'.$langs->trans("CreateDolibarrLogin")."
"; + } + } + + // Delete + if ($user->rights->adherent->supprimer) + { + print '\n"; + } + else + { + print '
'.$langs->trans("Delete")."
"; + } + + // Action SPIP + if (! empty($conf->mailmanspip->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) + { + $isinspip = $mailmanspip->is_in_spip($object); + + if ($isinspip == 1) + { + print '\n"; + } + if ($isinspip == 0) + { + print '\n"; + } + } + + } + } + print '
'; + + if ($isinspip == -1) + { + print '

'.$langs->trans('SPIPConnectionFailed').': '.$mailmanspip->error.''; + } + + + + print '
'; + print ''; // ancre + + // Documents generes + $filename = dol_sanitizeFileName($object->ref); + //$filename = 'tmp_cards.php'; + //$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref); + $filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member'); + $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id; + $genallowed = $user->rights->adherent->creer; + $delallowed = $user->rights->adherent->supprimer; + + print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $object->default_lang, '', $object); + $somethingshown = $formfile->numoffiles; + + // Show links to link elements + //$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription')); + //$somethingshown = $form->showLinkedObjectBlock($object, ''); + + // Show links to link elements + /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + + // Link for paypal payment + /* + if (! empty($conf->paypal->enabled) && $object->statut != 0) { + include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; + print showPaypalPaymentUrl('invoice', $object->ref); + } + */ + print '
'; + + // List of actions on element + /* Already in tab Agenda/Events + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'member', $socid); + */ + print '
'; + + } +} + +llxFooter(); + +$db->close(); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 833b5bf224e..852b051e3dd 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -209,6 +209,23 @@ class Adherent extends CommonObject // Substitutions $substitutionarray=array( + '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, + '__ID__'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id, + '__CIVILITY__'=>$this->getCivilityLabel(), + '__FIRSTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, + '__LASTNAME__'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, + '__FULLNAME__'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), + '__COMPANY__'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, + '__ADDRESS__'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address, + '__ZIP__'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip, + '__TOWN_'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, + '__COUNTRY__'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, + '__EMAIL__'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email, + '__BIRTH__'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday, + '__PHOTO__'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, + '__LOGIN__'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, + '__PASSWORD__'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, + // For backward compatibility '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, '%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id, '%CIVILITY%'=>$this->getCivilityLabel(), @@ -225,7 +242,6 @@ class Adherent extends CommonObject '%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, '%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, '%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, - // For backward compatibility '%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos, '%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, '%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, @@ -234,16 +250,10 @@ class Adherent extends CommonObject '%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, '%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, ); - // Add extrafields as substitution key %EXTRA_XXX% - foreach($this->array_options as $key => $val) - { - $keyshort=preg_replace('/^(options|extra)_/','',$key); - $substitutionarray['%EXTRA_'.$keyshort.'%']=$val; - } - complete_substitutions_array($substitutionarray, $langs); + complete_substitutions_array($substitutionarray, $langs, $this); - return make_substitutions($text,$substitutionarray); + return make_substitutions($text, $substitutionarray, $langs); } @@ -1570,40 +1580,85 @@ class Adherent extends CommonObject /** * Return clicable name (with picto eventually) * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $maxlen length max libelle - * @param string $option Page lien + * @param int $withpictoimg 0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small) + * @param int $maxlen length max label + * @param string $option Page for link + * @param string $mode ''=Show firstname and lastname, 'firstname'=Show only firstname, 'login'=Show login, 'ref'=Show ref + * @param string $morecss Add more css on link * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlen=0,$option='card') + function getNomUrl($withpictoimg=0,$maxlen=0,$option='card',$mode='',$morecss='') { - global $langs; + global $conf, $langs; - $result=''; - $label = '' . $langs->trans("ShowMember") . ''; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; + + $result=''; $label=''; + $link=''; $linkstart=''; $linkend=''; + + if (! empty($this->photo)) + { + $label.= '
'; + $label.= Form::showphoto('memberphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); + $label.= '
'; + } + + $label.= '
'; + $label.= '' . $langs->trans("Member") . ''; if (! empty($this->ref)) $label.= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->firstname) || ! empty($this->lastname)) $label.= '
' . $langs->trans('Name') . ': ' . $this->getFullName($langs); - $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; - - $link=''; $linkend=''; + $label.='
'; + if ($option == 'card' || $option == 'category') { - $link = ''; + $link = 'ref,$maxlen):$this->ref) : '').$linkend; + + $linkclose=""; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $langs->load("users"); + $label=$langs->trans("ShowUser"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.= ' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + + $link.=$linkclose.'>'; + $linkend=''; + + //if ($withpictoimg == -1) $result.='
'; + $result.=$link; + if ($withpictoimg) + { + $paddafterimage=''; + if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"'; + // Only picto + if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'
'; + // Picto must be a photo + else $picto='
'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'
'; + $result.=$picto; + } + if ($withpictoimg > -2 && $withpictoimg != 2) + { + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); + elseif ($mode == 'ref') $result.=$this->id; + else $result.=$this->getFullName($langs,'',($mode == 'firstname' ? 2 : -1),$maxlen); + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + } + $result.=$linkend; + //if ($withpictoimg == -1) $result.='
'; + return $result; } diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 47fbebbf976..dd22a74577d 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -96,7 +96,7 @@ if ($id > 0) { // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { @@ -108,7 +108,7 @@ if ($id > 0) $head = member_prepare_head($object); - dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user'); + dol_fiche_head($head, 'document', $langs->trans("Member"), -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 9c1b0bb01e1..76368fc5673 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -246,8 +246,7 @@ $var=true; krsort($Total); foreach ($Total as $key=>$value) { - $var=!$var; - print "
$key".$Number[$key]."".price($value)."

\n"; print '
'; - -$var=true; - /* * Last modified members */ @@ -295,12 +291,10 @@ if ($resql) if ($num) { $i = 0; - $var = True; while ($i < $num) { - $var=!$var; $obj = $db->fetch_object($resql); - print ""; + print ''; $staticmember->id=$obj->rowid; $staticmember->lastname=$obj->lastname; $staticmember->firstname=$obj->firstname; @@ -358,12 +352,10 @@ if ($resql) if ($num) { $i = 0; - $var = True; while ($i < $num) { - $var=!$var; $obj = $db->fetch_object($resql); - print ""; + print ''; $subscriptionstatic->id=$obj->cid; $subscriptionstatic->ref=$obj->cid; $staticmember->id=$obj->rowid; @@ -407,8 +399,7 @@ print "\n"; foreach ($AdherentType as $key => $adhtype) { - $var=!$var; - print ""; + print ''; print ''.$adhtype->getNomUrl(1, dol_size(32)).''; print ''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).''; print ''.(isset($MembersValidated[$key]) && ($MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0) > 0) ? $MembersValidated[$key]-(isset($MemberUpToDate[$key])?$MemberUpToDate[$key]:0):'').' '.$staticmember->LibStatut(1,$adhtype->subscription,0,3).''; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 28cd8773d53..e3aad3c4ccc 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -170,6 +170,7 @@ if (empty($reshook)) $catid=""; $sall=""; $statut=''; + $toselect=''; $search_array_options=array(); } } @@ -270,6 +271,8 @@ if (! $resql) $num = $db->num_rows($resql); +$arrayofselected=is_array($toselect)?$toselect:array(); + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { $obj = $db->fetch_object($resql); @@ -333,7 +336,15 @@ foreach ($search_array_options as $key => $val) if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } -//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); +// List of mass actions available +$arrayofmassactions = array( +// 'presend'=>$langs->trans("SendByMail"), +// 'builddoc'=>$langs->trans("PDFMerge"), +); +//if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); +if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); print '
'; if ($optioncss != '') print ''; @@ -342,8 +353,9 @@ print ''; print ''; print ''; +print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); if ($sall) { @@ -374,55 +386,14 @@ if (! empty($moreforfilter)) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); print '
'; print ''."\n"; -print ''; -if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) -{ - print ''; -} -if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); -if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder); -// Extra fields -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) -{ - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); - } - } -} -// Hook fields -$parameters=array('arrayfields'=>$arrayfields); -$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); -print "\n"; + // Line for filters fields -print ''; +print ''; // Line numbering if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) @@ -589,13 +560,56 @@ if (! empty($arrayfields['d.statut']['checked'])) } // Action column print ''; print "\n"; -$var=True; +print ''; +if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) +{ + print ''; +} +if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'],$_SERVER["PHP_SELF"],'t.libelle','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.email']['checked'])) print_liste_field_titre($arrayfields['d.email']['label'],$_SERVER["PHP_SELF"],'d.email','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titre($arrayfields['d.datefin']['label'],$_SERVER["PHP_SELF"],'d.datefin','',$param,'align="center"',$sortfield,$sortorder); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } +} +// Hook fields +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['d.statut']['checked'])) print_liste_field_titre($arrayfields['d.statut']['label'],$_SERVER["PHP_SELF"],"d.statut","",$param,'align="right"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + $i = 0; while ($i < min($num, $limit)) { @@ -610,6 +624,7 @@ while ($i < min($num, $limit)) $memberstatic->statut=$obj->statut; $memberstatic->datefin= $datefin; $memberstatic->socid = $obj->fk_soc; + $memberstatic->photo = $obj->photo; if (! empty($obj->fk_soc)) { $memberstatic->fetch_thirdparty(); @@ -618,8 +633,7 @@ while ($i < min($num, $limit)) $companyname=$obj->company; } - $var=!$var; - print ""; + print ''; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { @@ -630,7 +644,7 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['d.ref']['checked'])) { print "\n"; } // Firstname diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 9e6a20f6cb3..325b14680e7 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -69,7 +69,7 @@ if ($id) { $head = member_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Member"), 0, 'user'); + dol_fiche_head($head, 'note', $langs->trans("Member"), -1, 'user'); print ""; print ''; @@ -109,7 +109,6 @@ if ($id) print "
'.$langs->trans("NumberingShort").'
'; -$searchpitco=$form->showFilterAndCheckAddButtons(0); +$searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'.$langs->trans("NumberingShort").'
"; - print $memberstatic->getNomUrl(1); + print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print "
"; print '
'; - print '
'; $cssclass='titlefield'; diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index c717d20be84..6f896e186bb 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -127,12 +127,10 @@ if (! $foundphy) $data[]=array('label'=>'phy','nb'=>'0','lastdate'=>''); if (! $foundmor) $data[]=array('label'=>'mor','nb'=>'0','lastdate'=>''); $oldyear=0; -$var=true; foreach ($data as $val) { $year = $val['year']; - $var=!$var; - print ''; + print ''; print ''.$memberstatic->getmorphylib($val['label']).''; print ''.$val['nb'].''; print ''.dol_print_date($val['lastdate'],'dayhour').''; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index ae128d940e8..8e3d0862490 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -291,12 +291,10 @@ if ($mode) print ''; $oldyear=0; - $var=true; foreach ($data as $val) { $year = $val['year']; - $var=!$var; - print ''; + print ''; print ''.$val['label'].''; if ($label2) print ''.$val['label2'].''; print ''.$val['nb'].''; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 6acdd1e56b7..4126fc6e68c 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -141,7 +141,7 @@ if (! $mesg) $head = member_stats_prepare_head($adh); -dol_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), 0, 'user'); +dol_fiche_head($head, 'statssubscription', $langs->trans("Statistics"), -1, 'user'); print '
'; @@ -176,15 +176,13 @@ print ''.$langs->trans("AmountAverage").''; print ''; $oldyear=0; -$var=true; foreach ($data as $val) { $year = $val['year']; while ($oldyear > $year+1) { // If we have empty year $oldyear--; - $var=!$var; - print ''; + print ''; print ''; print ''; print $oldyear; @@ -195,8 +193,7 @@ foreach ($data as $val) print '0'; print ''; } - $var=!$var; - print ''; + print ''; print ''; //print ''; print $year; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 0c9c8467f1f..dc66e080f48 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -821,12 +821,10 @@ if ($rowid > 0) } print "\n"; - $var=True; while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + print ''; $subscriptionstatic->ref=$objp->crowid; $subscriptionstatic->id=$objp->crowid; print ''.$subscriptionstatic->getNomUrl(1).''; diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index c8f68d2151c..5cb10e31e6d 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -145,7 +145,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent- $result=$object->delete($user); if ($result > 0) { - header("Location: card_subscriptions.php?rowid=".$object->fk_adherent); + header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent); exit; } else diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index d8116c79e94..750ad483461 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -40,6 +40,8 @@ $search_account=GETPOST('search_account','int'); $search_amount=GETPOST('search_amount','alpha'); $optioncss = GETPOST('optioncss','alpha'); +$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; + $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -51,7 +53,19 @@ $pagenext = $page + 1; if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="c.dateadh"; } -$date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array('subscriptionlist')); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('subscription'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( +); +$arrayfields=array( +); // Security check $result=restrictedArea($user,'adherent','','','cotisation'); @@ -61,16 +75,32 @@ $result=restrictedArea($user,'adherent','','','cotisation'); * Actions */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; } + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $search=""; - $search_ref=""; - $search_lastname=""; - $search_firstname=""; - $search_login=""; - $search_note=""; - $search_amount=""; - $search_account=""; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers + { + $search=""; + $search_ref=""; + $search_lastname=""; + $search_firstname=""; + $search_login=""; + $search_note=""; + $search_amount=""; + $search_account=""; + $toselect=''; + $search_array_options=array(); + } } @@ -84,7 +114,7 @@ llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Modu // List of subscriptions -$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe,"; +$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,"; $sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.dateadh,"; $sql.= " c.datef,"; @@ -123,7 +153,10 @@ $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; + + $arrayofselected=is_array($toselect)?$toselect:array(); + + $i = 0; $title=$langs->trans("ListOfSubscriptions"); if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; @@ -139,6 +172,16 @@ if ($result) if ($search_amount) $param.="&search_amount=".$search_amount; if ($optioncss != '') $param.='&optioncss='.$optioncss; + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if($user->rights->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); + if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + //if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + print ''; if ($optioncss != '') print ''; print ''; @@ -146,8 +189,9 @@ if ($result) print ''; print ''; print ''; + print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); if ($sall) { @@ -156,39 +200,27 @@ if ($result) $moreforfilter = ''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) - { - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder); - } - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); - print "\n"; - - // Line for filters fields - print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; print ''; + print ''; if (! empty($conf->banque->enabled)) { @@ -202,65 +234,83 @@ if ($result) print ''; print ''; // Action column print ''; print "\n"; + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) + { + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder); + } + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + // Static objects $subscription=new Subscription($db); $adherent=new Adherent($db); $accountstatic=new Account($db); - $var=true; $total=0; while ($i < min($num, $limit)) { - $objp = $db->fetch_object($result); - $total+=$objp->subscription; + $obj = $db->fetch_object($result); + $total+=$obj->subscription; - $subscription->ref=$objp->crowid; - $subscription->id=$objp->crowid; + $subscription->ref=$obj->crowid; + $subscription->id=$obj->crowid; - $adherent->lastname=$objp->lastname; - $adherent->firstname=$objp->firstname; - $adherent->ref=$adherent->getFullName($langs); - $adherent->id=$objp->rowid; - $adherent->login=$objp->login; + $adherent->lastname=$obj->lastname; + $adherent->firstname=$obj->firstname; + $adherent->ref=$obj->rowid; + $adherent->id=$obj->rowid; + $adherent->statut=$obj->statut; + $adherent->login=$obj->login; + $adherent->photo=$obj->photo; - $var=!$var; + - print ""; + print ''; // Ref print ''; // Lastname - print ''; + print ''; // Login print ''; // Libelle print ''; // Banque if (! empty($conf->banque->enabled)) { - if ($objp->fk_account) + if ($obj->fk_account) { - $accountstatic->id=$objp->fk_account; - $accountstatic->fetch($objp->fk_account); - //$accountstatic->label=$objp->label; + $accountstatic->id=$obj->fk_account; + $accountstatic->fetch($obj->fk_account); + //$accountstatic->label=$obj->label; print ''; } else @@ -271,13 +321,13 @@ if ($result) } // Date start - print '\n"; + print '\n"; // Date end - print '\n"; + print '\n"; // Price - print ''; + print ''; print ''; @@ -287,7 +337,7 @@ if ($result) } // Total - $var=!$var; + print ''; print "\n"; print "\n"; diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index f593e72faa9..19324812beb 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -33,7 +33,7 @@ $var=true; $total=0; foreach($linkedObjectBlock as $key => $objectlink) { - $var=!$var; + ?> > diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 846b0dab7a9..ab6bfcc0704 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -206,12 +206,10 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print "\n"; - $var=True; while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + print ''; print ''; print ''; print ''; @@ -518,7 +516,6 @@ if ($rowid > 0) print "\n"; - $var=True; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($resql); @@ -530,8 +527,7 @@ if ($rowid > 0) $adh->firstname=$objp->firstname; // Lastname - $var=!$var; - print ''; + print ''; if ($objp->societe != '') { print ''."\n"; diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index c11cbeff3a4..d076fcf7e26 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -173,8 +173,8 @@ if (! empty($triggers)) if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue; - $var=!$var; - print ''; + + print ''; print ''; print ''; print '"; print ""; // Show external agenda -$var=!$var; -print ""; + +print ''; print ""; print '"; print ""; // Nb of agenda -$var=!$var; -print ""; + +print ''; print ""; print '"; + + print ''; // Nb print '"; // Name diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 9bf3a4ddc16..6e0a62610aa 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -265,7 +265,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) require_once $dir.'/'.$file; $module = new $classname($db, new ActionComm($db)); - $var=!$var; + print "\n"; print "'."\n"; print ''."\n"; // Manual or automatic -$var=!$var; -print ''."\n"; + +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - $var=!$var; + print ''; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; + +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS -$var=!$var; -print ''."\n"; + +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA_DEFAULT_VIEW -$var=!$var; -print ''."\n"; + +print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; // AGENDA NOTIFICATION if ($conf->global->MAIN_FEATURES_LEVEL > 0) { - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print ''."\n"; print ''; + print ''; print ''; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 29475d712df..db81c9a325f 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -215,7 +215,7 @@ if ($resql) { $obj = $db->fetch_object($resql); - print '\n"; - $var=!$var; + $i++; } } @@ -312,8 +312,8 @@ print ''; // Chemin du binaire genbarcode sous linux if (! isset($_SERVER['WINDIR'])) { - $var=!$var; - print ''; + + print ''; print ''; print '"; + + print ''; print ''; print '"; + + print ''; print ''; print ''; + print ''; print ''; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 9785e945a6a..c76c35dfdeb 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -342,7 +342,7 @@ print "\n"; $var=true; foreach($boxtoadd as $box) { - $var=!$var; + if (preg_match('/^([^@]+)@([^@]+)$/i',$box->boximg)) { @@ -354,7 +354,7 @@ foreach($boxtoadd as $box) } print "\n".''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; @@ -421,7 +421,7 @@ foreach($boxactivated as $key => $box) } print "\n".''."\n"; - print ''; + print ''; print ''; @@ -468,7 +468,7 @@ print ''; print ''; print ''; -print ''; +print ''; print ''."\n"; @@ -479,8 +479,8 @@ print ''; // Activate FileCache - Developement if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) { - $var=!$var; - print ''; print ''; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index f319692f27d..fd1da0c328b 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -166,7 +166,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { $var = !$var; - print ''; print ''; print "\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; @@ -471,7 +471,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print '\n"; print "\n"; $var=true; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; print ''; print ''; print ''; -print '\n"; print ''; //Use draft Watermark -$var=!$var; + print ""; print ''; print ""; -print '\n"; @@ -603,8 +610,8 @@ print ''; // Shippable Icon in List /* Kept as hidden feature for the moment, result seems bugged. Whet is definition of "shippable" according to all different STOCK_CALCULATE_... options ? -$var=!$var; -print ""; + +print ''; print ''; print ''; print ''; // Ask for payment bank during order if ($conf->banque->enabled) { - $var=!$var; - print ''; } // Ask for warehouse during order if ($conf->stock->enabled) { - $var=!$var; - print ''; } */ @@ -697,7 +704,7 @@ print ''; print ''; print "\n"; -print '\n"; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 0f8efb23da0..8c29fe67a1c 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; @@ -51,8 +52,6 @@ $error=0; if ( ($action == 'update' && empty($_POST["cancel"])) || ($action == 'updateedit') ) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $tmparray=getCountry(GETPOST('country_id','int'),'all',$db,$langs,0); if (! empty($tmparray['id'])) { @@ -76,21 +75,23 @@ if ( ($action == 'update' && empty($_POST["cancel"])) dolibarr_set_const($db, "MAIN_INFO_SOCIETE_WEB",$_POST["web"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOTE",$_POST["note"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_GENCOD",$_POST["barcode"],'chaine',0,'',$conf->entity); - if ($_FILES["logo"]["tmp_name"]) + + $varforimage='logo'; $dirforimage=$conf->mycompany->dir_output.'/logos/'; + if ($_FILES[$varforimage]["tmp_name"]) { - if (preg_match('/([^\\/:]+)$/i',$_FILES["logo"]["name"],$reg)) + if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg)) { $original_file=$reg[1]; $isimage=image_format_supported($original_file); if ($isimage >= 0) { - dol_syslog("Move file ".$_FILES["logo"]["tmp_name"]." to ".$conf->mycompany->dir_output.'/logos/'.$original_file); - if (! is_dir($conf->mycompany->dir_output.'/logos/')) + dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); + if (! is_dir($dirforimage)) { - dol_mkdir($conf->mycompany->dir_output.'/logos/'); + dol_mkdir($dirforimage); } - $result=dol_move_uploaded_file($_FILES["logo"]["tmp_name"],$conf->mycompany->dir_output.'/logos/'.$original_file,1,0,$_FILES['logo']['error']); + $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']); if ($result > 0) { dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO",$original_file,'chaine',0,'',$conf->entity); @@ -101,8 +102,8 @@ if ( ($action == 'update' && empty($_POST["cancel"])) // Create thumbs //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... - // Used on logon for example - $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + // Create small thumb, Used on logon for example + $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) { $imgThumbSmall = $reg[1]; // Save only basename @@ -110,9 +111,8 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } else dol_syslog($imgThumbSmall); - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); + // Create mini thumb, Used on menu or for setup page for example + $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) { $imgThumbMini = $reg[1]; // Save only basename @@ -143,6 +143,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } } } + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_MANAGERS",$_POST["MAIN_INFO_SOCIETE_MANAGERS"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_CAPITAL",$_POST["capital"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_FORME_JURIDIQUE",$_POST["forme_juridique_code"],'chaine',0,'',$conf->entity); @@ -196,7 +197,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } } -if ($action == 'addthumb') +if ($action == 'addthumb') // Regenerate thumbs { if (file_exists($conf->mycompany->dir_output.'/logos/'.$_GET["file"])) { @@ -208,7 +209,7 @@ if ($action == 'addthumb') // Create thumbs //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... - // Used on logon for example + // Create small thumb. Used on logon for example $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) { @@ -217,8 +218,7 @@ if ($action == 'addthumb') } else dol_syslog($imgThumbSmall); - // Create mini thumbs for company (Ratio is near 16/9) - // Used on menu or for setup page for example + // Create mini thumbs. Used on menu or for setup page for example $imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) { @@ -300,7 +300,7 @@ if ($action == 'edit' || $action == 'updateedit') });'; print ''."\n"; - print ''; + print ''; print ''; print ''; $var=true; @@ -309,72 +309,72 @@ if ($action == 'edit' || $action == 'updateedit') print ''."\n"; // Name - $var=!$var; - print ''."\n"; // Addresse - $var=!$var; - print ''."\n"; - $var=!$var; - print ''."\n"; - $var=!$var; - print ''."\n"; // Country - $var=!$var; - print ''."\n"; - $var=!$var; - print ''."\n"; - $var=!$var; - print ''."\n"; - $var=!$var; - print ''; print ''."\n"; - $var=!$var; - print ''; print ''."\n"; - $var=!$var; - print ''; print ''."\n"; // Web - $var=!$var; - print ''; print ''."\n"; // Barcode if (! empty($conf->barcode->enabled)) { - $var=!$var; - print ''; print ''; } // Logo - $var=!$var; + print '\n"; $var=true; - $var=!$var; + print ""; print '\n"; - $var=!$var; + print ""; print '\n"; - $var=!$var; + print ""; print '\n"; - $var=!$var; + print ""; print ''; // Capital - $var=!$var; - print ''; // Juridical Status - $var=!$var; - print ''; // ProfId1 if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { - $var=!$var; - print ''; + + print ''; print ''; print ''; - $var=!$var; - print ''; + + print ''; print '
'; - print ''; - print ''; - print ''; - print ' '; - print ''; + print ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'.$subscription->getNomUrl(1).''.$adherent->getNomUrl(1).''.$adherent->getNomUrl(-1).''.$adherent->login.''; - print dol_trunc($objp->note,32); + print dol_trunc($obj->note,32); print ''.$accountstatic->getNomUrl(1).''.dol_print_date($db->jdate($objp->dateadh),'day')."'.dol_print_date($db->jdate($obj->dateadh),'day')."'.dol_print_date($db->jdate($objp->datef),'day')."'.dol_print_date($db->jdate($obj->datef),'day')."'.price($objp->subscription).''.price($obj->subscription).'
".$langs->trans("Total")." 
trans("Subscription"); ?> 
'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.''.dol_escape_htmltag($objp->libelle).''.yn($objp->subscription).'
'.img_object($langs->trans("ShowMember"),"user").' '.$adh->getFullName($langs,0,-1,20).' / '.dol_trunc($objp->societe,12).'
'.$trigger['code'].''.$trigger['label'].''; diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 79e6d3dbd6c..1e595b5088e 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -155,8 +155,8 @@ print ''.$langs->trans("Value")."
".$langs->trans("ExtSitesEnableThisTool")."'; if ($conf->use_javascript_ajax) @@ -178,8 +178,8 @@ print "
".$langs->trans("ExtSitesNbOfAgenda")."'; print ''; @@ -210,8 +210,8 @@ while ($i <= $MAXAGENDA) $color='AGENDA_EXT_COLOR'.$key; $enabled='AGENDA_EXT_ENABLED'.$key; - $var=!$var; - print "
'.$langs->trans("AgendaExtNb",$key)."
"; print (empty($module->name)?$name:$module->name); @@ -351,8 +351,8 @@ print ''.$langs->trans("Value").'
'.$langs->trans("AGENDA_USE_EVENT_TYPE").' '."\n"; @@ -369,9 +369,9 @@ print '
'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' '."\n"; @@ -380,8 +380,8 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) } // AGENDA_DEFAULT_FILTER_TYPE -$var=!$var; -print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; @@ -389,8 +389,8 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; @@ -398,8 +398,8 @@ $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_ print '
'.$langs->trans("AGENDA_DEFAULT_VIEW").' '."\n"; @@ -410,8 +410,8 @@ print '
'.$langs->trans('AGENDA_NOTIFICATION').' '."\n"; @@ -422,8 +422,8 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) } else { print ''.img_picto($langs->trans('Enabled'),'switch_on').''; print '
'.$langs->trans('AGENDA_NOTIFICATION_SOUND').' '."\n"; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 58d97842017..98cecb2f44b 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -199,7 +199,7 @@ while ($i < $nbofbank) { $var = !$var; - print '
'.$bankorder[$i][0]."\n"; print $bankorder[$i][1]; print '
'; + print '
'; print $obj->libelle; print "\n"; print $langs->trans('BarcodeDesc'.$obj->encoding); @@ -276,7 +276,7 @@ if ($resql) print ''; print $formbarcode->setBarcodeEncoder($obj->coder,$barcodelist,$obj->rowid,'form'.$i); print "
'.$langs->trans("GenbarcodeLocation").''; print ''; @@ -328,8 +328,8 @@ if (! isset($_SERVER['WINDIR'])) // Module products if (! empty($conf->product->enabled)) { - $var=!$var; - print "
'.$langs->trans("SetDefaultBarcodeTypeProducts").''; $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1); @@ -339,8 +339,8 @@ if (! empty($conf->product->enabled)) // Module thirdparty if (! empty($conf->societe->enabled)) { - $var=!$var; - print "
'.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"GENBARCODE_BARCODETYPE_THIRDPARTY",1); @@ -397,7 +397,7 @@ if ($conf->produit->enabled) $modBarCode = new $file(); $var = !$var; - print '
'.(isset($modBarCode->name)?$modBarCode->name:$modBarCode->nom)."\n"; print $modBarCode->info($langs); print '
'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel); if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; print '
'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel); if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; print ''.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $langs->trans("MaxNbOfLinesForBoxes"); print '
'.$langs->trans("EnableFileCache").''; + + print '
'.$langs->trans("EnableFileCache").''; print $form->selectyesno('MAIN_ACTIVATE_FILECACHE',$conf->global->MAIN_ACTIVATE_FILECACHE,1); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; @@ -257,8 +257,14 @@ $var=true; $var=! $var; -print '
'; -print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnChequeReceipts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='BANK_CHEQUERECEIPT_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index a77fb706a71..060c910753a 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -80,16 +80,16 @@ print '
'.$langs->trans("Name").''.$langs->trans("Value").'
'; + +print '
'; print $langs->trans("ClickToDialUseTelLink").''; print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'
'; print '
'; print $langs->trans("ClickToDialUseTelLinkDesc"); print '
'; + +print '
'; print $langs->trans("DefaultLink").''; print 'global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS?' disabled="disabled"':'').' value="'.$conf->global->CLICKTODIAL_URL.'">
'; print '
'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index a9041f5272b..a4680f4d16e 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -284,7 +284,7 @@ print load_fiche_titre($langs->trans("OrdersSetup"),$linkback,'title_setup'); $head = order_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order'); +dol_fiche_head($head, 'general', $langs->trans("Orders"), -1, 'order'); /* * Orders Numbering model @@ -330,8 +330,8 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print '
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -565,12 +565,18 @@ print " 
'; -print $langs->trans("FreeLegalTextOnOrders").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='ORDER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -588,13 +594,14 @@ print "
'; -print $langs->trans("WatermarkOnDraftOrders").''; -print ''; +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext); +print ''; +print ''; print ''; print ''; print "
'.$langs->trans("ShippableOrderIconInList").' '; @@ -623,8 +630,8 @@ print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { @@ -645,16 +652,16 @@ if ($conf->banque->enabled) } else { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '.$langs->trans('NotAvailable').'
'; + + print '
'; print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { @@ -675,8 +682,8 @@ if ($conf->stock->enabled) } else { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").' '.$langs->trans('NotAvailable').'
 
'; +print '
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print '
'; print "
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; //if (empty($country_selected)) $country_selected=substr($langs->defaultlang,-2); // By default, country of localization print $form->select_country($mysoc->country_id,'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'; + + print '
'; $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE,$mysoc->country_code,'state_id'); print '
'; + + print '
'; print $form->selectCurrency($conf->currency,"currency"); print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; print '
'; print ''; // Note - $var=!$var; - print ''; print ''; @@ -409,18 +409,18 @@ if ($action == 'edit' || $action == 'updateedit') $langs->load("companies"); // Managing Director(s) - $var=!$var; - print ''; // Capital - $var=!$var; - print ''; // Juridical Status - $var=!$var; - print ''; // Object of the company - $var=!$var; - print ''; print ''; @@ -547,8 +547,8 @@ if ($action == 'edit' || $action == 'updateedit') print "\n"; $var=true; - $var=!$var; - print ''; print "
'; print ''; @@ -383,7 +383,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { print '   '; - print ''; + print ''; } } else { print ''; @@ -392,8 +392,8 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; print '
'; + + print '
'; if ($mysoc->country_code) { print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code'); } else { @@ -431,8 +431,8 @@ if ($action == 'edit' || $action == 'updateedit') // ProfID1 if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { - $var=!$var; - print '
'; + + print '
'; if (! empty($mysoc->country_code)) { print ''; @@ -447,8 +447,8 @@ if ($action == 'edit' || $action == 'updateedit') // ProfId2 if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { - $var=!$var; - print '
'; + + print '
'; if (! empty($mysoc->country_code)) { print ''; @@ -463,8 +463,8 @@ if ($action == 'edit' || $action == 'updateedit') // ProfId3 if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { - $var=!$var; - print '
'; + + print '
'; if (! empty($mysoc->country_code)) { print ''; @@ -479,8 +479,8 @@ if ($action == 'edit' || $action == 'updateedit') // ProfId4 if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { - $var=!$var; - print '
'; + + print '
'; if (! empty($mysoc->country_code)) { print ''; @@ -495,8 +495,8 @@ if ($action == 'edit' || $action == 'updateedit') // ProfId5 if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { - $var=!$var; - print '
'; + + print '
'; if (! empty($mysoc->country_code)) { print ''; @@ -511,8 +511,8 @@ if ($action == 'edit' || $action == 'updateedit') // ProfId6 if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { - $var=!$var; - print '
'; + + print '
'; if (! empty($mysoc->country_code)) { print ''; @@ -525,14 +525,14 @@ if ($action == 'edit' || $action == 'updateedit') } // TVA Intra - $var=!$var; - print '
'; + + print '
'; print ''; print '
'; + + print '
'; print '
'; + + print '
'; print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '
"; @@ -563,7 +563,7 @@ if ($action == 'edit' || $action == 'updateedit') print "
'; print ""; @@ -572,7 +572,7 @@ if ($action == 'edit' || $action == 'updateedit') print "
"; print "
'; print ""; @@ -596,7 +596,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; print "\n"; $var=true; - $var=!$var; + // Note: When option is not set, it must not appears as set on on, because there is no default value for this option print ""; print '
 
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."'; @@ -619,7 +619,7 @@ if ($action == 'edit' || $action == 'updateedit') print "
"; print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."'; print ""; @@ -641,7 +641,7 @@ if ($action == 'edit' || $action == 'updateedit') print "\n"; $var=true; - $var=!$var; + // Note: When option is not set, it must not appears as set on on, because there is no default value for this option print ""; print '
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."'; @@ -661,7 +661,7 @@ if ($action == 'edit' || $action == 'updateedit') print "
"; print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."'; print ""; @@ -698,23 +698,23 @@ else print ''; $var=true; - $var=!$var; - print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; + + print ''; // Web - $var=!$var; - print ''; + + print ''; // Barcode if (! empty($conf->barcode->enabled)) { - $var=!$var; - print ''; + + print ''; } // Logo - $var=!$var; - print ''; - $var=!$var; - print ''; + + print ''; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyName").''; + + print '
'.$langs->trans("CompanyName").''; if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM; else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).''; print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyCountry").''; + + print '
'.$langs->trans("CompanyCountry").''; if ($mysoc->country_code) { $img=picto_from_langcode($mysoc->country_code); @@ -724,43 +724,43 @@ else else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyCountry")).''; print '
'.$langs->trans("State").''; + + print '
'.$langs->trans("State").''; if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE); else print ' '; print '
'.$langs->trans("CompanyCurrency").''; + + print '
'.$langs->trans("CompanyCurrency").''; print currency_name($conf->currency,1); print ' ('.$conf->currency; print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : ''); print ')'; print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Logo").''; + + print '
'.$langs->trans("Logo").''; $tagtd='tagtd '; if ($conf->browser->layout == 'phone') $tagtd=''; @@ -775,7 +775,7 @@ else } else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print ''; + print ''; } else { @@ -785,8 +785,8 @@ else print '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'; @@ -802,26 +802,26 @@ else $var=true; // Managing Director(s) - $var=!$var; - print '
'.$langs->trans("ManagingDirectors").''; + + print '
'.$langs->trans("ManagingDirectors").''; print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '
'.$langs->trans("Capital").''; + + print '
'.$langs->trans("Capital").''; print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; + + print '
'.$langs->trans("JuridicalStatus").''; print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); print '
'.$langs->transcountry("ProfId1",$mysoc->country_code).''; + + print '
'.$langs->transcountry("ProfId1",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; @@ -836,8 +836,8 @@ else // ProfId2 if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { - $var=!$var; - print '
'.$langs->transcountry("ProfId2",$mysoc->country_code).''; + + print '
'.$langs->transcountry("ProfId2",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_SIRET)) { print $conf->global->MAIN_INFO_SIRET; @@ -852,8 +852,8 @@ else // ProfId3 if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { - $var=!$var; - print '
'.$langs->transcountry("ProfId3",$mysoc->country_code).''; + + print '
'.$langs->transcountry("ProfId3",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_APE)) { print $conf->global->MAIN_INFO_APE; @@ -868,8 +868,8 @@ else // ProfId4 if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { - $var=!$var; - print '
'.$langs->transcountry("ProfId4",$mysoc->country_code).''; + + print '
'.$langs->transcountry("ProfId4",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_RCS)) { print $conf->global->MAIN_INFO_RCS; @@ -884,8 +884,8 @@ else // ProfId5 if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { - $var=!$var; - print '
'.$langs->transcountry("ProfId5",$mysoc->country_code).''; + + print '
'.$langs->transcountry("ProfId5",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_PROFID5)) { print $conf->global->MAIN_INFO_PROFID5; @@ -900,8 +900,8 @@ else // ProfId6 if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { - $var=!$var; - print '
'.$langs->transcountry("ProfId6",$mysoc->country_code).''; + + print '
'.$langs->transcountry("ProfId6",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_PROFID6)) { print $conf->global->MAIN_INFO_PROFID6; @@ -914,8 +914,8 @@ else } // VAT - $var=!$var; - print '
'.$langs->trans("VATIntra").'
'.$langs->trans("VATIntra").''; if (! empty($conf->global->MAIN_INFO_TVAINTRA)) { @@ -951,8 +951,8 @@ else print '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'; print ''; @@ -967,8 +967,8 @@ else print "\n"; $var=true; - $var=!$var; - print ''.$langs->trans("FiscalMonthStart").''; + + print ''.$langs->trans("FiscalMonthStart").''; $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1; print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . ''; @@ -985,7 +985,7 @@ else print "\n"; $var=true; - $var=!$var; + print "global->FACTURE_TVAOPTION)?"":" checked")."> ".$langs->trans("VATIsUsed").""; print ''; print ""; @@ -994,7 +994,7 @@ else print "
"; print "\n"; - $var=!$var; + print "global->FACTURE_TVAOPTION)?" checked":"")."> ".$langs->trans("VATIsNotUsed").""; print ''; print ""; @@ -1020,7 +1020,7 @@ else print "\n"; $var=true; - $var=!$var; + print ""; print '\n"; - $var=!$var; + print ""; print ''; + print ''; print ''; print ''; print ''; @@ -239,7 +239,7 @@ else print ''; $var=false; - print ''; + print ''; print ''; print '
global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1on")?" checked":"")."> ".$langs->transcountry("LocalTax1IsUsed",$mysoc->country_code)."'; print ""; @@ -1048,7 +1048,7 @@ else print "
"; print "
global->FACTURE_LOCAL_TAX1_OPTION) || $conf->global->FACTURE_LOCAL_TAX1_OPTION == "localtax1off")?" checked":"")."> ".$langs->transcountry("LocalTax1IsNotUsed",$mysoc->country_code)."'; print ""; @@ -1071,7 +1071,7 @@ else print "\n"; $var=true; - $var=!$var; + print ""; print '\n"; - $var=!$var; + print ""; print ''; + print ''; print ''; print ''; @@ -192,7 +192,7 @@ if ($action == 'edit') print ''; $var=false; - print ''; + print ''; print ''; print '
global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2on")?" checked":"")."> ".$langs->transcountry("LocalTax2IsUsed",$mysoc->country_code)."'; print ""; @@ -1100,7 +1100,7 @@ else print "
"; print "
global->FACTURE_LOCAL_TAX2_OPTION) || $conf->global->FACTURE_LOCAL_TAX2_OPTION == "localtax2off")?" checked":"")."> ".$langs->transcountry("LocalTax2IsNotUsed",$mysoc->country_code)."'; print ""; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index abe5663084b..c097b9f39b1 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -148,7 +148,7 @@ print "\n"; foreach ($list as $key) { - $var=!$var; + print ''; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 7fa47724c3d..7d7b8a8510c 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -197,7 +197,7 @@ print "\n"; $var=false; print "\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; + print ''."\n"; // Value print ''; @@ -406,7 +406,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print ''; print "\n"; $var=true; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; -print ''."\n"; //Use draft Watermark -$var=!$var; -print ''."\n"; diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php new file mode 100644 index 00000000000..96fef57e7cf --- /dev/null +++ b/htdocs/admin/defaultvalues.php @@ -0,0 +1,310 @@ + + * + * 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 . + */ + +/** + * \file htdocs/admin/defaultvalues.php + * \brief Page to set default values used used in a create form + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + +$langs->load("companies"); +$langs->load("products"); +$langs->load("admin"); +$langs->load("sms"); +$langs->load("other"); +$langs->load("errors"); + +if (!$user->admin) accessforbidden(); + +$id=GETPOST('rowid','int'); +$action=GETPOST('action','alpha'); + +$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder' + +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='page,param'; +if (! $sortorder) $sortorder='ASC'; + +$defaulturl = GETPOST('defaulturl'); +$defaultkey = GETPOST('defaultkey','alpha'); +$defaultvalue = GETPOST('defaultvalue'); + +$defaulturl=preg_replace('/^\//', '', $defaulturl); + + +/* + * Actions + */ + +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Purge search criteria +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers +{ + $defaulturl=''; + $defaultkey=''; + $defaultvalue=''; + $toselect=''; + $search_array_options=array(); +} + + +if ($action == 'add' || (GETPOST('add') && $action != 'update')) +{ + $error=0; + + if (empty($defaulturl)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors'); + $error++; + } + if (empty($defaultkey)) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Key")), null, 'errors'); + $error++; + } + if (! $error) + { + $db->begin(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")"; + $result = $db->query($sql); + if ($result > 0) + { + $db->commit(); + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $action=""; + $defaulturl=''; + $defaultkey=''; + $defaultvalue=''; + } + else + { + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + $action=''; + } + } +} + +// Delete line from delete picto +if ($action == 'delete') +{ + $sql = "DELETE FROM ".MAIN_DB_PREFIX."default_values WHERE rowid = ".$db->escape($id); + // Delete const + $result = $db->query($sql); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + } + else + { + dol_print_error($db); + } +} + + + + + + +/* + * View + */ + +$form=new Form($db); +$formadmin = new FormAdmin($db); + +$wikihelp='EN:Setup|FR:Paramétrage|ES:Configuración'; +llxHeader('',$langs->trans("Setup"),$wikihelp); + +print load_fiche_titre($langs->trans("DefaultValues"),'','title_setup'); + +print $langs->trans("DefaultValuesDesc")."
\n"; +print "
\n"; + +$param='&mode='.$mode; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($optioncss != '') $param.='&optioncss='.$optioncss; +if (defaulturl) $param.='&defaulturl='.urlencode(defaulturl); +if (defaultkey) $param.='&defaultkey='.urlencode(defaultkey); +if (defaultvalue) $param.='&defaultvalue='.urlencode(defaultvalue); + + +print '
entity) && $debug)?'?debug=1':'').'" method="POST">'; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$head=defaultvalues_prepare_head(); + +dol_fiche_head($head, $mode, '', -1, ''); + + +print ''; +print ''; +print ''; + +print '
'; print ''; print ''; @@ -247,11 +247,11 @@ if ($result) while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; + print "\n"; - print '
'.$obj->name.'
'.$obj->name.''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 487203c9f4d..ddd8c6f1c00 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -266,8 +266,8 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print '
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -502,9 +502,15 @@ print ''.$langs->trans("Value").'
'; -print $langs->trans("FreeLegalTextOnContracts").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnContracts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='CONTRACT_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -519,9 +525,10 @@ else print '
'; -print $langs->trans("WatermarkOnDraftContractCards").''; + +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext); +print ''; print ''; print '
'; +print ''; +$texthelp=$langs->trans("PageUrlForDefaultValues"); +if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php'); +else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php'); +$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp); +print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder); +$texthelp=$langs->trans("TheKeyIsTheNameOfHtmlField"); +if ($mode != 'sortorder') $textkey=$form->textwithpicto($langs->trans("Key"), $texthelp); +else $textkey=$form->textwithpicto($langs->trans("Key"), $texthelp); +print_liste_field_titre($textkey,$_SERVER["PHP_SELF"],'param','',$param,'',$sortfield,$sortorder); +if ($mode != 'sortorder') +{ + $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; + // See list into GETPOST + $texthelp.='__USERID__
'; + $texthelp.='__SUPERVISORID__
'; + $texthelp.='__MYCOUNTRYID__
'; + $texthelp.='__DAY__
'; + $texthelp.='__MONTH__
'; + $texthelp.='__YEAR__
'; + if (! empty($conf->multicompany->enabled)) $texthelp.='__ENTITYID__
'; + $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, ''); +} +else +{ + $texthelp='ASC or DESC'; + $textvalue=$form->textwithpicto($langs->trans("SortOrder"), $texthelp); +} +print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder); +if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder); +print ''; +print "\n"; + + +// Line to add new record +print "\n"; + +print ''; +print ''."\n"; +print ''; +print ''; +// Limit to superadmin +if (! empty($conf->multicompany->enabled) && !$user->entity) +{ + print ''; + print '\n"; +print ''; + + +// Show constants +$sql = "SELECT rowid, entity, type, page, param, value"; +$sql.= " FROM ".MAIN_DB_PREFIX."default_values"; +$sql.= " WHERE type = '".$db->escape($mode)."'"; +$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")"; +$sql.= $db->order($sortfield, $sortorder); + +dol_syslog("translation::select from table", LOG_DEBUG); +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + + while ($i < $num) + { + $obj = $db->fetch_object($result); + + + print "\n"; + + print ''; + + print ''."\n"; + print ''."\n"; + + // Value + print ''; + + print ''; + + print "\n"; + print "\n"; + $i++; + } +} +else +{ + dol_print_error($db); +} + + +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + print ''; + print ''; +} +else +{ + print ''; + print ''; +} +print ''; +print "
'.$obj->page.''.$obj->param.''; + /*print ''; + print ''; + print ''; + print ''; + */ + print $obj->value; + print ''; + print ''.img_delete().''; + print '
'; + +dol_fiche_end(); + +print "\n"; + + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 597327c04ba..0280673906b 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -173,9 +173,9 @@ if ($action == 'edit') { foreach($delays as $delay) { - $var=!$var; + $value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0); - print '
'.img_object('',$delay['img']).''.$langs->trans('Delays_'.$delay['code']).''; print ' '.$langs->trans("days").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").'' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '
'; @@ -220,9 +220,9 @@ else { foreach($delays as $delay) { - $var=!$var; + $value=(! empty($conf->global->{$delay['code']})?$conf->global->{$delay['code']}:0); - print '
'.img_object('',$delay['img']).''.$langs->trans('Delays_'.$delay['code']).''.$value.' '.$langs->trans("days").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_METEO").'' . yn($conf->global->MAIN_DISABLE_METEO) . '
'; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7392ca23905..c8632f57772 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -78,6 +78,7 @@ $pageprev = $page - 1; $pagenext = $page + 1; $search_country_id = GETPOST('search_country_id','int'); +$search_code = GETPOST('search_code','alpha'); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('admin')); @@ -569,6 +570,7 @@ if ($id == 10) if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x')) { $search_country_id = ''; + $search_code = ''; } // Actions add or modify an entry into a dictionary @@ -658,7 +660,11 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null - + if ($id == 10 && isset($_POST["code"])) // Spaces are not allowed into code + { + $_POST["code"]=preg_replace('/\s/','',$_POST["code"]); + } + // Si verif ok et action add, on ajoute la ligne if ($ok && GETPOST('actionadd')) { @@ -803,7 +809,7 @@ if ($action == $acts[0]) $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; } elseif ($_GET["code"]) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'"; + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".dol_escape_htmltag($_GET["code"])."'"; } $result = $db->query($sql); @@ -823,7 +829,7 @@ if ($action == $acts[1]) $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; } elseif ($_GET["code"]) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'"; + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".dol_escape_htmltag($_GET["code"])."'"; } $result = $db->query($sql); @@ -843,7 +849,7 @@ if ($action == 'activate_favorite') $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'"; } elseif ($_GET["code"]) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$_GET["code"]."'"; + $sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".dol_escape_htmltag($_GET["code"])."'"; } $result = $db->query($sql); @@ -863,7 +869,7 @@ if ($action == 'disable_favorite') $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'"; } elseif ($_GET["code"]) { - $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$_GET["code"]."'"; + $sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".dol_escape_htmltag($_GET["code"])."'"; } $result = $db->query($sql); @@ -915,7 +921,7 @@ print "
\n"; // Confirmation de la suppression de la ligne if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); + print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.urlencode($_GET["code"]).'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); } //var_dump($elementList); @@ -927,12 +933,9 @@ if ($id) // Complete requete recherche valeurs avec critere de tri $sql=$tabsql[$id]; - if ($search_country_id > 0) - { - if (preg_match('/ WHERE /',$sql)) $sql.= " AND "; - else $sql.=" WHERE "; - $sql.= " c.rowid = ".$search_country_id; - } + if (! preg_match('/ WHERE /',$sql)) $sql.= " WHERE 1 = 1"; + if ($search_country_id > 0) $sql.= " AND c.rowid = ".$search_country_id; + if ($search_code != '') $sql.= natural_search("code", $search_code); if ($sortfield) { @@ -961,16 +964,15 @@ if ($id) print ''; print ''; - print ''; - // Form to add a new line if ($tabname[$id]) { $alabelisused=0; - $var=false; - + $fieldlist=explode(',',$tabfield[$id]); + print '
'; + // Line for title print ''; foreach ($fieldlist as $field => $value) @@ -979,38 +981,40 @@ if ($id) // dans les dictionnaires de donnees $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; + $class=''; if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } if ($fieldlist[$field]=='taux') { if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); else $valuetoshow=$langs->trans("Amount"); - $align='center'; + $class='center'; } - if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $align="center"; } - if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $align="center"; } + if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $class="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $class="center"; } + if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $class="center"; $sortable=0; } + if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $class="center"; } if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } 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,'')); else $valuetoshow=$langs->trans("Type"); } - if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } + if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); $class='width100'; } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { - $valuetoshow=$langs->trans("Label"); - if ($id != 25) $valuetoshow.="*"; + if ($id != 25) $valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); + else $valuetoshow=$langs->trans("Label"); + } + if ($fieldlist[$field]=='libelle_facture') { + $valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='country') { if (in_array('region_id',$fieldlist)) { print ''; continue; } // For region page, we do not show the country input $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } + if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $class="center"; } if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } + if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $class="center"; } if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } @@ -1051,7 +1055,7 @@ if ($id) if ($valuetoshow != '') { - print ''; // Line to enter new values - print ""; + print ''; $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. @@ -1087,7 +1091,7 @@ if ($id) $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; - if ($id == 3) unset($fieldlist[2]); // Remove field ??? if ??? + if ($id == 3) unset($fieldlist[2]); // Remove field ??? if dictionnary Regions if (empty($reshook)) { @@ -1106,15 +1110,22 @@ if ($id) $colspan=count($fieldlist)+3; if ($id == 4) $colspan++; - if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * + print '
 '; + print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; @@ -1069,7 +1073,7 @@ if ($id) print '
'; + + /*if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * { - print '* '.$langs->trans("LabelUsedByDefault").'.'; - } - print ' '; // Keep   to have a line with enough height + print '* '.$langs->trans("LabelUsedByDefault").'.
'; + }*/ } + print ''; - + print '
'; + + print '
'; + print ''; + print ''; + // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); $resql=$db->query($sql); @@ -1122,10 +1133,10 @@ if ($id) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param = '&id='.$id; if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id; + if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id); $paramwithsearch = $param; if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder; if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield; @@ -1134,13 +1145,56 @@ if ($id) // There is several pages if ($num > $listlimit) { - print ''; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); - print ''; } + print ''; + + // Title line with search boxes + print ''; + $filterfound=0; + foreach ($fieldlist as $field => $value) + { + $showfield=1; // By defaut + + if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } + + if ($showfield) + { + if ($value == 'country') + { + print ''; + $filterfound++; + } + elseif ($value == 'code') + { + print ''; + $filterfound++; + } + else + { + print ''; + } + } + } + if ($id == 4) print ''; + print ''; + print ''; + print ''; + // Title of lines - print ''; + print ''; foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles @@ -1175,10 +1229,14 @@ if ($id) if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { - $valuetoshow=$langs->trans("Label"); - if ($id != 25) $valuetoshow.="*"; + //if ($id != 25) $valuetoshow=$form->textwithtooltip($langs->trans("Label"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); + //else $valuetoshow=$langs->trans("Label"); + $valuetoshow=$langs->trans("Label"); + } + if ($fieldlist[$field]=='libelle_facture') { + //$valuetoshow=$form->textwithtooltip($langs->trans("LabelOnDocuments"), $langs->trans("LabelUsedByDefault"),2,1,img_help(1,'')); + $valuetoshow=$langs->trans("LabelOnDocuments"); } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } @@ -1229,51 +1287,14 @@ if ($id) print getTitleFieldOfList(''); print ''; - // Title line with search boxes - print ''; - $filterfound=0; - foreach ($fieldlist as $field => $value) - { - $showfield=1; // By defaut - - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - - if ($showfield) - { - if ($value == 'country') - { - print ''; - $filterfound++; - } - else - { - print ''; - } - } - } - if ($id == 4) print ''; - print ''; - print ''; - print ''; - if ($num) { // Lines with values while ($i < $num) { - $var = ! $var; - $obj = $db->fetch_object($resql); //print_r($obj); - print ''; + print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { $tmpaction='edit'; @@ -1295,7 +1316,7 @@ if ($id) else { $tmpaction = 'view'; - $parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); + $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; @@ -1304,7 +1325,6 @@ if ($id) { foreach ($fieldlist as $field => $value) { - $showfield=1; $align="left"; $valuetoshow=$obj->{$fieldlist[$field]}; @@ -1472,7 +1492,8 @@ if ($id) $class='tddict'; if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; - // Show value for field + if ($fieldlist[$field] == 'code') $class.=' width100'; + // Show value for field if ($showfield) print ''; } } @@ -1491,8 +1512,11 @@ if ($id) $canbemodified=$iserasable; if ($obj->code == 'RECEP') $canbemodified=1; + // Url $rowidcol=$tabrowid[$id]; - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->{$rowidcol})?$obj->{$rowidcol}:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); + // If rowidcol not defined + if (empty($rowidcol) || in_array($id, array(6,7,8,13,17,19,27))) $rowidcol='rowid'; + $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.((! empty($obj->{$rowidcol}) || $obj->{$rowidcol} == '0')?$obj->{$rowidcol}:(! empty($obj->code)?urlencode($obj->code):'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); if ($param) $url .= '&'.$param; $url.='&'; @@ -1537,12 +1561,13 @@ if ($id) $i++; } } + + print '
'; + print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); + print ''; + print ''; + print ''; + print ''; + if ($filterfound) + { + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + } + print '
'; - print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); - print ''; - if ($filterfound) - { - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - } - print '
'.$valuetoshow.'
'; } else { dol_print_error($db); } - print ''; print '
'; } @@ -1552,7 +1577,6 @@ else * Show list of dictionary to show */ - $var=true; $lastlineisempty=false; print ''; print ''; @@ -1570,14 +1594,14 @@ else { if ($showemptyline) { - $var=!$var; - print ''; + + print ''; $showemptyline=0; } - $var=!$var; + $value=$tabname[$i]; - print ''; } @@ -1725,13 +1749,29 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') print ''; } elseif (in_array($fieldlist[$field], array('libelle_facture'))) { - print ''; + print ''; } elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { print ''; } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { - print ''; + print ''; } elseif ($fieldlist[$field]=='unit') { print ''; } } diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 41824fea4c6..7b7357ee9eb 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -84,8 +84,8 @@ $var=true; $form = new Form($db); // Mail required for members -$var=!$var; -print ''; + +print ''; print ''; print ''; diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 892e0860cbd..161b1aac45d 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -99,8 +99,8 @@ foreach ($eventstolog as $key => $arr) { if ($arr['id']) { - $var=!$var; - print ''; + + print ''; print ''; print '"; print "\n"; print ""; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + print '\n"; print '\n"; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index a26a21fbede..dad17585e2e 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -275,8 +275,8 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var=!$var; - print ''; @@ -398,7 +398,7 @@ foreach ($dirmodels as $reldir) if (file_exists($dir.'/'.$file)) { - $var=!$var; + $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); @@ -412,7 +412,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - print ''; print "\n"; $var=true; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; -print ''."\n"; //Use draft Watermark -$var=!$var; -print ''."\n"; diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 8e550f98c99..30646b749fa 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -206,13 +206,13 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; print '
   
   
'; + print '
'; if (! empty($tabcond[$i])) { print ''.$langs->trans($tablib[$i]).''; @@ -1657,7 +1681,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate) { $country_id = (! empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]} : 0); - print ''; + print ''; print ''; print ''; + $transfound=0; + // Special case for labels + if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { + $langs->load("bills"); + $transkey="PaymentCondition".strtoupper($obj->code); + } + if ($langs->trans($transkey) != $transkey) + { + $transfound=1; + print $form->textwithpicto($langs->trans($transkey), $langs->trans("GoIntoTranslationMenuToChangeThis")); + } + if (! $transfound) + { + print ''; + } + print ''; @@ -1769,16 +1809,36 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } else { - print ''; - $size=''; $class=''; - if ($fieldlist[$field]=='code') $class='maxwidth100'; + $classtd=''; $class=''; + if ($fieldlist[$field]=='code') $classtd='width100'; if ($fieldlist[$field]=='affect') $class='maxwidth50'; if ($fieldlist[$field]=='delay') $class='maxwidth50'; if ($fieldlist[$field]=='position') $class='maxwidth50'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='tracking') $class='quatrevingtpercent'; - if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; - print ''; + if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $class='maxwidth50'; + print ''; + $transfound=0; + if (in_array($fieldlist[$field], array('label','libelle'))) + { + // Special case for labels + if ($tabname == MAIN_DB_PREFIX.'c_civility') { + $transkey="Civility".strtoupper($obj->code); + } + if ($tabname == MAIN_DB_PREFIX.'c_payment_term') { + $langs->load("bills"); + $transkey="PaymentCondition".strtoupper($obj->code); + } + if ($langs->trans($transkey) != $transkey) + { + $transfound=1; + print $form->textwithpicto($langs->trans($transkey), $langs->trans("GoIntoTranslationMenuToChangeThis")); + } + } + if (! $transfound) + { + print ''; + } print '
'.$langs->trans("ECMAutoTree").' 
'.$arr['id'].''; $key='MAIN_LOGEVENTS_'.$arr['id']; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index ef8b10c411f..d31b788a1ab 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -502,8 +502,14 @@ print "
".$langs->trans("Parameter")."
'; -print $langs->trans("FreeLegalTextOnShippings").' ('.$langs->trans("AddCRIfTooLong").')
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='SHIPPING_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -518,7 +524,7 @@ else print "
'; -print $langs->trans("WatermarkOnDraft").'
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext).'
'; print ''; print "
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -505,9 +505,15 @@ print '
'; -print $langs->trans("FreeLegalTextOnExpenseReports").' ('.$langs->trans("AddCRIfTooLong").')
'; +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnExpenseReports"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='EXPENSEREPORT_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -522,9 +528,9 @@ else print '
'; -print $langs->trans("WatermarkOnDraftOrders").'
'; + +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftExpenseReports"), $htmltext).'
'; print ''; print '
'.$langs->trans("Example").'
'.$langs->trans("Title").''.$langs->trans('RSSUrlExample').'
'.$langs->trans('RSSUrl').'http://news.google.com/news?ned=us&topic=h&output=rss
http://www.dolibarr.org/rss
'; @@ -243,10 +243,12 @@ if ($resql) preg_match('/^([0-9]+)/i',$obj->note,$reg); $idrss = $reg[1]; - //print "x".$idrss; + $keyrssurl="EXTERNAL_RSS_URLRSS_".$idrss; + $keyrsstitle="EXTERNAL_RSS_URLRSS_".$idrss; + //print "x".$idrss; $rssparser=new RssParser($db); - $result = $rssparser->parser(@constant("EXTERNAL_RSS_URLRSS_".$idrss), 5, 300, $conf->externalrss->dir_temp); + $result = $rssparser->parser($conf->global->$keyrssurl, 5, 300, $conf->externalrss->dir_temp); $var=true; @@ -266,20 +268,20 @@ if ($resql) print ''; print ""; - $var=!$var; - print ""; + + print ''; print "".$langs->trans("Title").""; - print ""; + print "global->$keyrsstitle . "\">"; print ""; - $var=!$var; - print ""; + + print ''; print "".$langs->trans("URL").""; - print ""; + print "global->$keyrssurl . "\">"; print ""; - $var=!$var; - print ""; + + print ''; print "".$langs->trans("Status").""; print ""; if ($result > 0 && empty($rss->error)) @@ -299,11 +301,13 @@ if ($resql) // Logo if ($result > 0 && empty($rss->error)) { - $var=!$var; - print ""; + + print ''; print "".$langs->trans("Logo").""; print ''; $imageurl=$rssparser->getImageUrl(); + $linkrss=$rssparser->getLink(); + if (! preg_match('/^http/', $imageurl)) $imageurl=$linkrss.$imageurl; if ($imageurl) print ''; else print $langs->trans("None"); print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 42000e7176d..d89c9711e3f 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -279,7 +279,7 @@ $linkback='
'.$langs->trans("BackToM print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); $head = invoice_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice'); +dol_fiche_head($head, 'general', $langs->trans("Invoices"), -1, 'invoice'); /* * Numbering module @@ -339,7 +339,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { $var = !$var; - print ''; + print ''; echo preg_replace('/\-.*$/','',preg_replace('/mod_facture_/','',preg_replace('/\.php$/','',$file))); print "\n"; @@ -530,7 +530,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print ''; + print ''; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -628,8 +628,8 @@ print ''; print $langs->trans("PaymentMode").''; print ''; print "\n"; -$var=!$var; -print ''; + +print ''; print "".$langs->trans("SuggestPaymentByRIBOnAccount").""; print ""; if (! empty($conf->banque->enabled)) @@ -638,7 +638,7 @@ if (! empty($conf->banque->enabled)) $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql.= " WHERE clos = 0"; $sql.= " AND courant = 1"; - $sql.= " AND entity IN (".getEntity('bank', 1).")"; + $sql.= " AND entity IN (".getEntity('bank_account', 1).")"; $resql=$db->query($sql); if ($resql) { @@ -671,8 +671,8 @@ else print $langs->trans("BankModuleNotActive"); } print ""; -$var=!$var; -print ''; + +print ''; print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; print ''; print ''; -print ''; +print ''; print $langs->trans("ForceInvoiceDate"); print ''; print $form->selectyesno("forcedate",$conf->global->FAC_FORCE_DATE_VALIDATION,1); @@ -733,12 +733,18 @@ print '\n"; print ''; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; print '
'; print ''; print ''; -print ''; -print $langs->trans("FreeLegalTextOnInvoices").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +print ''; +print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='INVOICE_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -755,12 +761,13 @@ print '\n"; print '
'; -$var=!$var; + print '
'; print ''; print ''; -print ''; -print $langs->trans("WatermarkOnDraftBill").''; +print ''; +print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext); +print ''; print ''; print ''; print ''; @@ -800,7 +807,7 @@ print ''; print ' '; print "\n"; -print ''; +print ''; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print ''; print "\n"; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 23ff67f92e7..9f1d3913630 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -159,8 +159,8 @@ else // Si condition non remplie, on ne propose pas l'option if (! $conditions[$const]) continue; - $var=!$var; - print ""; + + print ''; print ''.img_object("",$picto[$const]).''; print ''.$langs->trans($desc).''; print ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 8d31db0d3af..0b01f56857e 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -310,8 +310,8 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var=!$var; - print ''.$module->nom."\n"; + + print ''.$module->nom."\n"; print $module->info(); print ''; @@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir) { if (file_exists($dir.'/'.$file)) { - $var=!$var; + $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); @@ -447,7 +447,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - print ''; + print ''; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -534,12 +534,18 @@ print " \n"; print "\n"; $var=true; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; print ''; print ''; print ''; -print ''; -print $langs->trans("FreeLegalTextOnInterventions").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +print ''; +print $form->textwithpicto($langs->trans("FreeLegalTextOnInterventions"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='FICHINTER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -557,12 +563,13 @@ print "\n"; print '
'; //Use draft Watermark -$var=!$var; + print "
"; print ''; print ""; -print ''; -print $langs->trans("WatermarkOnDraftInterventionCards").''; +print ''; +print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext).'
'; +print ''; print ''; print ''; print ''; @@ -573,7 +580,7 @@ $var=! $var; print ''; print ''; print ''; -print ''; +print ''; print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')'; print 'global->FICHINTER_PRINT_PRODUCTS) diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index b4d379e15d1..5a69a356777 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -105,8 +105,8 @@ print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; print "\n"; -$var=!$var; -print ''.$langs->trans("PathToGeoIPMaxmindCountryDataFile").''; + +print ''.$langs->trans("PathToGeoIPMaxmindCountryDataFile").''; print ''; if ($geointernal) print 'Using geoip PHP internal functions. Value must be '.geoip_db_filename(GEOIP_COUNTRY_EDITION).' or '.geoip_db_filename(GEOIP_CITY_EDITION_REV1).'
'; diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 03fab048962..193ee35a80f 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -26,6 +26,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; @@ -70,6 +72,26 @@ if (GETPOST('cancel')) $action=''; } +if ($action == 'removebackgroundlogin' && ! empty($conf->global->MAIN_LOGIN_BACKGROUND)) +{ + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + $logofile=$conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND; + dol_delete_file($logofile); + dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND",$conf->entity); + $mysoc->logo=''; + + /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small; + dol_delete_file($logosmallfile); + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity); + $mysoc->logo_small=''; + + $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini; + dol_delete_file($logominifile); + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity); + $mysoc->logo_mini='';*/ +} + if ($action == 'update') { dolibarr_set_const($db, "MAIN_LANG_DEFAULT", $_POST["main_lang_default"],'chaine',0,'',$conf->entity); @@ -97,7 +119,7 @@ if ($action == 'update') if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity); else dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', implode(',',colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'),array())),'chaine',0,'',$conf->entity); - if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_del_const($db, "THEME_ELDY_USE_HOVER", $conf->entity); + if (GETPOST('THEME_ELDY_USE_HOVER') == '') dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", '0', 'chaine', 0, '', $conf->entity); // If empty, we set to '0' ('000000' is for black) else dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $_POST["THEME_ELDY_USE_HOVER"], 'chaine', 0, '', $conf->entity); $val=(implode(',',(colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'),array())))); @@ -120,9 +142,78 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity); - // This one is not always defined - if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); - + $varforimage='imagebackground'; $dirforimage=$conf->mycompany->dir_output.'/logos/'; + if ($_FILES[$varforimage]["tmp_name"]) + { + if (preg_match('/([^\\/:]+)$/i',$_FILES[$varforimage]["name"],$reg)) + { + $original_file=$reg[1]; + + $isimage=image_format_supported($original_file); + if ($isimage >= 0) + { + dol_syslog("Move file ".$_FILES[$varforimage]["tmp_name"]." to ".$dirforimage.$original_file); + if (! is_dir($dirforimage)) + { + dol_mkdir($dirforimage); + } + $result=dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"],$dirforimage.$original_file,1,0,$_FILES[$varforimage]['error']); + if ($result > 0) + { + dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity); + + // Create thumbs of logo (Note that PDF use original file and not thumbs) + /* + if ($isimage > 0) + { + // Create thumbs + //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get... + + // Create small thumb, Used on logon for example + $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); + if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg)) + { + $imgThumbSmall = $reg[1]; // Save only basename + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity); + } + else dol_syslog($imgThumbSmall); + + // Create mini thumb, Used on menu or for setup page for example + $imgThumbMini = vignette($dirforimage.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality); + if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg)) + { + $imgThumbMini = $reg[1]; // Save only basename + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity); + } + else dol_syslog($imgThumbMini); + } + else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING); + */ + } + else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) + { + $error++; + $langs->load("errors"); + $tmparray=explode(':',$result); + setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus',$tmparray[1]), null, 'errors'); + } + else + { + $error++; + setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); + } + } + else + { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); + } + } + } + + + $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); @@ -152,7 +243,7 @@ if ($action == 'edit') // Edit //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - print ''; + print ''; print ''; print ''; @@ -160,19 +251,19 @@ if ($action == 'edit') // Edit print '
'; print ''; - print ''; + print ''; print ''; print ''; // Default language - print ''; print ''; print ''; // Multilingual GUI - print ''; print ''; @@ -188,10 +279,10 @@ if ($action == 'edit') // Edit if (! empty($searchform)) { print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Language").' 
'.$langs->trans("DefaultLanguage").''; + print '
'.$langs->trans("DefaultLanguage").''; print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'main_lang_default', 1, 0, 0, 0, 0, 'minwidth300'); print ' 
'.$langs->trans("EnableMultilangInterface").''; + print '
'.$langs->trans("EnableMultilangInterface").''; print $form->selectyesno('main_multilangs',$conf->global->MAIN_MULTILANGS,1); print ' 
'; - print ''; + print ''; foreach ($searchform as $key => $value) { - print ''; } @@ -201,7 +292,7 @@ if ($action == 'edit') // Edit // Other print '
'.$langs->trans("PermanentLeftSearchForm").''.$langs->trans("Activated").'
'.$langs->trans("PermanentLeftSearchForm").''.$langs->trans("Activated").'
'.$searchformtitle[$key].''; + print '
'.$searchformtitle[$key].''; print $form->selectyesno($searchform[$key],$searchformconst[$key],1); print '
'; - print ''; + print ''; print ''; print ''; @@ -231,39 +322,29 @@ if ($action == 'edit') // Edit print ''; print ''; - // Activate preview tab on element card - if (class_exists("Imagick")) - { - print ''; - print ''; - print ''; - } - // First day for weeks - print ''; print ''; print ''; // DefaultWorkingDays - print ''; print ''; print ''; // DefaultWorkingHours - print ''; print ''; print ''; // Firstname/Name - print ''; @@ -271,14 +352,14 @@ if ($action == 'edit') // Edit print ''; // Hide unauthorized button - print ''; print ''; print ''; // Show logo - print ''; print ''; @@ -287,7 +368,7 @@ if ($action == 'edit') // Edit // Hide version link /* - print ''; print ''; @@ -295,36 +376,28 @@ if ($action == 'edit') // Edit */ // Show bugtrack link - print ''; print ''; print ''; // Hide wiki link on login page - print ''; print ''; print ''; // Hide helpcenter link on login page - print ''; print ''; print ''; - // Message on login page - print ''."\n"; - // Message of the day on home page - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
 
'.$langs->trans("UsePreviewTabs").''; - print $form->selectyesno('MAIN_USE_PREVIEW_TABS',isset($conf->global->MAIN_USE_PREVIEW_TABS)?$conf->global->MAIN_USE_PREVIEW_TABS:0,1); - print ' 
'.$langs->trans("WeekStartOnDay").''; + print '
'.$langs->trans("WeekStartOnDay").''; print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1'),'MAIN_START_WEEK',0); print ' 
'.$langs->trans("DefaultWorkingDays").''; + print '
'.$langs->trans("DefaultWorkingDays").''; print ''; print ' 
'.$langs->trans("DefaultWorkingHours").''; + print '
'.$langs->trans("DefaultWorkingHours").''; print ''; print ' 
'.$langs->trans("FirstnameNamePosition").''; + print '
'.$langs->trans("FirstnameNamePosition").''; $array=array(0=>$langs->trans("Firstname").' '.$langs->trans("Lastname"),1=>$langs->trans("Lastname").' '.$langs->trans("Firstname")); print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION',$array,(isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION)?$conf->global->MAIN_FIRSTNAME_NAME_POSITION:0)); print '
'.$langs->trans("ButtonHideUnauthorized").''; + print '
'.$langs->trans("ButtonHideUnauthorized").''; print $form->selectyesno('MAIN_BUTTON_HIDE_UNAUTHORIZED',isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0,1); print ' 
'.$langs->trans("EnableShowLogo").''; + print '
'.$langs->trans("EnableShowLogo").''; print $form->selectyesno('MAIN_SHOW_LOGO',$conf->global->MAIN_SHOW_LOGO,1); print ' 
'.$langs->trans("HideVersionLink").''; + print '
'.$langs->trans("HideVersionLink").''; print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1); print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; + print '
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); print ' 
'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).''; + print '
'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).''; print $form->selectyesno('MAIN_HELP_DISABLELINK', isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0,1); print ' 
'.$langs->trans("DisableLinkToHelpCenter").''; + print '
'.$langs->trans("DisableLinkToHelpCenter").''; print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK',isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0,1); print ' 
'.$langs->trans("MessageLogin").''; - - $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); - $doleditor->Create(); - - print '
'.$langs->trans("MessageOfDay").''; + print '
'.$langs->trans("MessageOfDay").''; $doleditor = new DolEditor('main_motd', (isset($conf->global->MAIN_MOTD)?$conf->global->MAIN_MOTD:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); $doleditor->Create(); @@ -333,6 +406,39 @@ if ($action == 'edit') // Edit print '
'."\n"; + print '
'; + + // Other + print ''; + print ''; + print ''; + print ''; + + // Message on login page + print ''."\n"; + + // Background + + print ''; + + print '
'.$langs->trans("LoginPage").' 
'.$langs->trans("MessageLogin").''; + $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME)?$conf->global->MAIN_HOME:''), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%'); + $doleditor->Create(); + print '
'; + print '
'; + print ''; + if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { + print ''.img_delete($langs->trans("Delete")).''; + if (file_exists($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) { + print '   '; + print ''; + } + } else { + print ''; + } + print '
'; + print '
'."\n"; + print '
'; print ''; @@ -346,9 +452,9 @@ else // Show { // Language print ''; - print ''; + print ''; - print ''; print ""; - print ''; + print ''; print ''; print ""; @@ -374,11 +480,11 @@ else // Show if (! empty($searchform)) { print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("Language").' 
'.$langs->trans("DefaultLanguage").''; + print '
'.$langs->trans("DefaultLanguage").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print ($s?$s.' ':''); print ($conf->global->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):$langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT)); @@ -358,7 +464,7 @@ else // Show print '
'.$langs->trans("EnableMultilangInterface").'' . yn($conf->global->MAIN_MULTILANGS) . '
'.$langs->trans("EnableMultilangInterface").'' . yn($conf->global->MAIN_MULTILANGS) . ' 
'; - print ''; + print ''; foreach ($searchform as $key => $value) { - print ''; + print ''; print ''; @@ -389,13 +495,13 @@ else // Show // Other print '
'.$langs->trans("PermanentLeftSearchForm").''.$langs->trans("Activated").' 
'.$langs->trans("PermanentLeftSearchForm").''.$langs->trans("Activated").' 
'.$searchformtitle[$key].''.yn($searchformconst[$key]).'
'.$searchformtitle[$key].''.yn($searchformconst[$key]).''; if (! empty($searchformmodule[$key])) print $langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key])); print '
'; - print ''; + print ''; - print ''; + print ''; print ''; print ""; - print ''; + print ''; print ''; print ""; @@ -407,44 +513,34 @@ else // Show */ // Disable javascript/ajax - print '"; print ''; print ""; - // Activate preview tab on element card - if (class_exists("Imagick")) - { - - print '"; - print ''; - print ""; - } - // First day for weeks - print ''; print ''; print ''; // DefaultWorkingDays - print ''; print ''; print ''; // DefaultWorkingHours - print ''; print ''; print ''; // Firstname / Name position - print ''; @@ -452,18 +548,18 @@ else // Show print ''; // Hide unauthorized button - print ''; // Show logo - print ''; + print ''; print ''; print ""; // Hide version link /* - print ''; print ''; @@ -471,35 +567,59 @@ else // Show */ // Show bugtrack link - print '"; print ''; print ""; // Link to wiki help - print ''; // Link to help center - print ''; - // Message login - print ''."\n"; - // Message of the day - print ''."\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . '
'.$langs->trans("DefaultMaxSizeList").'' . $conf->global->MAIN_SIZE_LISTE_LIMIT . ' 
'.$langs->trans("DefaultMaxSizeShortList").'' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . '
'.$langs->trans("DefaultMaxSizeShortList").'' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT . ' 
'.$langs->trans("DisableJavascript").''; + print '
'.$langs->trans("DisableJavascript").''; print yn($conf->global->MAIN_DISABLE_JAVASCRIPT)." 
'.$langs->trans("UsePreviewTabs").''; - print yn(isset($conf->global->MAIN_USE_PREVIEW_TABS)?$conf->global->MAIN_USE_PREVIEW_TABS:0)." 
'.$langs->trans("WeekStartOnDay").''; + print '
'.$langs->trans("WeekStartOnDay").''; print $langs->trans("Day".(isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:'1')); print ' 
'.$langs->trans("DefaultWorkingDays").''; + print '
'.$langs->trans("DefaultWorkingDays").''; print isset($conf->global->MAIN_DEFAULT_WORKING_DAYS)?$conf->global->MAIN_DEFAULT_WORKING_DAYS:'1-5'; print ' 
'.$langs->trans("DefaultWorkingHours").''; + print '
'.$langs->trans("DefaultWorkingHours").''; print isset($conf->global->MAIN_DEFAULT_WORKING_HOURS)?$conf->global->MAIN_DEFAULT_WORKING_HOURS:'9-18'; print ' 
'.$langs->trans("FirstnameNamePosition").''; + print '
'.$langs->trans("FirstnameNamePosition").''; if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) { print $langs->trans("Firstname").' '.$langs->trans("Lastname"); } else { print $langs->trans("Lastname").' '.$langs->trans("Firstname"); } print '
'.$langs->trans("ButtonHideUnauthorized").''; + print '
'.$langs->trans("ButtonHideUnauthorized").''; print yn((isset($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)?$conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED:0),1); print '
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . '
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ' 
'.$langs->trans("HideVersionLink").''; + print '
'.$langs->trans("HideVersionLink").''; print yn($conf->global->MAIN_HIDE_VERSION); print ' '.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; + print '
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)." 
'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).''; + print '
'.$langs->trans("DisableLinkToHelp",img_picto('',DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/helpdoc.png','',1)).''; print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1); print '
'.$langs->trans("DisableLinkToHelpCenter").''; + print '
'.$langs->trans("DisableLinkToHelpCenter").''; print yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0),1); print '
'.$langs->trans("MessageLogin").''; - if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME); - else print ' '; - print '
'.$langs->trans("MessageOfDay").''; + print '
'.$langs->trans("MessageOfDay").''; if (isset($conf->global->MAIN_MOTD)) print dol_htmlcleanlastbr($conf->global->MAIN_MOTD); else print ' '; print '
'."\n"; + print '
'; + + // Login page + print ''; + print ''; + + // Message login + print ''."\n"; + + // Background login + + print ''; + + print '
'.$langs->trans("LoginPage").' 
'.$langs->trans("MessageLogin").''; + if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME); + else print ' '; + print '
'.$langs->trans("BackgroundImageLogin").''; + print '
'; + print $conf->global->MAIN_LOGIN_BACKGROUND; + if ($conf->global->MAIN_LOGIN_BACKGROUND && is_file($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND)) + { + print ''; + } + else + { + print ''; + } + print '
'; + print '
'."\n"; + print '
'; diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 5c1b0fcad11..770d91d1d11 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -110,8 +110,8 @@ print ''.$langs->trans("LDAPSynchronization").''; print "\n"; // Synchro utilisateurs/groupes active -$var=!$var; -print ''.$langs->trans("LDAPDnSynchroActive").''; + +print ''.$langs->trans("LDAPDnSynchroActive").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); $arraylist['ldap2dolibarr']=$langs->trans("LDAPToDolibarr"); @@ -127,8 +127,8 @@ print ''; // Synchro contact active if (! empty($conf->societe->enabled)) { - $var=!$var; - print ''.$langs->trans("LDAPDnContactActive").''; + + print ''.$langs->trans("LDAPDnContactActive").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); $arraylist['1']=$langs->trans("DolibarrToLDAP"); @@ -139,8 +139,8 @@ if (! empty($conf->societe->enabled)) // Synchro member active if (! empty($conf->adherent->enabled)) { - $var=!$var; - print ''.$langs->trans("LDAPDnMemberActive").''; + + print ''.$langs->trans("LDAPDnMemberActive").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); $arraylist['1']=$langs->trans("DolibarrToLDAP"); @@ -156,8 +156,8 @@ print ''.$langs->trans("Example").''; print "\n"; // Type -$var=!$var; -print ''.$langs->trans("Type").''; + +print ''.$langs->trans("Type").''; $arraylist=array(); $arraylist['activedirectory']='Active Directory'; $arraylist['openldap']='OpenLdap'; @@ -166,8 +166,8 @@ print $form->selectarray('type',$arraylist,$conf->global->LDAP_SERVER_TYPE); print ' '; // Version -$var=!$var; -print ''.$langs->trans("Version").''; + +print ''.$langs->trans("Version").''; $arraylist=array(); $arraylist['3']='Version 3'; $arraylist['2']='Version 2'; @@ -175,22 +175,22 @@ print $form->selectarray('LDAP_SERVER_PROTOCOLVERSION',$arraylist,$conf->global- print ''.$langs->trans("LDAPServerProtocolVersion").''; // Serveur primaire -$var=!$var; -print ''; + +print ''; print $langs->trans("LDAPPrimaryServer").''; print ''; print ''.$langs->trans("LDAPServerExample").''; // Serveur secondaire -$var=!$var; -print ''; + +print ''; print $langs->trans("LDAPSecondaryServer").''; print ''; print ''.$langs->trans("LDAPServerExample").''; // Port -$var=!$var; -print ''.$langs->trans("LDAPServerPort").''; + +print ''.$langs->trans("LDAPServerPort").''; if (! empty($conf->global->LDAP_SERVER_PORT)) { print ''; @@ -202,14 +202,14 @@ else print ''.$langs->trans("LDAPServerPortExample").''; // DNserver -$var=!$var; -print ''.$langs->trans("LDAPServerDn").''; + +print ''.$langs->trans("LDAPServerDn").''; print ''; print ''.$langs->trans("LDAPServerDnExample").''; // Utiliser TLS -$var=!$var; -print ''.$langs->trans("LDAPServerUseTLS").''; + +print ''.$langs->trans("LDAPServerUseTLS").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); $arraylist['1']=$langs->trans("Yes"); @@ -221,14 +221,14 @@ print ''.$langs->trans("ForANonAnonymousAccess").''; print "\n"; // DNAdmin -$var=!$var; -print ''.$langs->trans("LDAPAdminDn").''; + +print ''.$langs->trans("LDAPAdminDn").''; print ''; print ''.$langs->trans("LDAPAdminDnExample").''; // Pass -$var=!$var; -print ''.$langs->trans("LDAPPassword").''; + +print ''.$langs->trans("LDAPPassword").''; if (! empty($conf->global->LDAP_ADMIN_PASS)) { print '';// je le met en visible pour test diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 4901c127e8b..27e32f8cd7c 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -125,16 +125,16 @@ print "\n"; // DN Pour les contacts -$var=!$var; -print ''.$langs->trans("LDAPContactDn").''; + +print ''.$langs->trans("LDAPContactDn").''; print ''; print ''.$langs->trans("LDAPContactDnExample").''; print ' '; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''.$langs->trans("LDAPContactObjectClassList").''; + +print ''.$langs->trans("LDAPContactObjectClassList").''; print ''; print ''.$langs->trans("LDAPContactObjectClassListExample").''; print ' '; @@ -152,112 +152,112 @@ print ''.$langs->trans("LDAPNamingAttribute").''; print "\n"; // Common name -$var=!$var; -print ''.$langs->trans("LDAPFieldFullname").''; + +print ''.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FULLNAME?' checked':'').">"; print ''; // Name -$var=!$var; -print ''.$langs->trans("LDAPFieldName").''; + +print ''.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_NAME?' checked':'').">"; print ''; // Firstname -$var=!$var; -print ''.$langs->trans("LDAPFieldFirstName").''; + +print ''.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME?' checked':'').">"; print ''; // Company -$var=!$var; -print ''.$langs->trans("LDAPFieldCompany").''; + +print ''.$langs->trans("LDAPFieldCompany").''; print ''; print ''.$langs->trans("LDAPFieldCompanyExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COMPANY?' checked':'').">"; print ''; // Mail -$var=!$var; -print ''.$langs->trans("LDAPFieldMail").''; + +print ''.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MAIL?' checked':'').">"; print ''; // Phone pro -$var=!$var; -print ''.$langs->trans("LDAPFieldPhone").''; + +print ''.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_PHONE?' checked':'').">"; print ''; // Phone home -$var=!$var; -print ''.$langs->trans("LDAPFieldHomePhone").''; + +print ''.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE?' checked':'').">"; print ''; // Mobile -$var=!$var; -print ''.$langs->trans("LDAPFieldMobile").''; + +print ''.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MOBILE?' checked':'').">"; print ''; // Skype -$var=!$var; -print ''.$langs->trans("LDAPFieldSkype").''; + +print ''.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_SKYPE?' checked':'').">"; print ''; // Fax -$var=!$var; -print ''.$langs->trans("LDAPFieldFax").''; + +print ''.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FAX?' checked':'').">"; print ''; // Address -$var=!$var; -print ''.$langs->trans("LDAPFieldAddress").''; + +print ''.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ADDRESS?' checked':'').">"; print ''; // ZIP -$var=!$var; -print ''.$langs->trans("LDAPFieldZip").''; + +print ''.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ZIP?' checked':'').">"; print ''; // TOWN -$var=!$var; -print ''.$langs->trans("LDAPFieldTown").''; + +print ''.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").''; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_TOWN?' checked':'').">"; print ''; // COUNTRY -$var=!$var; -print ''.$langs->trans("LDAPFieldCountry").''; + +print ''.$langs->trans("LDAPFieldCountry").''; print ''; print ' '; print 'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked':'').">"; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 90946f5ea44..192b11bfd8d 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -116,16 +116,16 @@ print ''.$langs->trans("LDAPSynchronizeGroups").''; print "\n"; // DN pour les groupes -$var=!$var; -print ''.$langs->trans("LDAPGroupDn").''; + +print ''.$langs->trans("LDAPGroupDn").''; print ''; print ''.$langs->trans("LDAPGroupDnExample").''; print ' '; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''.$langs->trans("LDAPGroupObjectClassList").''; + +print ''.$langs->trans("LDAPGroupObjectClassList").''; print ''; print ''.$langs->trans("LDAPGroupObjectClassListExample").''; print ' '; @@ -145,16 +145,16 @@ print "\n"; // Filtre // Common name -$var=!$var; -print ''.$langs->trans("LDAPFieldName").''; + +print ''.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldCommonNameExample").''; print 'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME)?' checked':'').">"; print ''; // Name -/*$var=!$var; -print ''.$langs->trans("LDAPFieldName").''; +/* +print ''.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''; print 'global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_NAME?' checked':'').">"; @@ -162,16 +162,16 @@ print ''; */ // Description -$var=!$var; -print ''.$langs->trans("LDAPFieldDescription").''; + +print ''.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").''; print 'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_DESCRIPTION)?' checked':'').">"; print ''; // User group -$var=!$var; -print ''.$langs->trans("LDAPFieldGroupMembers").''; + +print ''.$langs->trans("LDAPFieldGroupMembers").''; print ''; print ''.$langs->trans("LDAPFieldGroupMembersExample").''; print 'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked':'').">"; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 52117961b54..8c7291c3dc4 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -142,24 +142,24 @@ print ''.$langs->trans("LDAPSynchronizeMembers").''; print "\n"; // DN Pour les adherents -$var=!$var; -print ''.$langs->trans("LDAPMemberDn").''; + +print ''.$langs->trans("LDAPMemberDn").''; print ''; print ''.$langs->trans("LDAPMemberDnExample").''; print ' '; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''.$langs->trans("LDAPMemberObjectClassList").''; + +print ''.$langs->trans("LDAPMemberObjectClassList").''; print ''; print ''.$langs->trans("LDAPMemberObjectClassListExample").''; print ' '; print ''; // Filter, used to filter search -$var=!$var; -print ''.$langs->trans("LDAPFilterConnection").''; + +print ''.$langs->trans("LDAPFilterConnection").''; print ''; print ''.$langs->trans("LDAPFilterConnectionExample").''; print ''; @@ -179,208 +179,208 @@ print "\n"; // Filtre // Common name -$var=!$var; -print ''.$langs->trans("LDAPFieldFullname").''; + +print ''.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").''; print 'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_FULLNAME)?' checked':'').">"; print ''; // Name -$var=!$var; -print ''.$langs->trans("LDAPFieldName").''; + +print ''.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''; print 'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_NAME)?' checked':'').">"; print ''; // Firstname -$var=!$var; -print ''.$langs->trans("LDAPFieldFirstName").''; + +print ''.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").''; print ' '; print ''; // Login unix -$var=!$var; -print ''.$langs->trans("LDAPFieldLoginUnix").''; + +print ''.$langs->trans("LDAPFieldLoginUnix").''; print ''; print ''.$langs->trans("LDAPFieldLoginExample").''; print 'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN)?' checked':'').">"; print ''; // Login samba -$var=!$var; -print ''.$langs->trans("LDAPFieldLoginSamba").''; + +print ''.$langs->trans("LDAPFieldLoginSamba").''; print ''; print ''.$langs->trans("LDAPFieldLoginSambaExample").''; print 'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA)?' checked':'').">"; print ''; // Password not crypted -$var=!$var; -print ''.$langs->trans("LDAPFieldPasswordNotCrypted").''; + +print ''.$langs->trans("LDAPFieldPasswordNotCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").''; print ' '; print ''; // Password crypted -$var=!$var; -print ''.$langs->trans("LDAPFieldPasswordCrypted").''; + +print ''.$langs->trans("LDAPFieldPasswordCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").''; print ' '; print ''; // Mail -$var=!$var; -print ''.$langs->trans("LDAPFieldMail").''; + +print ''.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").''; print 'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_MAIL)?' checked':'').">"; print ''; // Phone pro -$var=!$var; -print ''.$langs->trans("LDAPFieldPhone").''; + +print ''.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").''; print ' '; print ''; // Phone perso -$var=!$var; -print ''.$langs->trans("LDAPFieldHomePhone").''; + +print ''.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").''; print ' '; print ''; // Mobile -$var=!$var; -print ''.$langs->trans("LDAPFieldMobile").''; + +print ''.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").''; print ' '; print ''; // Skype -$var=!$var; -print ''.$langs->trans("LDAPFieldSkype").''; + +print ''.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").''; print ' '; print ''; // Fax -$var=!$var; -print ''.$langs->trans("LDAPFieldFax").''; + +print ''.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").''; print ' '; print ''; // Address -$var=!$var; -print ''.$langs->trans("LDAPFieldAddress").''; + +print ''.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").''; print ' '; print ''; // ZIP -$var=!$var; -print ''.$langs->trans("LDAPFieldZip").''; + +print ''.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").''; print ' '; print ''; // TOWN -$var=!$var; -print ''.$langs->trans("LDAPFieldTown").''; + +print ''.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").''; print ' '; print ''; // COUNTRY -$var=!$var; -print ''.$langs->trans("LDAPFieldCountry").''; + +print ''.$langs->trans("LDAPFieldCountry").''; print ''; print ' '; print ' '; print ''; // Description -$var=!$var; -print ''.$langs->trans("LDAPFieldDescription").''; + +print ''.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").''; print ' '; print ''; // Public Note -$var=!$var; -print ''.$langs->trans("LDAPFieldNotePublic").''; + +print ''.$langs->trans("LDAPFieldNotePublic").''; print ''; print ''.$langs->trans("LDAPFieldNotePublicExample").''; print ' '; print ''; // Birthday -$var=!$var; -print ''.$langs->trans("LDAPFieldBirthdate").''; + +print ''.$langs->trans("LDAPFieldBirthdate").''; print ''; print ' '; print ' '; print ''; // Status -$var=!$var; -print ''.$langs->trans("LDAPFieldStatus").''; + +print ''.$langs->trans("LDAPFieldStatus").''; print ''; print ' '; print ' '; print ''; // First subscription date -$var=!$var; -print ''.$langs->trans("LDAPFieldFirstSubscriptionDate").''; + +print ''.$langs->trans("LDAPFieldFirstSubscriptionDate").''; print ''; print ' '; print ' '; print ''; // First subscription amount -$var=!$var; -print ''.$langs->trans("LDAPFieldFirstSubscriptionAmount").''; + +print ''.$langs->trans("LDAPFieldFirstSubscriptionAmount").''; print ''; print ' '; print ' '; print ''; // Last subscription date -$var=!$var; -print ''.$langs->trans("LDAPFieldLastSubscriptionDate").''; + +print ''.$langs->trans("LDAPFieldLastSubscriptionDate").''; print ''; print ' '; print ' '; print ''; // Last subscription amount -$var=!$var; -print ''.$langs->trans("LDAPFieldLastSubscriptionAmount").''; + +print ''.$langs->trans("LDAPFieldLastSubscriptionAmount").''; print ''; print ' '; print ' '; print ''; // End last subscriptions -$var=!$var; -print ''.$langs->trans("LDAPFieldEndLastSubscription").''; + +print ''.$langs->trans("LDAPFieldEndLastSubscription").''; print ''; print ' '; print ' '; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 45043b8a52b..79f34001a63 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -129,24 +129,24 @@ print ''.$langs->trans("LDAPSynchronizeUsers").''; print "\n"; // DN Pour les utilisateurs -$var=!$var; -print ''.$langs->trans("LDAPUserDn").''; + +print ''.$langs->trans("LDAPUserDn").''; print ''; print ''.$langs->trans("LDAPUserDnExample").''; print ' '; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''.$langs->trans("LDAPUserObjectClassList").''; + +print ''.$langs->trans("LDAPUserObjectClassList").''; print ''; print ''.$langs->trans("LDAPUserObjectClassListExample").''; print ' '; print ''; // Filter, used to filter search -$var=!$var; -print ''.$langs->trans("LDAPFilterConnection").''; + +print ''.$langs->trans("LDAPFilterConnection").''; print ''; print ''.$langs->trans("LDAPFilterConnectionExample").''; print ''; @@ -164,120 +164,120 @@ print ''.$langs->trans("LDAPNamingAttribute").''; print "\n"; // Common name -$var=!$var; -print ''.$langs->trans("LDAPFieldFullname").''; + +print ''.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FULLNAME)?' checked':'').">"; print ''; // Name -$var=!$var; -print ''.$langs->trans("LDAPFieldName").''; + +print ''.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_NAME)?' checked':'').">"; print ''; // Firstname -$var=!$var; -print ''.$langs->trans("LDAPFieldFirstName").''; + +print ''.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FIRSTNAME)?' checked':'').">"; print ''; // Login unix -$var=!$var; -print ''.$langs->trans("LDAPFieldLoginUnix").''; + +print ''.$langs->trans("LDAPFieldLoginUnix").''; print ''; print ''.$langs->trans("LDAPFieldLoginExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN)?' checked':'').">"; print ''; // Login samba -$var=!$var; -print ''.$langs->trans("LDAPFieldLoginSamba").''; + +print ''.$langs->trans("LDAPFieldLoginSamba").''; print ''; print ''.$langs->trans("LDAPFieldLoginSambaExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN_SAMBA)?' checked':'').">"; print ''; // Password not crypted -$var=!$var; -print ''.$langs->trans("LDAPFieldPasswordNotCrypted").''; + +print ''.$langs->trans("LDAPFieldPasswordNotCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD)?' checked':'').">"; print ''; // Password crypted -$var=!$var; -print ''.$langs->trans("LDAPFieldPasswordCrypted").''; + +print ''.$langs->trans("LDAPFieldPasswordCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED)?' checked':'').">"; print ''; // Mail -$var=!$var; -print ''.$langs->trans("LDAPFieldMail").''; + +print ''.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MAIL)?' checked':'').">"; print ''; // Phone -$var=!$var; -print ''.$langs->trans("LDAPFieldPhone").''; + +print ''.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PHONE)?' checked':'').">"; print ''; // Mobile -$var=!$var; -print ''.$langs->trans("LDAPFieldMobile").''; + +print ''.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MOBILE)?' checked':'').">"; print ''; // Skype -$var=!$var; -print ''.$langs->trans("LDAPFieldSkype").''; + +print ''.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SKYPE)?' checked':'').">"; print ''; // Fax -$var=!$var; -print ''.$langs->trans("LDAPFieldFax").''; + +print ''.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'').">"; print ''; // Title -$var=!$var; -print ''.$langs->trans("LDAPFieldTitle").''; + +print ''.$langs->trans("LDAPFieldTitle").''; print ''; print ''.$langs->trans("LDAPFieldTitleExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked':'').">"; print ''; // Note -$var=!$var; -print ''.$langs->trans("Note").''; + +print ''.$langs->trans("Note").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked':'').">"; print ''; // Sid -$var=!$var; -print ''.$langs->trans("LDAPFieldSid").''; + +print ''.$langs->trans("LDAPFieldSid").''; print ''; print ''.$langs->trans("LDAPFieldSidExample").''; print 'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked':'').">"; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 3806258d246..1d4b5cee8d4 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -106,21 +106,21 @@ if ($action == 'edit') print ''; print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; @@ -140,21 +140,21 @@ else print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + + print '
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly")); print '
'; + + print '
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); print '
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").'
'; + + print '
'; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); print '
'; print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; + + print ''; - $var=!$var; - print ''; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index e49f25d7ef8..143c54ec24d 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -258,8 +258,8 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var=!$var; - print ''; @@ -385,7 +385,7 @@ foreach ($dirmodels as $reldir) { if (file_exists($dir.'/'.$file)) { - $var=!$var; + $name = substr($file, 4, dol_strlen($file) -16); $classname = substr($file, 0, dol_strlen($file) -12); @@ -399,7 +399,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - print ''; print "\n"; $var=true; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; print ''; print ''; print ''; -print '\n"; foreach ($list as $key) { - $var=!$var; + print ''; diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 541c8aa1b2d..972b7ee73a6 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -113,30 +113,30 @@ print ''; print ''; print "\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; // Constant to add salt into the unsubscribe and check read tag. // It is also used as a security key parameter. -$var=!$var; -print ''; // Disable - $var=!$var; - print ''; // Separator - $var=!$var; - print ''; + + print ''; // Method - $var=!$var; - print ''; // Host server - $var=!$var; - print ''; // Port - $var=!$var; - print ''; // STARTTLS - $var=!$var; - print ''; // Separator - $var=!$var; - print ''; + + print ''; // From - $var=!$var; - print ''; + + print ''; print ''; // Default from type - $var=!$var; + $liste = array(); $liste['user'] = $langs->trans('UserEmail'); $liste['company'] = $langs->trans('CompanyEmail').' ('.(empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?$langs->trans("NotDefined"):$conf->global->MAIN_INFO_SOCIETE_MAIL).')'; @@ -424,18 +424,18 @@ if ($action == 'edit') print ''; // Separator - $var=!$var; - print ''; + + print ''; // From - $var=!$var; - print ''; + + print ''; print ''; // Autocopy to - $var=!$var; - print ''; + + print ''; print ''; @@ -465,60 +465,60 @@ else print ''; // Disable - $var=!$var; - print ''; + + print ''; // Separator - $var=!$var; - print ''; + + print ''; // Method - $var=!$var; - print ''; // Host server - $var=!$var; + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { - print ''; + print ''; } else { - print ''; + print ''; } // Port - $var=!$var; + if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail')) { - print ''; + print ''; } else { - print ''; + print ''; } // SMTPS ID - $var=!$var; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - print ''; + print ''; } // SMTPS PW - $var=!$var; + if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { - print ''; + print ''; } // TLS - $var=!$var; - print ''; // STARTTLS - $var=!$var; - print ''; // Separator - $var=!$var; - print ''; + + print ''; // From - $var=!$var; - print ''; + + print ''; print ''; // Default from type - $var=!$var; + print ''; print ''; // Separator - $var=!$var; - print ''; + + print ''; // Errors To - $var=!$var; - print ''; + + print ''; print ''; // Autocopy to - $var=!$var; - print ''; + + print ''; print ''; // Menu top - $var=!$var; - print ''; + + print ''; print ''; @@ -190,8 +190,8 @@ if ($action == 'edit') print ''; // Menu smartphone - $var=!$var; - print ''; + + print ''; print ''; @@ -217,8 +217,8 @@ else print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; - $var=!$var; + print "\n"; $url='https://www.dolistore.com'; print ''; @@ -791,7 +789,7 @@ if ($mode == 'marketplace') print ''; print ''; - $var=!$var; + print "\n"; $url='https://partners.dolibarr.org'; print ''; diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 5b86bcdc1c3..3aa6ad5dc26 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -183,8 +183,8 @@ print ''."\n"; print ''; print ''."\n"; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; /* TODO uncomment when the functionality will integrated -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; */ /* TODO uncomment when the functionality will integrated -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; print ''."\n"; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; @@ -323,8 +323,8 @@ print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; + + print ''; print ''; print ''; print ''; print ''; print ''; print "\n"; -$var=!$var; -print ''; print '\n"; $notificationtrigger=new InterfaceNotification($db); $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); -print ''; +print ''; print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 2433575e553..06315222825 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -211,7 +211,7 @@ if ($mode == 'setup' && $user->admin) print ''; print "\n"; - print ''; + print ''; print ''; //var_dump($key); print $langs->trans("OAuthIDSecret").''; @@ -223,7 +223,7 @@ if ($mode == 'setup' && $user->admin) print ''."\n"; $var = ! $var; - print ''; + print ''; print ''; //var_dump($key); print $langs->trans("IsTokenGenerated"); @@ -250,7 +250,7 @@ if ($mode == 'setup' && $user->admin) print ''; $var = ! $var; - print ''; + print ''; print ''; //var_dump($key); print $langs->trans("Token").''; @@ -273,7 +273,7 @@ if ($mode == 'setup' && $user->admin) { // Token refresh $var = ! $var; - print ''; + print ''; print ''; //var_dump($key); print $langs->trans("TOKEN_REFRESH").''; @@ -284,7 +284,7 @@ if ($mode == 'setup' && $user->admin) // Token expired $var = ! $var; - print ''; + print ''; print ''; //var_dump($key); print $langs->trans("TOKEN_EXPIRED").''; @@ -295,7 +295,7 @@ if ($mode == 'setup' && $user->admin) // Token expired at $var = ! $var; - print ''; + print ''; print ''; //var_dump($key); print $langs->trans("TOKEN_EXPIRE_AT").''; @@ -368,8 +368,8 @@ if ($mode == 'userconf' && $user->admin) $sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid'; $resql = $db->query($sql); while ($row=$db->fetch_array($resql)) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/order_extrafields.php b/htdocs/admin/order_extrafields.php index 5d7358ae051..043d6bbadd9 100644 --- a/htdocs/admin/order_extrafields.php +++ b/htdocs/admin/order_extrafields.php @@ -75,7 +75,7 @@ print "
\n"; $head = order_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("Orders"), 0, 'order'); +dol_fiche_head($head, 'attributes', $langs->trans("Orders"), -1, 'order'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/orderdet_extrafields.php b/htdocs/admin/orderdet_extrafields.php index f966af78bf3..5120fd5c931 100644 --- a/htdocs/admin/orderdet_extrafields.php +++ b/htdocs/admin/orderdet_extrafields.php @@ -76,7 +76,7 @@ print "
\n"; $head = order_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), 0, 'order'); +dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), -1, 'order'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 93f7c301519..88f2d8cd1c1 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -117,7 +117,7 @@ $linkback=''.$langs->trans("BackToM print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); $head = invoice_admin_prepare_head(); -dol_fiche_head($head, 'payment', $langs->trans("Invoices"), 0, 'invoice'); +dol_fiche_head($head, 'payment', $langs->trans("Invoices"), -1, 'invoice'); /* * Numbering module @@ -177,7 +177,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { $var = !$var; - print '\n"; // Allow payments on different thirdparties bills but same parent company $var=! $var; -print '\n"; // Add js auto fill amount on paiement form /* always on now $var=! $var; -print ''; @@ -145,13 +145,13 @@ if ($action == 'edit') // Edit print ''; // Hide VAT Intra on address - $var=!$var; - print ''; // Show prof id 1 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid1=$langs->transcountry("ProfId1",$mysoc->country_code); @@ -163,13 +163,13 @@ if ($action == 'edit') // Edit } if ($pid1) { - print ''; } // Show prof id 2 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid2=$langs->transcountry("ProfId2",$mysoc->country_code); @@ -181,13 +181,13 @@ if ($action == 'edit') // Edit } if ($pid2) { - print ''; } // Show prof id 3 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid3=$langs->transcountry("ProfId3",$mysoc->country_code); @@ -199,13 +199,13 @@ if ($action == 'edit') // Edit } if ($pid3) { - print ''; } // Show prof id 4 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid4=$langs->transcountry("ProfId4",$mysoc->country_code); @@ -217,7 +217,7 @@ if ($action == 'edit') // Edit } if ($pid4) { - print ''; } @@ -233,37 +233,37 @@ if ($action == 'edit') // Edit print ''; // Hide any PDF informations - $var=!$var; - print ''; //Desc - $var=!$var; - print ''; //Ref - $var=!$var; - print ''; //Details - $var=!$var; - print ''; // Place customer adress to the ISO location - $var=!$var; - print ''; - $var=!$var; - print ''; @@ -287,8 +287,8 @@ else // Show print ''; // Show pdf format - $var=!$var; - print ''; // Hide Intra VAT on address - $var=!$var; - print ''; // Show prof id 1 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid1=$langs->transcountry("ProfId1",$mysoc->country_code); @@ -341,13 +341,13 @@ else // Show } if ($pid1) { - print ''; } // Show prof id 2 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid2=$langs->transcountry("ProfId2",$mysoc->country_code); @@ -359,13 +359,13 @@ else // Show } if ($pid2) { - print ''; } // Show prof id 3 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid3=$langs->transcountry("ProfId3",$mysoc->country_code); @@ -377,13 +377,13 @@ else // Show } if ($pid3) { - print ''; } // Show prof id 4 in address into pdf - $var=!$var; + if (! $noCountryCode) { $pid4=$langs->transcountry("ProfId4",$mysoc->country_code); @@ -395,7 +395,7 @@ else // Show } if ($pid4) { - print ''; } @@ -412,8 +412,8 @@ else // Show // Encrypt and protect PDF - $var=!$var; - print ""; + + print ''; print ''; // Hide any PDF informations - $var=!$var; - print ''; //Desc - $var=!$var; - print ''; //Ref - $var=!$var; - print ''; //Details - $var=!$var; - print ''; - $var=!$var; - print ''; - $var=!$var; - print ''; @@ -492,8 +492,8 @@ else // Show $var=false; if (! empty($dolibarr_pdf_force_fpdf)) { - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print ''; } - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print '\n"; } - $var=!$var; + print ''; print '"; + print ''; print ''; $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index c6ccb4f639c..6a9884e263c 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -248,16 +248,15 @@ else if ($action == 'setmod') /* - * Affiche page + * View */ +$form=new Form($db); + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); - llxHeader('',$langs->trans("PropalSetup")); -$form=new Form($db); - //if ($mesg) print $mesg; $linkback=''.$langs->trans("BackToModuleList").''; @@ -265,7 +264,7 @@ print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup'); $head = propal_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal'); +dol_fiche_head($head, 'general', $langs->trans("Proposals"), -1, 'propal'); /* * Module numerotation @@ -310,8 +309,8 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print ''; @@ -450,7 +449,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print ''; $out.=''; $out.=''."\n"; - $var = true; $tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); if (is_array($tmpfilelist) && count($tmpfilelist)) { @@ -247,8 +240,7 @@ if ($xml) foreach ($tmpfilelist as $file) { $i++; - $var = !$var; - $out.=''; + $out.=''; $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; @@ -257,7 +249,7 @@ if ($xml) } else { - $out.=''; + $out.=''; } $out.='
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + + print '
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly")); print ''.$conf->global->MAIN_MAX_DECIMALS_UNIT.'
'; + + print '
'; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); print ''.$conf->global->MAIN_MAX_DECIMALS_TOT.'
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'
'.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''.$conf->global->MAIN_MAX_DECIMALS_SHOWN.'
'; + + print '
'; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); print ''.$conf->global->MAIN_ROUNDING_RULE_TOT.'
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -479,12 +479,18 @@ print ' 
'; -print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnDeliveryReceipts"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='DELIVERY_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index 3213503835d..ee6b9ef74ee 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -96,7 +96,7 @@ print "
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + +print '
'; print $langs->trans("MailingEMailFrom").''; print ''; if (!empty($conf->global->MAILING_EMAIL_FROM) && ! isValidEmail($conf->global->MAILING_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail")); print '
'; + +print '
'; print $langs->trans("MailingEMailError").''; print ''; if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail")); print '
'; + +print '
'; print $langs->trans("MailingDelay").''; print ''; print '
'; + +print '
'; print $langs->trans("ActivateCheckReadKey").''; print ''; if (! empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 6c01935ec39..219cd85c2fe 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -241,18 +241,18 @@ if ($action == 'edit') print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_ALL_MAILS").''; + + print '
'.$langs->trans("MAIN_DISABLE_ALL_MAILS").''; print $form->selectyesno('MAIN_DISABLE_ALL_MAILS',$conf->global->MAIN_DISABLE_ALL_MAILS,1); print '
 
 
'.$langs->trans("MAIN_MAIL_SENDMODE").''; + + print '
'.$langs->trans("MAIN_MAIL_SENDMODE").''; // SuperAdministrator access only if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) @@ -270,8 +270,8 @@ if ($action == 'edit') print '
'; + + print '
'; if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') { print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -303,8 +303,8 @@ if ($action == 'edit') print '
'; + + print '
'; if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail') { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -338,7 +338,7 @@ if ($action == 'edit') // ID if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { - $var=!$var; + $mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:''); print '
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''; // SuperAdministrator access only @@ -358,7 +358,7 @@ if ($action == 'edit') // PW if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { - $var=!$var; + $mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:''); print '
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''; // SuperAdministrator access only @@ -376,8 +376,8 @@ if ($action == 'edit') } // TLS - $var=!$var; - print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + + print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) @@ -390,8 +390,8 @@ if ($action == 'edit') print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) @@ -404,17 +404,17 @@ if ($action == 'edit') print '
 
 
'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'
'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'
 
 
'.$langs->trans("MAIN_MAIL_ERRORS_TO").'
'.$langs->trans("MAIN_MAIL_ERRORS_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'
'.$langs->trans("MAIN_DISABLE_ALL_MAILS").''.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'
 
 
'.$langs->trans("MAIN_MAIL_SENDMODE").''; + + print '
'.$langs->trans("MAIN_MAIL_SENDMODE").''; $text=$listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; if (empty($text)) $text=$langs->trans("Undefined").img_warning(); print $text; print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).''.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER",ini_get('SMTP')?ini_get('SMTP'):$langs->transnoentities("Undefined")).''.(! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_SMTP_SERVER:'').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).''.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT",ini_get('smtp_port')?ini_get('smtp_port'):$langs->transnoentities("Undefined")).''.(! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:'').'
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''.$conf->global->MAIN_MAIL_SMTPS_ID.'
'.$langs->trans("MAIN_MAIL_SMTPS_ID").''.$conf->global->MAIN_MAIL_SMTPS_ID.'
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'
'.$langs->trans("MAIN_MAIL_SMTPS_PW").''.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + + print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) @@ -531,8 +531,8 @@ else print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))) { if (function_exists('openssl_open')) @@ -545,18 +545,18 @@ else print '
 
 
'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).'
'.$langs->trans("MAIN_MAIL_EMAIL_FROM",ini_get('sendmail_from')?ini_get('sendmail_from'):$langs->transnoentities("Undefined")).''.$conf->global->MAIN_MAIL_EMAIL_FROM; if (! empty($conf->global->MAIN_MAIL_EMAIL_FROM) && ! isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) print img_warning($langs->trans("ErrorBadEMail")); print '
'.$langs->trans('MAIN_MAIL_DEFAULT_FROMTYPE').''; if($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user'){ @@ -567,19 +567,19 @@ else print '
 
 
'.$langs->trans("MAIN_MAIL_ERRORS_TO").'
'.$langs->trans("MAIN_MAIL_ERRORS_TO").''.$conf->global->MAIN_MAIL_ERRORS_TO; if (! empty($conf->global->MAIN_MAIL_ERRORS_TO) && ! isValidEmail($conf->global->MAIN_MAIL_ERRORS_TO)) print img_warning($langs->trans("ErrorBadEMail")); print '
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").''; if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) { diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 90949c7980d..f0bf5609adf 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -27,7 +27,7 @@ */ /** - * \file htdocs/admin/dict.php + * \file htdocs/admin/mails_templates.php * \ingroup setup * \brief Page to administer data tables */ @@ -119,12 +119,14 @@ $formmail=new FormMail($db); if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $tmp=$formmail->getAvailableSubstitKey('form'); + $tmp['__(AnyTransKey)__']='__(AnyTransKey)__'; $helpsubstit = $langs->trans("AvailableVariables").':
'.implode('
', $tmp); $helpsubstitforlines = $langs->trans("AvailableVariables").':
'.implode('
', $tmp); } else { $tmp=$formmail->getAvailableSubstitKey('formwithlines'); + $tmp['__(AnyTransKey)__']='__(AnyTransKey)__'; $helpsubstit = $langs->trans("AvailableVariables").':
'.implode('
', $tmp); $tmp=$formmail->getAvailableSubstitKey('formforlines'); $helpsubstitforlines = $langs->trans("AvailableVariables").':
'.implode('
', $tmp); diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index f8b89c515aa..ddfb4d0cd62 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -155,7 +155,7 @@ print ''; print ''; print ''; -dol_fiche_head($head, 'handler', $langs->trans("Menus")); +dol_fiche_head($head, 'handler', $langs->trans("Menus"), -1); print $langs->trans("MenusDesc")."
\n"; print "
\n"; @@ -179,8 +179,8 @@ if ($action == 'edit') print '
'.$langs->trans("DefaultMenuManager").'
'.$langs->trans("DefaultMenuManager").''; $formadmin->select_menu(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED, 'MAIN_MENU_STANDARD', $dirstandard, empty($conf->global->MAIN_MENU_STANDARD_FORCED)?'':' disabled'); print '
'.$langs->trans("DefaultMenuSmartphoneManager").'
'.$langs->trans("DefaultMenuSmartphoneManager").''; $formadmin->select_menu(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED, 'MAIN_MENU_SMARTPHONE', array_merge($dirstandard,$dirsmartphone), empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?'':' disabled'); print '
'.$langs->trans("DefaultMenuManager").'
'.$langs->trans("DefaultMenuManager").''; $filelib=preg_replace('/.php$/i','',(empty($conf->global->MAIN_MENU_STANDARD_FORCED)?$conf->global->MAIN_MENU_STANDARD:$conf->global->MAIN_MENU_STANDARD_FORCED)); print $filelib; @@ -229,8 +229,8 @@ else print '
'.$langs->trans("DefaultMenuSmartphoneManager").''; $filelib=preg_replace('/.php$/i','',(empty($conf->global->MAIN_MENU_SMARTPHONE_FORCED)?$conf->global->MAIN_MENU_SMARTPHONE:$conf->global->MAIN_MENU_SMARTPHONE_FORCED)); diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index acfa9d2dccd..ed5f56954c0 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -234,7 +234,7 @@ $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'misc'; $h++; -dol_fiche_head($head, 'editor', $langs->trans("Menus")); +dol_fiche_head($head, 'editor', $langs->trans("Menus"), -1); print $langs->trans("MenusEditorDesc")."
\n"; print "
\n"; diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index 471edf58e79..7789c3fb21c 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -77,11 +77,10 @@ $head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][2] = 'misc'; $h++; -dol_fiche_head($head, 'misc', $langs->trans("Menus")); +dol_fiche_head($head, 'misc', $langs->trans("Menus"), -1); // Other Options -$var=true; print ''; print ''; @@ -90,8 +89,7 @@ print ''; print ''; // Hide unauthorized menu -$var=!$var; -print ""; +print ''; print ''; print '\n"; - print ''."\n"; - print "\n"; - $atleastoneforfamily=0; + print_fiche_titre($familytext, '', ''); + + print '
'; + print '
'.$langs->trans("Status").'
'.$langs->trans("HideUnauthorizedMenu").''; if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 5b428443248..94bfa8e05bb 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -1,12 +1,5 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015 Raphaël Doursenaud +/* Copyright (C) 2017 Laurent Destailleur * * 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 @@ -292,7 +285,7 @@ if (isset($objMod->langfiles) && is_array($objMod->langfiles)) } } -$var=!$var; + // Version (with picto warning or not) @@ -343,6 +336,15 @@ if ($mode == 'desc') if ($mode == 'feature') { + $text.='
'.$langs->trans("DependsOn").': '; + if (count($objMod->requiredby)) $text.=join(',', $objMod->depends); + else $text.=$langs->trans("None"); + $text.='
'.$langs->trans("RequiredBy").': '; + if (count($objMod->requiredby)) $text.=join(',', $objMod->requiredby); + else $text.=$langs->trans("None"); + + $text.='


'; + $text.=''.$langs->trans("AddRemoveTabs").': '; if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs)) { diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 52b250e8cf0..4eb82e6183c 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -278,13 +278,12 @@ foreach ($modulesdir as $dir) try { - $res=include_once $dir.$file; + $res=include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. if (class_exists($modName)) { try { $objMod = new $modName($db); $modNameLoaded[$modName]=$dir; - if (! $objMod->numero > 0 && $modName != 'modUser') { dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR); @@ -471,12 +470,10 @@ if ($mode == 'common') if (! empty($moreforfilter)) { - //print '
'; print $moreforfilter; $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - //print '
'; } @@ -485,8 +482,6 @@ if ($mode == 'common') $moreforfilter=''; // Show list of modules - print '
'; - print ''."\n"; $oldfamily=''; @@ -570,14 +565,15 @@ if ($mode == 'common') // Print a separator if we change family if ($familykey!=$oldfamily) { - print ''."\n"; - print '
'; + if ($oldfamily) print '

'; + $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label']; - print $familytext; - print "
'.$langs->trans("SetupShort").'
'."\n"; + + $atleastoneforfamily=0; } $atleastoneforfamily++; @@ -588,7 +584,7 @@ if ($mode == 'common') $oldfamily=$familykey; } - $var=!$var; + // Version (with picto warning or not) @@ -606,43 +602,38 @@ if ($mode == 'common') $imginfo="info_black"; } - print '\n"; + print ''."\n"; - // Picto - print ' '; - - // Name - print '\n"; // Desc - print '\n"; // Help - print ''; // Version - print '\n"; @@ -651,8 +642,12 @@ if ($mode == 'common') { $disableSetup = 0; - print ''; + print ''; } else { - print ''; + print ''; } } else { - print ''; + print ''; } } else // Module not yet activated { - print '\n"; - print ''; + print ''; } print "\n"; } + print "
'; + // Picto + Name of module + print ' '; $alttext=''; //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version); //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); if (! empty($objMod->picto)) { if (preg_match('/^\//i',$objMod->picto)) print img_picto($alttext,$objMod->picto,' width="14px"',1); - else print img_object($alttext,$objMod->picto,' width="14px"'); + else print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"'); } else { - print img_object($alttext,'generic'); + print img_object($alttext, 'generic', 'class="valignmiddle"'); } - print ''.$objMod->getName(); + print ' '.$objMod->getName().''; print "'; + print ''; print nl2br($objMod->getDesc()); print "'; - + print ''; //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1); print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; - print ''; + print ''; print $versiontrans; print "'; - if (! empty($objMod->disabled)) + print ''; + if (! empty($arrayofwarnings[$modName])) + { + print ''."\n"; + } + if (! empty($objMod->disabled)) { print $langs->trans("Disabled"); } @@ -674,7 +669,7 @@ if ($mode == 'common') { if (is_array($objMod->config_page_url)) { - print ''; + print ''; $i=0; foreach ($objMod->config_page_url as $page) { @@ -700,22 +695,22 @@ if ($mode == 'common') } else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs)) { - print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').''; + print ''; if (! empty($objMod->always_enabled)) { // Should never happened @@ -754,17 +749,20 @@ if ($mode == 'common') } } print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); print "\n"; } print "'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').''.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'
\n"; print ''; @@ -783,7 +781,7 @@ if ($mode == 'marketplace') print '
'.$langs->trans("URL").'
'.$url.'
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->transnoentitiesnoconv("multicurrency_useRateOnDocumentDate").' '; @@ -197,8 +197,8 @@ print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_useOriginTx").' '; @@ -211,8 +211,8 @@ print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").' '; @@ -226,8 +226,8 @@ print '
'.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").' '; @@ -260,8 +260,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").' '; @@ -273,8 +273,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").' '; @@ -286,8 +286,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").' '; @@ -311,8 +311,8 @@ print ''.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->trans print ' '.$langs->trans("Rate").'
'.$conf->currency.$form->textwithpicto(' ', $langs->trans("BaseCurrency")).' 1'; @@ -334,8 +334,8 @@ foreach ($TCurrency as &$currency) { if($currency->code == $conf->currency) continue; - $var=!$var; - print '
'.$currency->code.' - '.$currency->name.' '; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index a3b3eb50df6..c82e64d48ea 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -135,8 +135,8 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; + +print '
'; print $langs->trans("NotificationEMailFrom").''; print ''; @@ -165,14 +165,14 @@ print "
'; $var=true; $i=0; foreach($listofnotifiedevents as $notifiedevent) { - $var=!$var; + $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); @@ -213,7 +213,7 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents(); $var=true; foreach($listofnotifiedevents as $notifiedevent) { - $var=!$var; + $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); @@ -222,7 +222,7 @@ foreach($listofnotifiedevents as $notifiedevent) elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); - print '
'.$elementLabel.''.$notifiedevent['code'].''.$label.'
'.$row['login'].''.$row['module'].''.$row['driver'].'
'; + print '
'; echo preg_replace('/\-.*$/','',preg_replace('/mod_payment_/','',preg_replace('/\.php$/','',$file))); print "\n"; @@ -263,7 +263,7 @@ print "
'; +print '
'; print $langs->trans("PaymentOnDifferentThirdBills"); print ''; print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS,1); @@ -273,7 +273,7 @@ print "
'; +print '
'; print $langs->trans("JSOnPaimentBill"); print ''; print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 74684c823e7..b0c32a344ff 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -98,7 +98,7 @@ $formadmin=new FormAdmin($db); $arraydetailsforpdffoot = array( 0 => $langs->trans('NoDetails'), 1 => $langs->trans('DisplayCompanyInfo'), - 2 => $langs->trans('DisplayManagersInfo'), + 2 => $langs->trans('DisplayCompanyManagers'), 3 => $langs->trans('DisplayCompanyInfoAndManagers') ); @@ -128,8 +128,8 @@ if ($action == 'edit') // Edit if (empty($selected)) $selected=dol_getDefaultFormat(); // Show pdf format - $var=!$var; - print '
'.$langs->trans("DictionaryPaperFormat").''; + + print '
'.$langs->trans("DictionaryPaperFormat").''; print $formadmin->select_paper_format($selected,'MAIN_PDF_FORMAT'); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ShowVATIntaInAddress").''; + + print '
'.$langs->trans("ShowVATIntaInAddress").''; print $form->selectyesno('MAIN_TVAINTRA_NOT_IN_ADDRESS',(! empty($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS))?$conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS:0,1); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; print $form->selectyesno('MAIN_PROFID1_IN_ADDRESS',isset($conf->global->MAIN_PROFID1_IN_ADDRESS)?$conf->global->MAIN_PROFID1_IN_ADDRESS:0,1,$noCountryCode); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; print $form->selectyesno('MAIN_PROFID2_IN_ADDRESS',isset($conf->global->MAIN_PROFID2_IN_ADDRESS)?$conf->global->MAIN_PROFID2_IN_ADDRESS:0,1,$noCountryCode); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; print $form->selectyesno('MAIN_PROFID3_IN_ADDRESS',isset($conf->global->MAIN_PROFID3_IN_ADDRESS)?$conf->global->MAIN_PROFID3_IN_ADDRESS:0,1,$noCountryCode); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; print $form->selectyesno('MAIN_PROFID4_IN_ADDRESS',isset($conf->global->MAIN_PROFID4_IN_ADDRESS)?$conf->global->MAIN_PROFID4_IN_ADDRESS:0,1,$noCountryCode); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("HideAnyVATInformationOnPDF").''; + + print '
'.$langs->trans("HideAnyVATInformationOnPDF").''; print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))?$conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT:0,1); print '
'.$langs->trans("HideDescOnPDF").''; + + print '
'.$langs->trans("HideDescOnPDF").''; print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DESC',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC:0,1); print '
'.$langs->trans("HideRefOnPDF").''; + + print '
'.$langs->trans("HideRefOnPDF").''; print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_REF',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF:0,1); print '
'.$langs->trans("HideDetailsOnPDF").''; + + print '
'.$langs->trans("HideDetailsOnPDF").''; print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS',(! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS))?$conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS:0,1); print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; + + print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; print $form->selectyesno('MAIN_PDF_USE_ISO_LOCATION',(! empty($conf->global->MAIN_PDF_USE_ISO_LOCATION))?$conf->global->MAIN_PDF_USE_ISO_LOCATION:0,1); print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; + + print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; print $form->selectarray('MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS', $arraydetailsforpdffoot, $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS); print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("DictionaryPaperFormat").''; + + print '
'.$langs->trans("DictionaryPaperFormat").''; $pdfformatlabel=''; if (empty($conf->global->MAIN_PDF_FORMAT)) @@ -323,13 +323,13 @@ else // Show print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("ShowVATIntaInAddress").''; + + print '
'.$langs->trans("ShowVATIntaInAddress").''; print yn($conf->global->MAIN_TVAINTRA_NOT_IN_ADDRESS,1); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid1.''; print yn($conf->global->MAIN_PROFID1_IN_ADDRESS,1); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid2.''; print yn($conf->global->MAIN_PROFID2_IN_ADDRESS,1); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid3.''; print yn($conf->global->MAIN_PROFID3_IN_ADDRESS,1); print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; + print '
'.$langs->trans("ShowProfIdInAddress").' - '.$pid4.''; print yn($conf->global->MAIN_PROFID4_IN_ADDRESS,1); print '
'; $text = $langs->trans("ProtectAndEncryptPdfFiles"); $desc = $form->textwithpicto($text,$langs->transnoentities("ProtectAndEncryptPdfFilesDesc"),1); @@ -440,36 +440,36 @@ else // Show print '
'.$langs->trans("HideAnyVATInformationOnPDF").''; + + print '
'.$langs->trans("HideAnyVATInformationOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT,1); print '
'.$langs->trans("HideDescOnPDF").''; + + print '
'.$langs->trans("HideDescOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1); print '
'.$langs->trans("HideRefOnPDF").''; + + print '
'.$langs->trans("HideRefOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1); print '
'.$langs->trans("HideDetailsOnPDF").''; + + print '
'.$langs->trans("HideDetailsOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1); print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; + + print '
'.$langs->trans("PlaceCustomerAddressToIsoLocation").''; print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1); print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; + + print '
'.$langs->trans("ShowDetailsInPDFPageFoot").''; print $arraydetailsforpdffoot[$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS]; print '
dolibarr_pdf_force_fpdf'; print $dolibarr_pdf_force_fpdf; @@ -501,8 +501,8 @@ else // Show print '
'.$langs->trans("LibraryToBuildPDF").''; $i=0; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 84cb9ed8bf2..daafab71053 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -186,7 +186,7 @@ if ($result) print "
'.img_object('',$picto).' '.$objMod->getName(); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 6d5c915dae2..86108be0136 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -313,7 +313,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -422,7 +422,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; + if (!$obj->fk_soc) { $username=dolGetFirstLastname($obj->firstname,$obj->lastname); @@ -495,9 +495,9 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; + - print "
'.dolGetFirstLastname($obj->firstname,$obj->lastname).''.$label.'
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -534,11 +533,10 @@ print '
'; /* * Other options - * */ + print load_fiche_titre($langs->trans("OtherOptions"),'',''); -$var=true; print ""; print ""; print "\n"; @@ -546,11 +544,11 @@ print '\n"; print "\n"; print ""; -$var=!$var; + print ""; print ''; print ""; -print ""; +print ''; print ''; print '"; print ''; @@ -562,7 +560,7 @@ $var=! $var; print ''; print ''; print ''; -print '\n"; print ''; */ -$var=! $var; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + print ''; print ''; print ''; -print '\n"; print ''; -$var=!$var; + print ""; print ''; print ""; -print '\n"; @@ -609,8 +613,8 @@ print ''; /* Seems to be not so used. So kept hidden for the moment to avoid dangerous options inflation. if ($conf->banque->enabled) { - $var=!$var; - print ''; } */ @@ -668,7 +672,7 @@ print ''; print ''; print "\n"; -print '\n"; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 84836407499..224fac14ce7 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -133,8 +133,8 @@ print ''; print ''; print "\n"; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; -$var=!$var; + print ''; print ''; @@ -171,7 +171,7 @@ print ''; @@ -180,7 +180,7 @@ print ''; @@ -189,7 +189,7 @@ print ''; diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index b86023aa49a..1bac9d80bee 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -250,7 +250,7 @@ if ($mode == 'config' && $user->admin) } else { for ($line=0; $line < $nbofprinters; $line++) { $var = !$var; - print ''; + print ''; if ($action=='editprinter' && $printer->listprinters[$line]['rowid']==$printerid) { print ''; print ''; @@ -381,7 +381,7 @@ if ($mode == 'template' && $user->admin) $max = count($printer->listprinterstemplates); for ($line=0; $line < $max; $line++) { $var = !$var; - print ''; + print ''; if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) { print ''; print ''; @@ -427,7 +427,7 @@ if ($mode == 'template' && $user->admin) $max = count($printer->tags); for ($tag=0; $tag < $max; $tag++) { $var = !$var; - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index d8fdddd2bb5..3f057bbdbb9 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -85,8 +85,8 @@ print ''; // Utilisation formulaire Ajax sur choix produit -$var=!$var; -print ''; + +print ''; print ''; if (empty($conf->use_javascript_ajax)) { @@ -111,8 +111,8 @@ else } print ''; -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; print '\n"; foreach ($list as $key) { - $var=!$var; + print ''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 3aa0bdf33bf..4d0415dbd01 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -250,7 +250,7 @@ foreach ($arrayhandler as $key => $module) if ($module->isEnabled()) { $var = !$var; - print ''; print ''; - $var=!$var; - print ""; + + print ''; print '"; print ''; print ''; - $var=!$var; - print ""; + + print ''; print '"; print ''; print ''; - $var=!$var; - print ""; + + print ''; print '"; print ''; print ''; - $var=!$var; - print ""; + + print ''; print '"; print ''; print ''; - $var=!$var; - print ""; + + print ''; print '"; print ''; print ''; - $var=!$var; - print ""; + + print ''; print '"; print ''; print ''; @@ -407,8 +407,8 @@ print ''; print ''; // Disable clear password in database -$var=!$var; -print ""; + +print ''; print ''; print '"; print ''; // Cryptage du mot de base de la base dans conf.php -$var=!$var; -print ""; + +print ''; print ''; print ''; // Disable link "Forget password" on logon -$var=!$var; -print ""; + +print ''; print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; @@ -158,8 +158,8 @@ print ''; print ''; // Use anti virus -$var=!$var; -print ""; + +print ''; print '"; print ''; // Use anti virus -$var=!$var; -print ""; + +print ''; print ''; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 9ce79359a7c..e5c66d9e24b 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -116,8 +116,8 @@ print ''; print ''; // Enable Captcha code -$var=!$var; -print ""; + +print ''; print ''; print ''; // Enable advanced perms -$var=!$var; -print ""; + +print ''; print ''; print ''; print ''; print "\n"; -$var=!$var; + $sessiontimeout=ini_get("session.gc_maxlifetime"); if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; -print ''; +print ''; print ''; @@ -194,10 +194,10 @@ print ''; print ''; -$var=!$var; + $sessiontimeout=ini_get("session.gc_maxlifetime"); if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; -print ''; +print ''; print ''; print ''; // Disable - $var=!$var; - print ''; // Separator - $var=!$var; - print ''; + + print ''; // Method - $var=!$var; - print ''; // From - $var=!$var; - print ''; + + print ''; print ''; // Autocopy to - /*$var=!$var; - print ''; + /* + print ''; print ''; */ @@ -224,31 +224,31 @@ else print ''; // Disable - $var=!$var; - print ''; + + print ''; // Separator - $var=!$var; - print ''; + + print ''; // Method - $var=!$var; - print ''; // From - $var=!$var; - print ''; + + print ''; print ''; // Autocopy to - /*$var=!$var; - print ''; + /* + print ''; print ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index f2a6d165bd5..1c5a92fb0e8 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -161,8 +161,8 @@ $var=true; $found=0; -$var=!$var; -print ""; + +print ''; print ''; print '\n\n"; $found++; -$var=!$var; -print ""; + +print ''; print ''; print '"; + +print ''; print ''; print '\n\n"; $found++; -$var=!$var; -print ""; + +print ''; print ''; print '"; + + print ''; print ''; print "\n"; }*/ @@ -265,8 +265,8 @@ $var=true; $found=0; -$var=!$var; -print ""; + +print ''; print ''; print '\n\n"; $found++; -$var=!$var; -print ""; + +print ''; print ''; print '\n\n"; $found++; -$var=!$var; -print ""; + +print ''; print ''; print '"; + + print ''; print ''; print "\n"; }*/ @@ -343,8 +343,8 @@ print " \n"; print " \n"; print ''."\n"; -$var=!$var; -print ""; + +print ''; print ''; print '\n"; // Option to force stock to be enough before adding a line into document if($conf->invoice->enabled) { $var = !$var; - print ""; + print ''; print ''; print '"; + print ''; print ''; print '"; + print ''; print ''; print '\n"; print ''."\n"; $var = !$var; - print ""; + print ''; print ''; print '\n"; print ''."\n"; if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { - $var=!$var; - print ""; + + print ''; print ''; print '\n\n"; } -$var=!$var; -print ""; + +print ''; print ''; print '\n"; print "\n"; -$var=!$var; -print ""; + +print ''; print ''; print '"; + print ''; print ''; print ''; @@ -378,7 +378,7 @@ foreach ($dirmodels as $reldir) require_once $dir.'/'.$file; $module = new $classname($db, new FactureFournisseur($db)); - $var=!$var; + print "\n"; print "'; print ''; print "\n"; -print ''; print ''; print "\n"; -print '\n"; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 1ac6ae86989..a30e7de2654 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -279,8 +279,8 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var=!$var; - print ''; @@ -402,7 +402,7 @@ foreach ($dirmodels as $reldir) require_once $dir.'/'.$file; $module = new $classname($db, new CommandeFournisseur($db)); - $var=!$var; + print "\n"; print "'; print ''; print "\n"; $var=false; + //if ($conf->global->MAIN_FEATURES_LEVEL > 0) //{ - print '\n"; - $var=!$var; + //} // Ask for payment bank during supplier order /* Kept as hidden for the moment if ($conf->banque->enabled) { - $var=!$var; - print ''; } */ -print ''; print ''; print "\n"; -print '\n"; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 933ee22a062..40caa94c8a8 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -279,7 +279,7 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { $var = !$var; - print '\n"; print "'; @@ -427,7 +427,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print '\n"; print "\n"; print ""; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + $var=! $var; print ''; print ''; print ''; -print '\n"; print ''; -$var=!$var; + print ""; print ''; print ""; -print ''; } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index ae32c073349..71d06ae8e64 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -204,8 +204,8 @@ foreach ($syslogModules as $moduleName) //print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."
\n"; if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) - $var=!$var; - print ''; + + print ''; print ''; print "\n"; $var=true; -$var=!$var; -print ''; + +print ''; print '"; + print ''; if ($newkey == 'separator') { print ''; @@ -233,14 +232,12 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=True; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + print ''; print ''."\n"; print ''."\n"; if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 6e528c73094..556961cb565 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -103,13 +103,11 @@ else if ($resql) { $num = $db->num_rows($resql); - $var=True; $i=0; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ""; + print ''; print ''; print ''; @@ -158,13 +156,11 @@ else if ($resql) { $num = $db->num_rows($resql); - $var=True; $i=0; while ($i < $num) { $row = $db->fetch_row($resql); - $var=!$var; - print ""; + print ''; print ''; print ''; print ''; @@ -182,8 +178,8 @@ else if ($base == 4) { // Sqlite by PDO or by Sqlite3 - print '
'; - print '
".$langs->trans("Parameter")."'.$langs->trans("Value")." 
'.$langs->trans("DefaultProposalDurationValidity").''."global->PROPALE_VALIDITY_DURATION."\">
'; +print '
'; print $langs->trans("UseCustomerContactAsPropalRecipientIfExist"); print ''; print $form->selectyesno("value",$conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1); @@ -572,12 +570,17 @@ print "
'; -print $langs->trans("FreeLegalTextOnProposal").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnProposal"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='PROPOSAL_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -594,13 +597,14 @@ print '' print "
'; -print $langs->trans("WatermarkOnDraftProposal").''; -print ''; +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'
'; +print '
'; +print ''; print ''; print ''; print "
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { @@ -631,8 +635,8 @@ if ($conf->banque->enabled) } else { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').'
 
'; +print '
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print '
'; print "
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("ConnectionTimeout").''; print ''; @@ -143,8 +143,8 @@ print ' '.strtolower($langs->trans("Seconds")); print '
'.$langs->trans("ResponseTimeout").''; print ''; @@ -153,8 +153,8 @@ print ' '.strtolower($langs->trans("Seconds")); print '
'.$langs->trans("MAIN_PROXY_USE").''; print ''; @@ -162,7 +162,7 @@ print $form->selectyesno('MAIN_PROXY_USE',$conf->global->MAIN_PROXY_USE,1); print '
'.$langs->trans("MAIN_PROXY_HOST").''; print ''; print ''; print ''; print '
<'.$printer->tags[$tag].'>'.$langs->trans(strtoupper($printer->tags[$tag])).'
'.$langs->trans("UseSearchToSelectResource").'
'.$langs->trans('DisabledResourceLinkUser').''; echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_USER'); @@ -120,8 +120,8 @@ print '
'.$langs->trans('DisabledResourceLinkContact').''; echo ajax_constantonoff('RESOURCE_HIDE_ADD_CONTACT_THIPARTY'); diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index b09f4820312..a04b23ce4fe 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -97,7 +97,7 @@ print "
'; + print '
'; print ucfirst($key); print "\n"; print $module->getDescription().'
'; @@ -283,7 +283,7 @@ print ''; //if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1) // Patter for Password Perso if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){ -$var=!$var; + $tabConf = explode(";",$conf->global->USER_PASSWORD_PATTERN); /*$this->length2 = $tabConf[0]; @@ -299,38 +299,38 @@ $var=!$var; print '
'.$langs->trans("PasswordPatternDesc").'
' . $langs->trans("MinLength")."
' . $langs->trans("NbMajMin")."
' . $langs->trans("NbNumMin")."
' . $langs->trans("NbSpeMin")."
' . $langs->trans("NbIteConsecutive")."
' . $langs->trans("NoAmbiCaracAutoGeneration")." '.($tabConf[5] ? $langs->trans("Activated") : $langs->trans("Disabled")).'
'.$langs->trans("Action").'
'.$langs->trans("DoNotStoreClearPassword").''; if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) @@ -441,8 +441,8 @@ print "
'.$langs->trans("MainDbPasswordFileConfEncrypted").''; if (preg_match('/crypted:/i',$dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) @@ -476,8 +476,8 @@ print '
'.$langs->trans("DisableForgetPasswordLinkOnLogonPage").''; if(! empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 0114bbb74b8..8c1b1fa5b07 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -136,7 +136,7 @@ print ''.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("MaxSizeForUploadedFiles").'.'; $max=@ini_get('upload_max_filesize'); if ($max) print ' '.$langs->trans("MustBeLowerThanPHPLimit",$max*1024,$langs->trans("Kb")).'.'; @@ -147,8 +147,8 @@ print ''; print ''.$langs->trans("UMask").''; print $form->textwithpicto('',$langs->trans("UMaskExplanation")); print '
'.$langs->trans("AntiVirusCommand").'
'; print $langs->trans("AntiVirusCommandExample"); // Check command in inside safe_mode @@ -181,8 +181,8 @@ print "
'.$langs->trans("AntiVirusParam").'
'; print $langs->trans("AntiVirusParamExample"); print '
'.$langs->trans("Status").'
'.$langs->trans("UseCaptchaCode").''; if (function_exists("imagecreatefrompng")) @@ -146,8 +146,8 @@ else print '
'.$langs->trans("UseAdvancedPerms").''; if (! empty($conf->use_javascript_ajax)) @@ -182,10 +182,10 @@ print ''.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("SessionTimeOut").''; print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); print '
'.$langs->trans("MAIN_APPLICATION_TITLE").''; print ''; diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 05fe548daff..faf05b7fb0f 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -175,31 +175,31 @@ if ($action == 'edit') print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_ALL_SMS").''; + + print '
'.$langs->trans("MAIN_DISABLE_ALL_SMS").''; print $form->selectyesno('MAIN_DISABLE_ALL_SMS',$conf->global->MAIN_DISABLE_ALL_SMS,1); print '
 
 
'.$langs->trans("MAIN_SMS_SENDMODE").''; + + print '
'.$langs->trans("MAIN_SMS_SENDMODE").''; if (count($listofmethods)) print $form->selectarray('MAIN_SMS_SENDMODE',$listofmethods,$conf->global->MAIN_SMS_SENDMODE,1); else print ''.$langs->trans("None").''; print '
'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'
'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_DISABLE_ALL_SMS").''.yn($conf->global->MAIN_DISABLE_ALL_SMS).'
'.$langs->trans("MAIN_DISABLE_ALL_SMS").''.yn($conf->global->MAIN_DISABLE_ALL_SMS).'
 
 
'.$langs->trans("MAIN_SMS_SENDMODE").''; + + print '
'.$langs->trans("MAIN_SMS_SENDMODE").''; $text=$listofmethods[$conf->global->MAIN_SMS_SENDMODE]; if (empty($text)) $text=$langs->trans("Undefined").' '.img_warning(); print $text; print '
'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).'
'.$langs->trans("MAIN_MAIL_SMS_FROM",$langs->transnoentities("Undefined")).''.$conf->global->MAIN_MAIL_SMS_FROM; if (!empty($conf->global->MAIN_MAIL_SMS_FROM) && ! isValidPhone($conf->global->MAIN_MAIL_SMS_FROM)) print ' '.img_warning($langs->trans("ErrorBadPhone")); print '
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").'
'.$langs->trans("MAIN_MAIL_AUTOCOPY_TO").''.$conf->global->MAIN_MAIL_AUTOCOPY_TO; if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO) && ! isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); print '
'.$langs->trans("DeStockOnBill").''; if (! empty($conf->facture->enabled)) @@ -181,8 +181,8 @@ else print "
'.$langs->trans("DeStockOnValidateOrder").''; if (! empty($conf->commande->enabled)) @@ -203,8 +203,8 @@ $found++; //if (! empty($conf->expedition->enabled)) //{ -$var=!$var; -print "
'.$langs->trans("DeStockOnShipment").''; if (! empty($conf->expedition->enabled)) @@ -223,8 +223,8 @@ else print "
'.$langs->trans("DeStockOnShipmentOnClosing").''; if (! empty($conf->expedition->enabled)) @@ -245,8 +245,8 @@ $found++; /*if (! $found) { - $var=!$var; - print "
'.$langs->trans("NoModuleToManageStockDecrease").'
'.$langs->trans("ReStockOnBill").''; if (! empty($conf->fournisseur->enabled)) @@ -286,8 +286,8 @@ print "
'.$langs->trans("ReStockOnValidateOrder").''; if (! empty($conf->fournisseur->enabled)) @@ -306,8 +306,8 @@ else print "
'.$langs->trans("ReStockOnDispatchOrder").''; if (! empty($conf->fournisseur->enabled)) @@ -328,8 +328,8 @@ $found++; /*if (! $found) { - $var=!$var; - print "
'.$langs->trans("NoModuleToManageStockIncrease").'
".$langs->trans("RuleForStockAvailability")." 
'.$langs->trans("WarehouseAllowNegativeTransfer").''; print "
"; @@ -359,7 +359,7 @@ print "
'.$langs->trans("StockMustBeEnoughForInvoice").''; print ""; @@ -374,7 +374,7 @@ if($conf->invoice->enabled) { if($conf->order->enabled) { $var = !$var; - print "
'.$langs->trans("StockMustBeEnoughForOrder").''; print ""; @@ -389,7 +389,7 @@ if($conf->order->enabled) { if($conf->expedition->enabled) { $var = !$var; - print "
'.$langs->trans("StockMustBeEnoughForShipment").''; print ""; @@ -417,7 +417,7 @@ if ($virtualdiffersfromphysical) print "  
'.$langs->trans("UseVirtualStockByDefault").''; print ""; @@ -441,8 +441,8 @@ print "  
'.$langs->trans("UseDispatchStatus").''; print ""; @@ -454,9 +454,9 @@ if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULAT print "
'.$langs->trans("UserWarehouseAutoCreate").''; print ""; @@ -468,9 +468,9 @@ print ''; print "
'.$langs->trans("AllowAddLimitStockByWarehouse").''; @@ -489,9 +489,9 @@ print '
'; If not used by a module, I still need to understand in which case user may need this now we can set rule on product page. if ($conf->global->PRODUIT_SOUSPRODUITS) { - $var=!$var; + - print "
'.$langs->trans("IndependantSubProductStock").''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 7510bfe37ef..19f0e6fc8e2 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -250,8 +250,8 @@ foreach ($dirmodels as $reldir) if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; - $var=!$var; - print '
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
"; print (empty($module->name)?$name:$module->name); @@ -471,8 +471,14 @@ print ''.$langs->trans("Value").' 
'; -print $langs->trans("FreeLegalTextOnInvoices").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnInvoices"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='SUPPLIER_INVOICE_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -505,7 +511,7 @@ print '
 
'; +print '
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print '
'; print "
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
"; print (empty($module->name)?$name:$module->name); @@ -491,9 +491,10 @@ print ''.$langs->trans("Value").' 
'; + print '
'; print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; print $langs->trans("IfSetToYesDontForgetPermission"); print '
'; @@ -501,15 +502,15 @@ $var=false; print ''; print ''; print "
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { @@ -530,14 +531,20 @@ if ($conf->banque->enabled) } else { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '.$langs->trans('NotAvailable').'
'; -print $langs->trans("FreeLegalTextOnOrders").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +$substitutionarray=pdf_getSubstitutionArray($langs); +$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); +$htmltext = ''.$langs->trans("AvailableVariables").':
'; +foreach($substitutionarray as $key => $val) $htmltext.=$key.'
'; +$htmltext.='
'; + +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='SUPPLIER_ORDER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -571,7 +578,7 @@ print '
 
'; +print '
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print '
'; print "
'; + print '
'; echo preg_replace('/\-.*$/','',preg_replace('/mod_supplier_payment_/','',preg_replace('/\.php$/','',$file))); print "\n"; @@ -384,7 +384,7 @@ foreach ($dirmodels as $reldir) require_once $dir.'/'.$file; $module = new $classname($db, new PaiementFourn($db)); - $var=!$var; + print "
"; print (empty($module->name)?$name:$module->name); diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 7963aa7fabc..345f622a533 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -288,8 +288,8 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print '
'.$module->nom."\n"; + + print '
'.$module->nom."\n"; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -523,12 +523,18 @@ print ''.$langs->trans("Value")." 
'; -print $langs->trans("FreeLegalTextOnSupplierProposal").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; +print '
'; +print $form->textwithpicto($langs->trans("FreeLegalTextOnSupplierProposal"), $langs->trans("AddCRIfTooLong").'

'.$htmltext).'
'; $variablename='SUPPLIER_PROPOSAL_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { @@ -545,12 +551,13 @@ print '' print "
'; -print $langs->trans("WatermarkOnDraftSupplierProposal").''; +print '
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext).'
'; +print '
'; print ''; print ''; print ''; @@ -559,8 +566,8 @@ print ''; if ($conf->banque->enabled) { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { @@ -581,8 +588,8 @@ if ($conf->banque->enabled) } else { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '.$langs->trans('NotAvailable').'
'; print ' '; print $module->getName(); @@ -257,8 +257,8 @@ print ''.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("SyslogLevel").'
'.$langs->trans("SyslogLevel").''; print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + +print ''."\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("UserAgent").''.$_SERVER['HTTP_USER_AGENT'].'
'.$langs->trans("BrowserName").''.$tmp['browsername'].'
'.$langs->trans("BrowserOS").''.$tmp['browseros'].'
'.$langs->trans("Version").''.$tmp['browserversion'].'
'.$langs->trans("Layout").' (phone/tablet/classic)'.$tmp['layout'].'
'.$langs->trans("IPAddress").''.$_SERVER['REMOTE_ADDR'].'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("Screen").''; +print '
'.$langs->trans("UserAgent").''.$_SERVER['HTTP_USER_AGENT'].'
'.$langs->trans("BrowserName").''.$tmp['browsername'].'
'.$langs->trans("BrowserOS").''.$tmp['browseros'].'
'.$langs->trans("Version").''.$tmp['browserversion'].'
'.$langs->trans("Layout").' (phone/tablet/classic)'.$tmp['layout'].'
'.$langs->trans("IPAddress").''.$_SERVER['REMOTE_ADDR'].'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; print '
'; diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 0fb3a6c9a7b..c7c7542ccaa 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -170,8 +170,7 @@ foreach($configfileparameters as $key) continue; } - $var=!$var; - print "
 
'.$obj->name.''.$obj->value.''.$obj->entity.'
'.$obj->Name.''.$obj->Engine.'
'.$row[0].''.$row[1].''.$row[2].'
'; + print '
'; + print '
'; print ''; print ''; print ''; @@ -194,7 +190,6 @@ else if ($resql) { - $var=True; while ($row = $db->fetch_row($resql)) { $rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]); @@ -205,7 +200,7 @@ else $count = '?'; } - print ""; + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index c50e6ca9e4c..45ce3c087e6 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -100,11 +100,9 @@ else if ($listname == 'listofvars') $listtouse=$listofvars; if ($listname == 'listofstatus') $listtouse=$listofstatus; - $var=true; foreach($listtouse as $param => $paramval) { - $var=!$var; - print ''; + print ''; print ''; diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index 3fc10bb0f3f..19fa3fc1abd 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -106,14 +106,11 @@ else if ($resql) { $num = $db->num_rows($resql); - $var=True; $i=0; while ($i < $num) { $row = $db->fetch_row($resql); - $var=!$var; - print ""; - + print ''; print ""; print ""; print ""; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 6a5384da69a..36260c0a228 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -68,12 +68,10 @@ llxHeader('', $title); print load_fiche_titre($title,'','title_setup'); // Version -$var=true; print '
'; print '
'.$langs->trans("TableName").''.$langs->trans("NbOfRecord").'
'.$row[0].''.$count.'
'; print $param; print '
$row[0]$row[1]$row[3]
'; print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; +print ''."\n"; +print ''."\n"; print '
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')'.DOL_VERSION; +print '
'.$langs->trans("CurrentVersion").' ('.$langs->trans("Programs").')'.DOL_VERSION; // If current version differs from last upgrade if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) { @@ -123,42 +121,31 @@ if (function_exists('curl_init')) } print '
'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'; print ''; print '
'; // Session -$var=true; print '
'; print ''; print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; +print ''."\n"; +print ''."\n"; +print '\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; +print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print '"; + print ''; if (strpos($newkey, 'separator') !== false) { print ''; @@ -463,14 +428,12 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=True; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + print ''; print ''."\n"; print ''."\n"; if (empty($conf->multicompany->enabled) || !$user->entity) print ''."\n"; // If superadmin or multicompany disabled diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 62d0999170f..4d32e10b174 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -46,15 +46,11 @@ print load_fiche_titre($langs->trans("FileCheckDolibarr"),'','title_setup'); print $langs->trans("FileCheckDesc").'

'; // Version -$var = true; print '
'.$langs->trans("Session").''.$langs->trans("Value").'
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("CurrentSessionTimeOut").''.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); +print '
'.$langs->trans("SessionSavePath").''.session_save_path().'
'.$langs->trans("SessionName").''.session_name().'
'.$langs->trans("SessionId").''.session_id().'
'.$langs->trans("CurrentSessionTimeOut").''.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds"); print ''; print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); print "
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentMenuHandler").''; +print '
'.$langs->trans("CurrentTheme").''.$conf->theme.'
'.$langs->trans("CurrentMenuHandler").''; print $conf->standard_menu; print '
'.$langs->trans("Screen").''; +print '
'.$langs->trans("Screen").''; print $_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; print '
'.$langs->trans("Session").''; +print '
'.$langs->trans("Session").''; $i=0; foreach($_SESSION as $key => $val) { @@ -177,7 +164,6 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S { $shmoparray=dol_listshmop(); - $var=true; print '
'; print ''; print ''; @@ -188,8 +174,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S foreach($shmoparray as $key => $val) { - $var=!$var; - print ''; + print ''; print ''; print ''; print ''."\n"; @@ -202,44 +187,34 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S // Localisation -$var=true; print '
'; print '
'.$key.'
'.$key.''.count($val).''.dol_getshmopaddress($key).'
'; print ''."\n"; -$var=!$var; -print ''."\n"; -$var=!$var; -print ''."\n"; +print ''."\n"; +print ''."\n"; // Thousands -$var=!$var; $thousand=$langs->transnoentitiesnoconv("SeparatorThousand"); if ($thousand == 'SeparatorThousand') $thousand=' '; // ' ' does not work on trans method if ($thousand == 'None') $thousand=''; -print ''."\n"; +print ''."\n"; // Decimals -$var=!$var; $dec=$langs->transnoentitiesnoconv("SeparatorDecimal"); -print ''."\n"; +print ''."\n"; // Show results of functions to see if everything works -$var=!$var; -print ''."\n"; -$var=!$var; -print "\n"; +print ''."\n"; +print '\n"; if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) { - $var=!$var; - print ""; + print '"; print "\n"; } -$var=!$var; -print ''."\n"; +print ''."\n"; // Timezone $txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'
'."\n"; $txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."
\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php $txt.=$langs->trans("Dolibarr constant MAIN_SERVER_TZ").': '.(empty($conf->global->MAIN_SERVER_TZ)?$langs->trans("NotDefined"):$conf->global->MAIN_SERVER_TZ); //$txt.=$langs->trans("YouCanEditPHPTZ"); // deprecated -$var=!$var; -print ''."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php -$var=!$var; -print ''."\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; +print ''."\n"; +print ''; +print ''; +print ''; // Database timezone if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') { - $var=!$var; - print ''."\n"; } // Client -$var=!$var; $tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']; -print ''."\n"; print ''."\n"; -$var=!$var; -print ''."\n"; +print ''."\n"; -$var=!$var; $filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 -print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php +print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php -$var=!$var; $tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows if (empty($tmp)) $tmp='utf-8'; // By default for other if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_FILESYSTEM_ENCODING; -print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php +print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php print '
'.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").''.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'
'.$langs->trans("CurrentUserLanguage").''.$langs->getDefaultLang().'
'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").''.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'
'.$langs->trans("CurrentUserLanguage").''.$langs->getDefaultLang().'
'.$langs->trans("CurrentValueSeparatorThousand").''.($thousand==' '?$langs->transnoentitiesnoconv("Space"):$thousand).'
'.$langs->trans("CurrentValueSeparatorThousand").''.($thousand==' '?$langs->transnoentitiesnoconv("Space"):$thousand).'
'.$langs->trans("CurrentValueSeparatorDecimal").''.$dec.'
'.$langs->trans("CurrentValueSeparatorDecimal").''.$dec.'
  => price2num(1233.56+1)'.price2num(1233.56+1,'2').'
  => price2num('."'1".$thousand."234".$dec."56')".price2num("1".$thousand."234".$dec."56",'2')."
  => price2num(1233.56+1)'.price2num(1233.56+1,'2').'
  => price2num('."'1".$thousand."234".$dec."56')".price2num("1".$thousand."234".$dec."56",'2')."
  => price2num('."'1 234.56')".price2num("1 234.56",'2')."
  => price2num('."'1 234.56')".price2num("1 234.56",'2')."
  => price(1234.56)'.price(1234.56).'
  => price(1234.56)'.price(1234.56).'
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP +print '
'.$langs->trans("CurrentTimeZone").''; // Timezone server PHP $a=getServerTimeZoneInt('now'); $b=getServerTimeZoneInt('winter'); $c=getServerTimeZoneInt('summer'); @@ -251,19 +226,14 @@ $val.='       '.getServerTimeZoneString(); $val.='       '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':($a==$c?yn($daylight):yn(0).($daylight?'     ('.$langs->trans('YesInSummer').')':''))); print $form->textwithtooltip($val,$txt,2,1,img_info('')); print '
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(),'dayhour','tzserver').'
  => dol_print_date(0,"dayhourtext")'.dol_print_date(0,"dayhourtext").'
  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')
  => '.$langs->trans("CurrentHour").''.dol_print_date(dol_now(),'dayhour','tzserver').'
  => dol_print_date(0,"dayhourtext")'.dol_print_date(0,"dayhourtext").'
  => dol_get_first_day(1970,1,false)'.dol_get_first_day(1970,1,false).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')
  => dol_get_first_day(1970,1,true)'.dol_get_first_day(1970,1,true).'     (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')
'.$langs->trans("MySQLTimeZone").' (database)'; // Timezone server base + print '
'.$langs->trans("MySQLTimeZone").' (database)'; // Timezone server base $sql="SHOW VARIABLES where variable_name = 'system_time_zone'"; $resql = $db->query($sql); if ($resql) @@ -274,9 +244,8 @@ if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') print '
'.$langs->trans("ClientTZ").''.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')'; +print '
'.$langs->trans("ClientTZ").''.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')'; print '       '.$_SESSION['dol_tz_string']; print '       '.$langs->trans("DaylingSavingTime").': '; if ($_SESSION['dol_dst']>0) print yn(1); @@ -284,19 +253,16 @@ else print yn(0); if (! empty($_SESSION['dol_dst_first'])) print '     ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']),'dayhour','gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']),'dayhour','gmt').')'; print '
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now(),'dayhour','tzuser').'
  => '.$langs->trans("ClientHour").''.dol_print_date(dol_now(),'dayhour','tzuser').'
'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)'.$filesystemencoding.'
'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)'.$filesystemencoding.'
  => '.$langs->trans("File encoding").''.$tmp.'
  => '.$langs->trans("File encoding").''.$tmp.'
'; print '
'; @@ -384,8 +350,7 @@ foreach($configfileparameters as $key => $value) } if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') continue; - $var=!$var; - print "
 
'.$obj->name.''.$obj->value.''.$obj->entity.'
'; print ''."\n"; -$var = ! $var; -print ''."\n"; -$var = ! $var; -print ''."\n"; -$var = ! $var; -print ''."\n"; +print ''."\n"; +print ''; $out.=''; $out.=''."\n"; - $var = true; $i = 0; foreach ($xml->dolibarr_constants[0]->constant as $constant) // $constant is a simpleXMLElement @@ -188,8 +183,7 @@ if ($xml) $checksumconcat[]=$valueforchecksum; $i++; - $var = !$var; - $out.=''; + $out.=''; $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; @@ -199,7 +193,7 @@ if ($xml) if ($i==0) { - $out.=''; + $out.=''; } $out.='
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionProgram").''.DOL_VERSION; +print '
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionProgram").''.DOL_VERSION; // If current version differs from last upgrade if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) { // Compare version with last install database version (upgrades never occured) @@ -172,7 +168,6 @@ if ($xml) $out.='' . $langs->trans("ExpectedValue") . '' . $langs->trans("Value") . '
'.$i.''.$constname.''.$constvalue.'
'.$langs->trans("None").'
'.$langs->trans("None").'
'; @@ -239,7 +233,6 @@ if ($xml) $out.='
' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '
'.$i.''.$file['filename'].''.$file['expectedmd5'].'
'.$langs->trans("None").'
'.$langs->trans("None").'
'; @@ -276,7 +268,6 @@ if ($xml) $out.='' . $langs->trans("Size") . ''; $out.='' . $langs->trans("DateModification") . ''; $out.=''."\n"; - $var = true; $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename'); if (is_array($tmpfilelist2) && count($tmpfilelist2)) { @@ -284,8 +275,7 @@ if ($xml) foreach ($tmpfilelist2 as $file) { $i++; - $var = !$var; - $out.=''; + $out.=''; $out.=''.$i.'' . "\n"; $out.=''.$file['filename'].'' . "\n"; $out.=''.$file['expectedmd5'].'' . "\n"; @@ -307,7 +297,7 @@ if ($xml) } else { - $out.=''.$langs->trans("None").''; + $out.=''.$langs->trans("None").''; } $out.=''; @@ -326,7 +316,6 @@ if ($xml) $out.='' . $langs->trans("Size") . ''; $out.='' . $langs->trans("DateModification") . ''; $out.=''."\n"; - $var = true; $tmpfilelist3 = dol_sort_array($file_list['added'], 'filename'); if (is_array($tmpfilelist3) && count($tmpfilelist3)) { @@ -334,8 +323,7 @@ if ($xml) foreach ($tmpfilelist3 as $file) { $i++; - $var = !$var; - $out.=''; + $out.=''; $out.=''.$i.'' . "\n"; $out.=''.$file['filename'].'' . "\n"; $out.=''.$file['expectedmd5'].'' . "\n"; @@ -357,7 +345,7 @@ if ($xml) } else { - $out.=''.$langs->trans("None").''; + $out.=''.$langs->trans("None").''; } $out.=''; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 706e0215059..4a6967089e2 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -118,9 +118,8 @@ $rights_ids = array(); foreach($sortorder as $numero=>$name) { $idperms=""; - $var=!$var; // Module - print "'; + print ''; $alt=$name.' - '.$modules_files[$numero]; if (! empty($picto[$numero])) { diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 3e9ccbc895f..8664a28b28a 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -57,7 +57,7 @@ $var=false; // Recupere la version de PHP $phpversion=version_php(); -print "'.$langs->trans("Version")."".$phpversion."\n"; +print ''.$langs->trans("Version")."".$phpversion."\n"; print ''; print '
'; @@ -76,14 +76,12 @@ foreach($phparray as $key => $value) print ''.$langs->trans("Value").''; print "\n"; - $var=true; //var_dump($value); foreach($value as $keyparam => $keyvalue) { if (! is_array($keyvalue)) { - $var=!$var; - print ''; + print ''; print ''.$keyparam.''; $valtoshow=$keyvalue; if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80); @@ -97,8 +95,7 @@ foreach($phparray as $key => $value) } else { - $var=!$var; - print ''; + print ''; print ''.$keyparam.''; $i=0; foreach($keyvalue as $keyparam2 => $keyvalue2) diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 00bf0635293..788d8604584 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -204,7 +204,7 @@ print "\n"; foreach ($list as $key) { - $var=!$var; + print ''; diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php index 5a142f3e51e..68d56bd2ded 100644 --- a/htdocs/admin/tools/eaccelerator.php +++ b/htdocs/admin/tools/eaccelerator.php @@ -174,7 +174,7 @@ function create_script_table($list) foreach($list as $script) { $var = ! $var; - print ''; + print ''; print ''.dol_trunc($script['file'],80,'left').''; print ''.dol_print_date($script['mtime'],'dayhour').''; print ''.number_format($script['size'] / 1024, 2).'KB'; @@ -207,7 +207,7 @@ function create_key_table($list) foreach($list as $key) { $var = !$var; - print ''; + print ''; print ''.dol_trunc($key['name'],80,'left').''; print ''.dol_print_date($key['created'],'dayhour').''; print ''.number_format($key['size']/1024, 3).'KB'; @@ -239,37 +239,37 @@ print ''; print 'Information'; print ''; $var = !$var; -print ''; +print ''; print 'Caching enabled'; print ''.($info['cache']?'yes':'no').''; print ''; $var = !$var; -print ''; +print ''; print 'Optimizer enabled'; print ''.$info['optimizer']?'yes':'no'.''; print ''; $var = !$var; -print ''; +print ''; print 'Memory usage'; print ''.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)'; print ''; $var = ! $var; -print ''; +print ''; print 'Free memory in reserved cache'; print ''.number_format($info['memoryAvailable']/(1024*1024), 2).'MB'; print ''; $var = ! $var; -print ''; +print ''; print 'Cached scripts'; print ''.$info['cachedScripts'].''; print ''; $var = ! $var; -print ''; +print ''; print 'Removed scripts'; print ''.$info['removedScripts'].''; print ''; $var = ! $var; -print ''; +print ''; print 'Cached keys'; print ''.(isset($info['cachedKeys'])?$info['cachedKeys']:'').''; print ''; @@ -289,12 +289,12 @@ if (is_array($resCached) || is_array($resRemoved)) { if (is_array($resCached)) { $var = ! $var; - print ""; + print ''; print "Caching"; print ''; print ""; $var = ! $var; - print ""; + print ''; print "Optimizer"; print ''; print ""; @@ -302,17 +302,17 @@ if (is_array($resCached) || is_array($resRemoved)) { if (is_array($resRemoved)) { $var = ! $var; - print ""; + print ''; print "Clear cache"; print ''; print ""; $var = ! $var; - print ""; + print ''; print "Clean cache"; print ''; print ""; $var = ! $var; - print ""; + print ''; print "Purge cache"; print ''; print ""; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 4e0651597ee..f5e6afd36b1 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -261,9 +261,9 @@ if ($result) { $obj = $db->fetch_object($result); - $var=!$var; + - print ''; + print ''; // Date print ''.dol_print_date($db->jdate($obj->dateevent),'%Y-%m-%d %H:%M:%S').''; diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index c313c91a7bd..56db6eb2ad7 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -141,9 +141,9 @@ if ($savehandler == 'files') foreach ($listofsessions as $key => $sessionentry) { - $var=!$var; + - print ""; + print ''; // Login print ''.$sessionentry['login'].''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 4dbfc53c821..75f151d45b9 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -57,10 +57,6 @@ if (! $sortfield) $sortfield='lang,transkey'; if (! $sortorder) $sortorder='ASC'; -/* - * Actions - */ - /* * Actions */ @@ -75,7 +71,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $transkey=''; $transvalue=''; @@ -83,7 +79,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_array_options=array(); } - if ($action == 'add' || (GETPOST('add') && $action != 'update')) { $error=0; @@ -105,18 +100,30 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update')) } if (! $error) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')"; + $db->begin(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")"; $result = $db->query($sql); if ($result > 0) { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $db->commit(); + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $action=""; $transkey=""; $transvalue=""; } else { - dol_print_error($db); + + $db->rollback(); + if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') + { + setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings'); + } + else + { + setEventMessages($db->lasterror(), null, 'errors'); + } $action=''; } } @@ -210,10 +217,9 @@ if ($mode == 'overwrite') // Line to add new record - $var=false; print "\n"; - print ''; + print ''; print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, 0, 'maxwidthonsmartphone', 1); print ''."\n"; print ''; @@ -240,18 +246,10 @@ if ($mode == 'overwrite') // Show constants - $sql = "SELECT"; - $sql.= " rowid"; - $sql.= ", lang"; - $sql.= ", transkey"; - $sql.= ", transvalue"; + $sql = "SELECT rowid, entity, lang, transkey, transvalue"; $sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans"; $sql.= " WHERE 1 = 1"; //$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")"; - //if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug - //else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits - //if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name')); - //$sql.= " ORDER BY entity, name ASC"; $sql.= $db->order($sortfield, $sortorder); dol_syslog("translation::select from table", LOG_DEBUG); @@ -260,16 +258,14 @@ if ($mode == 'overwrite') { $num = $db->num_rows($result); $i = 0; - $var=false; while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; print "\n"; - print ''; + print ''; print ''.$obj->lang.''."\n"; print ''.$obj->transkey.''."\n"; @@ -336,8 +332,8 @@ if ($mode == 'searchkey') foreach($filearray as $file) { $tmpfile=preg_replace('/.lang/i', '', basename($file['name'])); - $newlang->load($tmpfile, 0, 0, '', 0); - $newlangfileonly->load($tmpfile, 0, 0, '', 1); + $newlang->load($tmpfile, 0, 0, '', 0); // Load translation files + database overwrite + $newlangfileonly->load($tmpfile, 0, 0, '', 1); // Load translation files only //print 'After loading lang '.$tmpfile.', newlang has '.count($newlang->tab_translate).' records
'."\n"; } } @@ -376,10 +372,9 @@ if ($mode == 'searchkey') print "\n"; // Line to search new record - $var=false; print "\n"; - print ''; + print ''; //print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1); print $formadmin->select_language($langcode,'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1); print ''."\n"; @@ -412,24 +407,30 @@ if ($mode == 'searchkey') // Show result $i=0; - $var=false; foreach($recordtoshow as $key => $val) { $i++; if ($i <= $offset) continue; if ($i > ($offset + $limit)) break; - $var=!$var; - print ''.$langcode.''.$key.''; + print ''.$langcode.''.$key.''; print dol_escape_htmltag($val); print ''; - if ($val != $newlangfileonly->tab_translate[$key]) + if (! empty($newlangfileonly->tab_translate[$key])) { - $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]); + if ($val != $newlangfileonly->tab_translate[$key]) + { + $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]); + print $form->textwithpicto('', $htmltext, 1, 'info'); + } + } + else + { + $htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key); print $form->textwithpicto('', $htmltext, 1, 'warning'); } /*if (! empty($conf->multicompany->enabled) && !$user->entity) { - print $val; + print ''.$val.''; }*/ print ''."\n"; } diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index c1224bffe89..0aae9c6915e 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -64,8 +64,8 @@ print ' $var=True; foreach ($triggers as $trigger) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index d237ca3e727..42feea8f8ec 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -180,8 +180,8 @@ $var=true; $form = new Form($db); // Mail required for members -$var=!$var; -print ''; + +print ''; print ''; print ''; @@ -284,7 +284,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print ''; print '"; $colspan=count($fieldlist)+2; - if ($id == 4) $colspan++; - - if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of * - { - print ''; - } - print ''; // Keep   to have a line with enough height } + print '
'.$trigger['picto'].''.$trigger['file'].''.$trigger['status'].'
'.$langs->trans("UserMailRequired").' 
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 72365726d25..db5ef3cbf59 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -231,7 +231,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index b0c81ec18af..06e9a7b93a4 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -375,11 +375,11 @@ if ($id) // dans les dictionnaires de donnees $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; + $align=''; if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } if ($valuetoshow != '') { - print ''; + print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; @@ -413,14 +413,11 @@ if ($id) $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; - if ($id == 3) unset($fieldlist[2]); - if (empty($reshook)) { fieldListWebsites($fieldlist,$obj,$tabname[$id],'add'); } - if ($id == 4) print ''; if ($action != 'edit') { @@ -430,15 +427,9 @@ if ($id) print "
* '.$langs->trans("LabelUsedByDefault").'.
 
'; print ''; @@ -453,6 +444,15 @@ if ($id) $var=true; if ($num) { + print '
'; + + print '
'; + print ''; + print ''; + print ''; + + print ''; + // There is several pages if ($num > $listlimit) { @@ -503,14 +503,9 @@ if ($id) $obj = $db->fetch_object($resql); //print_r($obj); - print ''; + print ''; if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code))) { - print ''; - print ''; - print ''; - print ''; - $tmpaction='edit'; $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -548,16 +543,6 @@ if ($id) $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'').'&id='.$id.'&'; - // Favorite - // Only activated on country dictionary - if ($id == 4) - { - print ''; - } - // Active print '
'; - if ($iserasable) print ''.$actl[$obj->favorite].''; - else print $langs->trans("AlwaysActive"); - print ''; print ''.$actl[$obj->status].''; @@ -575,15 +560,15 @@ if ($id) } $i++; } + + print '
'; + + print '
'; } } else { dol_print_error($db); } - - print ''; - - print ''; } print '
'; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 1204fded0aa..7aef2671c8d 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -90,7 +90,6 @@ class DolibarrApi // Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses unset($object->linkedObjects); - unset($object->lignes); // should be ->lines unset($object->oldline); unset($object->error); diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index b622aa1d9dd..14b6dabf5e5 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -75,8 +75,8 @@ print ''; print ''.$langs->trans("Name").''; print ''.$langs->trans("Value").''; print "\n"; -$var=!$var; -print ''; + +print ''; print $langs->trans("NbOfBoomarkToShow").''; print ''; print ''; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 3cee534e797..d84713d1e62 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -41,9 +41,12 @@ function printBookmarksList($aDb, $aLangs) $langs->load("bookmarks"); $url= $_SERVER["PHP_SELF"].(! empty($_SERVER["QUERY_STRING"])?'?'.$_SERVER["QUERY_STRING"]:''); - + // TODO Add post param to $url + $ret = ''; + // Menu bookmark + /* $ret.= ''; - + */ $ret.= ''."\n"; + $ret.= '
'; + $ret.= ''; + $ret.= '
'; + + $ret.=ajax_combobox('boxbookmark'); + + $ret.=''; $ret .= ''; return $ret; diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index cf5a52cf9c6..a9d4a39ef85 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -157,15 +157,19 @@ if ($action == 'create') print ''; - print ''; - - print ''; + print ''; + dol_set_focus('#titlebookmark'); + + // Url + print ''; + // Target print ''; + // Owner print ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index d72fb19a6e5..40a316d881b 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -27,32 +27,40 @@ require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; $langs->load("bookmarks"); $langs->load("admin"); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + // Security check if (! $user->rights->bookmark->lire) { restrictedArea($user, 'bookmarks'); } $optioncss = GETPOST('optioncss','alpha'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); -if ($page == -1) { $page = 0 ; } -$offset = $conf->liste_limit * $page ; +if ($page == -1) { $page = 0; } +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="ASC"; -if (! $sortfield) $sortfield="position"; -$limit=$conf->liste_limit; +if (! $sortfield) $sortfield='position'; +if (! $sortorder) $sortorder='ASC'; + +$id = GETPOST("bid",'int'); /* * Actions */ -if ($_GET["action"] == 'delete') +if ($action == 'delete') { $bookmark=new Bookmark($db); - $res=$bookmark->remove($_GET["bid"]); + $res=$bookmark->remove($id); if ($res > 0) { header("Location: ".$_SERVER["PHP_SELF"]); @@ -71,9 +79,9 @@ if ($_GET["action"] == 'delete') $userstatic=new User($db); -llxHeader(); +llxHeader('', $langs->trans("ListOfBookmarks")); -print load_fiche_titre($langs->trans("Bookmarks")); +print load_fiche_titre($langs->trans("ListOfBookmarks")); $sql = "SELECT b.fk_soc as rowid, b.dateb, b.rowid as bid, b.fk_user, b.url, b.target, b.title, b.favicon, b.position,"; $sql.= " u.login, u.lastname, u.firstname"; @@ -100,12 +108,9 @@ if ($resql) print ""; //print ""; print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Title"),'',''); - print ""; + print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Link"),'',''); - print ""; print_liste_field_titre($langs->trans("Target"),'','','','','align="center"'); - print ""; print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder); @@ -117,8 +122,8 @@ if ($resql) { $obj = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; // Id print ''; $linkintern=0; - $title=dol_trunc($obj->title,24); - $link=dol_trunc($obj->url,24); + $title=$obj->title; + $link=$obj->url; // Title print "\n"; // Url - print "'; + print '
'.$langs->trans("NoPhotoYet")."
"; } - - print '
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("UrlOrLink").''.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'
'.$langs->trans("BehaviourOnClick").''; $liste=array(0=>$langs->trans("ReplaceWindow"),1=>$langs->trans("OpenANewWindow")); print $form->selectarray('target',$liste,1); print ''.$langs->trans("ChooseIfANewWindowMustBeOpenedOnClickOnBookmark").'
'.$langs->trans("Owner").''; print $form->select_dolusers(isset($_POST['userid'])?$_POST['userid']:$user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print ' 
 
'; @@ -126,8 +131,8 @@ if ($resql) print '"; @@ -152,7 +157,7 @@ if ($resql) print ""; + print ''; if (! $linkintern) print 'target?' target="newlink"':'').'>'; print $link; if (! $linkintern) print ''; diff --git a/htdocs/cashdesk/admin/cashdesk.php b/htdocs/cashdesk/admin/cashdesk.php index de60e8b80cf..0d1dbf2de53 100644 --- a/htdocs/cashdesk/admin/cashdesk.php +++ b/htdocs/cashdesk/admin/cashdesk.php @@ -100,27 +100,27 @@ print ''; print ''; print ''; print "\n"; -$var=!$var; -print ''; + +print ''; print ''; if (! empty($conf->banque->enabled)) { - $var=!$var; - print ''; + + print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; @@ -128,8 +128,8 @@ if (! empty($conf->banque->enabled)) if (! empty($conf->stock->enabled)) { - $var=!$var; - print ''; // Force warehouse (this is not a default value) + + print ''; // Force warehouse (this is not a default value) print ''; // Force warehouse (this is not a default value) + + print ''; // Force warehouse (this is not a default value) print ''; + +print ''; print ''; print ''; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 464b9bf3127..b2cd3d3dd31 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -49,9 +49,10 @@ class Categorie extends CommonObject const TYPE_MEMBER = 3; // TODO Replace this value with 'member' const TYPE_CONTACT = 4; // TODO Replace this value with 'contact' const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user' - const TYPE_ACCOUNT = 5; // for bank account TODO Replace this value with 'account' - const TYPE_PROJECT = 6; - public $picto = 'category'; + const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account' + const TYPE_PROJECT = 6; + const TYPE_BANK_LINE = 'bank_line'; + public $picto = 'category'; /** @@ -1337,34 +1338,68 @@ class Categorie extends CommonObject $type = $map_type[$type]; } - $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; - $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; - $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type]; - $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; - - $res = $this->db->query($sql); - if ($res) + if ($type == Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code { - while ($obj = $this->db->fetch_object($res)) - { - if ($mode == 'id') { - $cats[] = $obj->rowid; - } else if ($mode == 'label') { - $cats[] = $obj->label; - } else { - $cat = new Categorie($this->db); - $cat->fetch($obj->fk_categorie); - $cats[] = $cat; - } - } - - return $cats; - } - else - { - dol_print_error($this->db); - return -1; + // Load bank groups + $sql = "SELECT c.label, c.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c"; + $sql.= " WHERE a.lineid=".$id." AND a.fk_categ = c.rowid"; + $sql.= " ORDER BY c.label"; + + $res = $this->db->query($sql); + if ($res) + { + while ($obj = $this->db->fetch_object($res)) + { + if ($mode == 'id') { + $cats[] = $obj->rowid; + } else if ($mode == 'label') { + $cats[] = $obj->label; + } else { + $cat = new Categorie($this->db); + $cat->id = $obj->rowid; + $cat->label = $obj->label; + $cats[] = $cat; + } + } + } + else + { + dol_print_error($this->db); + return -1; + } } + else + { + $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; + $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type]; + $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; + + $res = $this->db->query($sql); + if ($res) + { + while ($obj = $this->db->fetch_object($res)) + { + if ($mode == 'id') { + $cats[] = $obj->rowid; + } else if ($mode == 'label') { + $cats[] = $obj->label; + } else { + $cat = new Categorie($this->db); + $cat->fetch($obj->fk_categorie); + $cats[] = $cat; + } + } + } + else + { + dol_print_error($this->db); + return -1; + } + } + + return $cats; } @@ -1532,14 +1567,14 @@ class Categorie extends CommonObject { while (($file = readdir($handle)) !== false) { - if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file)) + if (dol_is_file($dir.$file) && preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file)) { $nbphoto++; $photo = $file; // On determine nom du fichier vignette $photo_vignette=''; - if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) + if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) { $photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0]; } @@ -1582,7 +1617,7 @@ class Categorie extends CommonObject dol_delete_file($file,1); // Si elle existe, on efface la vignette - if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs)) + if (preg_match('/(\.jpeg|\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs)) { $photo_vignette=preg_replace('/'.$regs[0].'/i','',$filename).'_small'.$regs[0]; if (file_exists($dirthumb.$photo_vignette)) diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index ee03f9f4771..100d2d0d48e 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -105,7 +105,7 @@ if ($object->id) $head = categories_prepare_head($object,$type); - dol_fiche_head($head, 'photos', $title, 0, 'category'); + dol_fiche_head($head, 'photos', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; @@ -130,6 +130,7 @@ if ($object->id) print '
'; + print '
'; print '
'; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("CashDeskThirdPartyForSell").'
'.$langs->trans("CashDeskThirdPartyForSell").''; print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY,'socid','s.client in (1,3)',1,0,1,array(),0); print '
'.$langs->trans("CashDeskBankAccountForSell").'
'.$langs->trans("CashDeskBankAccountForSell").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH,'CASHDESK_ID_BANKACCOUNT_CASH',0,"courant=2",1); print '
'.$langs->trans("CashDeskBankAccountForCheque").'
'.$langs->trans("CashDeskBankAccountForCheque").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CHEQUE,'CASHDESK_ID_BANKACCOUNT_CHEQUE',0,"courant=1",1); print '
'.$langs->trans("CashDeskBankAccountForCB").'
'.$langs->trans("CashDeskBankAccountForCB").''; $form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CB,'CASHDESK_ID_BANKACCOUNT_CB',0,"courant=1",1); print '
'.$langs->trans("CashDeskDoNotDecreaseStock").'
'.$langs->trans("CashDeskDoNotDecreaseStock").''; if (empty($conf->productbatch->enabled)) { print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK',$conf->global->CASHDESK_NO_DECREASE_STOCK,1); @@ -145,8 +145,8 @@ if (! empty($conf->stock->enabled)) $disabled=$conf->global->CASHDESK_NO_DECREASE_STOCK; - $var=!$var; - print '
'.$langs->trans("CashDeskIdWareHouse").'
'.$langs->trans("CashDeskIdWareHouse").''; if (! $disabled) { @@ -163,7 +163,7 @@ if (! empty($conf->stock->enabled)) if (! empty($conf->service->enabled)) { $var=! $var; - print '
'; + print '
'; print $langs->trans("CashdeskShowServices"); print ''; print $form->selectyesno("CASHDESK_SERVICES",$conf->global->CASHDESK_SERVICES,1); @@ -174,7 +174,7 @@ if (! empty($conf->service->enabled)) if (! empty($conf->receiptprinter->enabled)) { $var=! $var; - print '
'; + print '
'; print $langs->trans("DolibarrReceiptPrinter").' ('.$langs->trans("FeatureNotYetAvailable").')'; print ''; print $form->selectyesno("CASHDESK_DOLIBAR_RECEIPT_PRINTER",$conf->global->CASHDESK_DOLIBAR_RECEIPT_PRINTER,1); diff --git a/htdocs/cashdesk/index.php b/htdocs/cashdesk/index.php index 9a61a50b38a..8f6af8b6d4d 100644 --- a/htdocs/cashdesk/index.php +++ b/htdocs/cashdesk/index.php @@ -63,7 +63,7 @@ top_htmlhead('','',0,0,'',$arrayofcss); logo_small)) { - print 'Logo company'; + print 'Logo company'; } else { diff --git a/htdocs/cashdesk/tpl/ticket.tpl.php b/htdocs/cashdesk/tpl/ticket.tpl.php index 78ce86f45f7..40be470c429 100644 --- a/htdocs/cashdesk/tpl/ticket.tpl.php +++ b/htdocs/cashdesk/tpl/ticket.tpl.php @@ -37,7 +37,7 @@ $object->fetch($facid);

name; ?>
diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index d1af6bdafb2..bc27be9bb12 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -96,8 +96,8 @@ $var=true; $form = new Form($db); // Mail required for members -$var=!$var; -print '

'.$langs->trans("CategorieRecursiv").''. $form->textwithpicto('',$langs->trans("CategorieRecursivHelp"),1,'help').'
'; @@ -146,7 +147,8 @@ if ($object->id) print ''; print "
\n"; - + print ''; + print dol_fiche_end(); @@ -198,7 +200,7 @@ if ($object->id) $dir = $upload_dir.'/'.$pdir; print '
'; - print ''; + print '
'; foreach ($object->liste_photos($dir) as $key => $obj) { @@ -255,14 +257,12 @@ if ($object->id) $nbphoto++; } + print '
'; + if ($nbphoto < 1) { - print '
'; - print "
".$langs->trans("NoPhotoYet")."

"; - print '
'; } } else diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index a239b357045..7dbe6325e1d 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -167,7 +167,7 @@ if (! empty($object->multilangs)) } } -dol_fiche_head($head, 'translation', $title, 0, 'category'); +dol_fiche_head($head, 'translation', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; @@ -184,6 +184,7 @@ dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', print '
'; +print '
'; print '
'; print ''; @@ -201,6 +202,7 @@ print $formother->showColor($object->color); print ''; print '
'; +print '
'; dol_fiche_end(); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a1c33c568f3..ebd5fa9991c 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -192,7 +192,7 @@ else $title=$langs->trans("Category"); $head = categories_prepare_head($object,$type); -dol_fiche_head($head, 'card', $title, 0, 'category'); +dol_fiche_head($head, 'card', $title, -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; @@ -219,11 +219,12 @@ if ($action == 'delete') print '
'; +print '
'; print '
'; print ''; // Description -print ''; @@ -241,6 +242,7 @@ if (empty($reshook) && ! empty($extrafields->attribute_label)) } print '
'; +print '
'; print $langs->trans("Description").''; print dol_htmlentitiesbr($object->description); print '
'; +print '
'; dol_fiche_end(); @@ -290,7 +292,7 @@ else $var=true; foreach ($cats as $cat) { - $var=!$var; + print "\t\n"; print "\t\t".''; print "".$cat->label.""; @@ -361,7 +363,7 @@ if ($object->type == Categorie::TYPE_PRODUCT) $var=true; foreach ($prods as $prod) { - $var=!$var; + print "\t\n"; print ''; print $prod->getNomUrl(1); @@ -412,7 +414,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER) $var=true; foreach ($socs as $soc) { - $var=!$var; + print "\t\n"; print ''; @@ -468,7 +470,7 @@ if($object->type == Categorie::TYPE_CUSTOMER) if ($user->societe_id > 0 && $soc->id != $user->societe_id) continue; // External user always see only themself $i++; - $var=!$var; + print "\t\n"; print ''; print $soc->getNomUrl(1); @@ -521,7 +523,7 @@ if ($object->type == Categorie::TYPE_MEMBER) $var=true; foreach ($prods as $key => $member) { - $var=!$var; + print "\t\n"; print ''; $member->ref=$member->login; @@ -576,7 +578,7 @@ if($object->type == Categorie::TYPE_CONTACT) foreach ($contacts as $key => $contact) { $i++; - $var=!$var; + print "\t\n"; print ''; print $contact->getNomUrl(1,'category'); @@ -630,7 +632,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT) $var=true; foreach ($accounts as $key => $account) { - $var=!$var; + print "\t\n"; print ''; print $account->getNomUrl(1,0); @@ -685,7 +687,7 @@ if ($object->type == Categorie::TYPE_PROJECT) $var=true; foreach ($projects as $key => $project) { - $var=!$var; + print "\t\n"; print ''; print $project->getNomUrl(1,0); diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index f853e88a0df..fc4fc218971 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -752,6 +752,8 @@ if ($action == 'create') print ''; print '

'; + + print ''; // Related company @@ -1184,7 +1186,7 @@ if ($id > 0) } else { - dol_fiche_head($head, 'card', $langs->trans("Action"),0,'action'); + dol_fiche_head($head, 'card', $langs->trans("Action"), -1, 'action'); // Clone event @@ -1255,6 +1257,8 @@ if ($id > 0) dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref); + print '
'; + print '
'; // Affichage fiche action en mode visu @@ -1320,7 +1324,7 @@ if ($id > 0) print '
'; print $form->select_dolusers_forevent('view', 'assignedtouser', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '
'; - if (in_array($user->id,array_keys($listofuserid))) + if ($object->datep != $object->datef && in_array($user->id,array_keys($listofuserid))) { print '
'; print $langs->trans("MyAvailability").': '.(($object->userassigned[$user->id]['transparency'] > 0)?$langs->trans("Busy"):$langs->trans("Available")); // We show nothing if event is assigned to nobody @@ -1345,6 +1349,7 @@ if ($id > 0) print '
'; + print '
'; print '
'; if ($conf->societe->enabled) @@ -1380,21 +1385,6 @@ if ($id > 0) } print ''; } - - // Project - /* - if (! empty($conf->projet->enabled)) - { - print ''; - } - */ // Priority print '
'.$langs->trans("Project").''; - if ($object->fk_project) - { - $project=new Project($db); - $project->fetch($object->fk_project); - print $project->getNomUrl(1,'',1); - } - print '
'.$langs->trans("Priority").''; @@ -1423,7 +1413,9 @@ if ($id > 0) //Extra field if (empty($reshook) && ! empty($extrafields->attribute_label)) { - print '

'; + print '

'; + print '
'; + print '
'; foreach($extrafields->attribute_label as $key=>$label) { if (isset($_POST["options_" . $key])) { @@ -1443,6 +1435,8 @@ if ($id > 0) print '
'; } + print ''; + dol_fiche_end(); } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 241843623c2..2caa55bcd59 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -121,7 +121,7 @@ if ($object->id > 0) $now=dol_now(); $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; - dol_fiche_head($head, 'documents', $langs->trans("Action"),0,'action'); + dol_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action'); $linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); $linkback.= ''.$langs->trans("BackToList").''; @@ -164,6 +164,8 @@ if ($object->id > 0) dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref); + print '
'; + print '
'; // Affichage fiche action en mode visu @@ -236,13 +238,10 @@ if ($object->id > 0) print '
'; - - print '
'; - print ''; // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { @@ -255,7 +254,9 @@ if ($object->id > 0) print '
'; - dol_fiche_end(); + print '
'; + + dol_fiche_end(); $modulepart = 'actions'; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 25d410e7bdb..d365acef38b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -306,28 +306,28 @@ $param.="&maxprint=".$maxprint; // Show navigation bar if (empty($action) || $action=='show_month') { - $nav ="".img_previous($langs->trans("Previous"), 'class="valignbottom"')."\n"; + $nav ="  \n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,1,$year),"%b %Y"); $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"), 'class="valignbottom"')."\n"; + $nav.="   \n"; $nav.="   (".$langs->trans("Today").")"; $picto='calendar'; } if ($action=='show_week') { - $nav ="".img_previous($langs->trans("Previous"), 'class="valignbottom"')."\n"; + $nav ="trans("Previous"))."\">  \n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"), 'class="valignbottom"')."\n"; + $nav.="   trans("Next"))."\">\n"; $nav.="   (".$langs->trans("Today").")"; $picto='calendarweek'; } if ($action=='show_day') { - $nav ="".img_previous($langs->trans("Previous"), 'class="valignbottom"')."\n"; + $nav ="  \n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$month,$day,$year),"daytextshort"); $nav.=" \n"; - $nav.="".img_next($langs->trans("Next"), 'class="valignbottom"')."\n"; + $nav.="   \n"; $nav.="   (".$langs->trans("Today").")"; $picto='calendarday'; } @@ -364,12 +364,19 @@ if (! empty($conf->use_javascript_ajax)) // If javascript on $s.=''."\n"; $s.='' . "\n"; @@ -384,7 +391,6 @@ if (! empty($conf->use_javascript_ajax)) // If javascript on $s.='jQuery(document).ready(function () { jQuery("table input[name^=\"check_ext\"]").click(function() { var name = $(this).attr("name"); - jQuery(".family_ext" + name.replace("check_ext", "")).toggle(); }); });' . "\n"; @@ -957,7 +963,14 @@ if (count($listofextcals)) // Complete $eventarray with events coming from external module $parameters=array(); $object=null; $reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action); -if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']); +if (! empty($hookmanager->resArray['eventarray'])) { + foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) { + if (!isset($eventarray[$keyDate])) { + $eventarray[$keyDate]=array(); + } + $eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events); + } +} @@ -1000,10 +1013,10 @@ if (empty($action) || $action == 'show_month') // View by month print $langs->trans($labelshort[$numdayinweek]); } else print $langs->trans("Day".$numdayinweek); - print "\n"; + print ' '."\n"; $i++; } - echo " \n"; + echo ' '."\n"; $todayarray=dol_getdate($now,'fast'); $todaytms=dol_mktime(0, 0, 0, $todayarray['mon'], $todayarray['mday'], $todayarray['year']); @@ -1186,21 +1199,23 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa global $theme_datacolor; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; - print "\n".'
'; + $dateint = sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day); + + print "\n"; // Line with title of day $curtime = dol_mktime(0, 0, 0, $month, $day, $year); - print ''."\n"; + print '
'."\n"; - print '
'."\n"; + print ''."\n"; // Line with td contains all div of each events - print ''; + print ''; // td tr - print '
'; - print ''; + print '
'; if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create) { $newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year; @@ -1211,11 +1226,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print img_picto($langs->trans("NewAction"),'edit_add.png'); print ''; } - print '
'; - print '
'; + print '
'; + print '
'; //$curtime = dol_mktime (0, 0, 0, $month, $day, $year); $i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array(); @@ -1235,26 +1250,26 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { if ($i < $maxprint || $maxprint == 0 || ! empty($conf->global->MAIN_JS_SWITCH_AGENDA)) { - $keysofuserassigned=array_keys($event->userassigned); + $keysofuserassigned=array_keys($event->userassigned); $ponct=($event->date_start_in_calendar == $event->date_end_in_calendar); // Define $color (Hex string like '0088FF') and $cssclass of event $color=-1; $colorindex=-1; - if (in_array($user->id, $keysofuserassigned)) - { - $nummytasks++; $cssclass='family_mytasks'; - - if (empty($cacheusers[$event->userownerid])) - { - $newuser=new User($db); - $newuser->fetch($event->userownerid); - $cacheusers[$event->userownerid]=$newuser; - } - //var_dump($cacheusers[$event->userownerid]->color); - - // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) - if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; + if (in_array($user->id, $keysofuserassigned)) + { + $nummytasks++; $cssclass='family_mytasks'; + + if (empty($cacheusers[$event->userownerid])) + { + $newuser=new User($db); + $newuser->fetch($event->userownerid); + $cacheusers[$event->userownerid]=$newuser; + } + //var_dump($cacheusers[$event->userownerid]->color); + + // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) + if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; } else if ($event->type_code == 'ICALEVENT') // Event come from external ical file { @@ -1332,7 +1347,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($user->rights->agenda->allactions->create || (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { - $cssclass.= " movable"; + $cssclass.= " movable cursormove"; }else{ $cssclass.= " unmovable"; } @@ -1345,19 +1360,25 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Show rect of event print "\n"; - print '
'."\n"; + print '
'; - print '
    '; // always 1 li per ul, 1 ul per event - print '
  • '; - print 'transparency)?'':' cal_event_busy').'" style="'.$h; + print 'background: #'.$color.';'; + print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($color, 0).'), to(#'.dol_color_minus($color, 1).'));'; //if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));'; //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;'; - print ' -moz-border-radius:4px;" width="100%">'; - print ''; + print ''; // Status - Percent - print '
    '; + //print ' -moz-border-radius:4px;"'; + //print 'border: 1px solid #ccc" width="100%"'; + print '">'; + print '
    '; + + $daterange=''; + if ($event->type_code == 'BIRTHDAY') // It's a birthday { print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact'); @@ -1373,9 +1394,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // Date if (empty($event->fulldayevent)) { - //print ''; - $daterange=''; - // Show hours (start ... end) $tmpyearstart = date('Y',$event->date_start_in_calendar); $tmpmonthstart = date('m',$event->date_start_in_calendar); @@ -1408,22 +1426,6 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user } - //print $daterange; - if ($event->type_code != 'ICALEVENT') - { - $savlabel=$event->libelle; - $event->libelle=$daterange; - //print ''; - print $event->getNomUrl(0); - //print ''; - $event->libelle=$savlabel; - } - else - { - print $daterange; - } - //print ' '; - print " "; } else { @@ -1434,9 +1436,36 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } // Show title - if ($event->type_code == 'ICALEVENT') print dol_trunc($event->libelle,$maxnbofchar); - else print $event->getNomUrl(0,$maxnbofchar,'cal_event'); + $titletoshow = $daterange; + $titletoshow.=($titletoshow?' ':'').$event->libelle; + + if ($event->type_code == 'ICALEVENT') print $titletoshow; + else + { + $savlabel=$event->libelle; + $event->libelle=$titletoshow; + print $event->getNomUrl(0,$maxnbofchar,'cal_event','',0,1); + $event->libelle=$savlabel; + } + // Loop on each assigned user + $listofusertoshow=''; + $posuserassigned=0; + foreach($event->userassigned as $tmpid => $tmpdata) + { + if (! $posuserassigned && $titletoshow) $listofusertoshow.='
    '; + $posuserassigned++; + if (empty($cacheusers[$tmpid])) + { + $newuser=new User($db); + $newuser->fetch($tmpid); + $cacheusers[$tmpid]=$newuser; + } + + $listofusertoshow.=$cacheusers[$tmpid]->getNomUrl(-3, '', 0, 0, 0, 0, '', 'valigntextbottom'); + } + print $listofusertoshow; + if ($event->type_code == 'ICALEVENT') print '
    ('.dol_trunc($event->icalname,$maxnbofchar).')'; // If action related to company / contact @@ -1479,12 +1508,16 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print '
    '; - if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') print $event->getLibStatut(3,1); + $withstatus=0; + if ($event->type_code != 'BIRTHDAY' && $event->type_code != 'ICALEVENT') + { + $withstatus=1; + if ($event->percentage >= 0) $withstatus=2; + } + print ''; + if ($withstatus) print $event->getLibStatut(3,1); else print ' '; print '
    '; - print '
  • '; - print '
'; print '
'."\n"; $i++; } @@ -1526,10 +1559,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ''."\n"; } - print '
'; - print '
'."\n"; + print '
'; // table + print "\n"; } diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 2ad3f424b12..7bee5550453 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -59,7 +59,7 @@ $object->fetch($id); $object->info($object->id); $head=actions_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("Action"),0,'action'); +dol_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action'); $linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); $linkback.= ''.$langs->trans("BackToList").''; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 0a08b6e55f1..8b1dc424239 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $langs->load("users"); $langs->load("companies"); @@ -147,6 +148,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $form=new Form($db); $userstatic=new User($db); +$formactions=new FormActions($db); $nav=''; $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); @@ -227,6 +229,7 @@ if ($type) $sql.= " AND c.id = ".$type; if ($status == '0') { $sql.= " AND a.percent = 0"; } if ($status == '-1') { $sql.= " AND a.percent = -1"; } // Not applicable if ($status == '50') { $sql.= " AND (a.percent > 0 AND a.percent < 100)"; } // Running already started +if ($status == '100') { $sql.= " AND a.percent = 100"; } if ($status == 'done' || $status == '100') { $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep2 <= '".$db->idate($now)."'))"; } if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep2 > '".$db->idate($now)."'))"; } if ($search_title) $sql.=natural_search("a.label", $search_title); @@ -324,7 +327,6 @@ if ($resql) if ($optioncss != '') $nav.= ''; if ($actioncode) $nav.=''; if ($resourceid) $nav.=''; - if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; if ($filter) $nav.=''; if ($filtert) $nav.=''; if ($socid) $nav.=''; @@ -341,21 +343,7 @@ if ($resql) print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); - //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre(""); - print "\n"; - - print ''; + print ''; print ''; print ''; print ''; @@ -368,13 +356,29 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; // Action column print ''; print "\n"; + + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); + //if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre(""); + print "\n"; $contactstatic = new Contact($db); $now=dol_now(); @@ -396,7 +400,7 @@ if ($resql) continue; } - $var=!$var; + $actionstatic->id=$obj->id; $actionstatic->ref=$obj->id; @@ -405,7 +409,7 @@ if ($resql) $actionstatic->type_picto=$obj->type_picto; $actionstatic->label=$obj->label; - print ""; + print ''; // Action (type) print '"; + + print ''; print "\n"; print ''; diff --git a/htdocs/comm/admin/propal_extrafields.php b/htdocs/comm/admin/propal_extrafields.php index 784512d6d1e..8d2ecd88277 100644 --- a/htdocs/comm/admin/propal_extrafields.php +++ b/htdocs/comm/admin/propal_extrafields.php @@ -69,7 +69,7 @@ print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup'); $head = propal_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), 0, 'propal'); +dol_fiche_head($head, 'attributes', $langs->trans("Proposals"), -1, 'propal'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/comm/admin/propaldet_extrafields.php b/htdocs/comm/admin/propaldet_extrafields.php index 633c4fab581..80f5afdaeed 100644 --- a/htdocs/comm/admin/propaldet_extrafields.php +++ b/htdocs/comm/admin/propaldet_extrafields.php @@ -76,7 +76,7 @@ print load_fiche_titre($langs->trans("PropalSetup"),$linkback,'title_setup'); $head = propal_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), 0, 'propal'); +dol_fiche_head($head, 'attributeslines', $langs->trans("Proposals"), -1, 'propal'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index aa6c2729745..aae1398109d 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -460,7 +460,7 @@ if ($id > 0) } else { - print $langs->trans("ThirdpartyNotLinkedToMember"); + print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } print ''; print "\n"; @@ -639,8 +639,8 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; print '"; + + print ''; print '"; + + print ''; print ''; print '
'; + print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); + print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index f5de3fa6ca3..61bf98634c4 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -242,10 +242,10 @@ $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); $tmpday = $first_day; -$nav ="".img_previous($langs->trans("Previous"), 'class="valignbottom"')."\n"; +$nav ="trans("Previous"))."\">   \n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; -$nav.="".img_next($langs->trans("Next"), 'class="valignbottom"')."\n"; +$nav.="   trans("Next"))."\">\n"; $nav.="   (".$langs->trans("Today").")"; $picto='calendarweek'; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 97f255abe14..760d82f0246 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -135,8 +135,8 @@ if ($resql) if ($obj) { - $var=!$var; - print "
".$obj->df."'.$obj->cc.'
'; $propal_static->id = $objp->propalid; $propal_static->ref = $objp->ref; @@ -723,8 +723,8 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - $var=!$var; - print "
'; $commande_static->id = $objp->cid; $commande_static->ref = $objp->ref; @@ -850,8 +850,8 @@ if ($id > 0) $contrat=new Contrat($db); $objp = $db->fetch_object($resql); - $var=!$var; - print "
'; $contrat->id=$objp->id; $contrat->ref=$objp->ref?$objp->ref:$objp->id; @@ -906,7 +906,7 @@ if ($id > 0) print ''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; - $var=!$var; + } $i = 0; while ($i < $num && $i < $MAXLIST) @@ -916,13 +916,13 @@ if ($id > 0) $fichinter_static->id=$objp->id; $fichinter_static->statut=$objp->fk_statut; - print ""; + print ''; print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''."\n"; //print ''.dol_print_date($db->jdate($objp->startdate)).''."\n"; print ''.convertSecondToTime($objp->duration).''."\n"; print ''.$fichinter_static->getLibStatut(5).''."\n"; print ''; - $var=!$var; + $i++; } $db->free($resql); @@ -978,8 +978,8 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; print ''; $facturestatic->id = $objp->facid; $facturestatic->ref = $objp->facnumber; @@ -1090,11 +1090,15 @@ if ($id > 0) if (! empty($conf->commande->enabled)) { - if (! empty($orders2invoice) && $orders2invoice > 0) print ''; - else print ''; + if ($object->client != 0 && $object->client != 2) + { + if (! empty($orders2invoice) && $orders2invoice > 0) print ''; + else print ''; + } + else print ''; } - - if ($object->client != 0) print ''; + + if ($object->client != 0 && $object->client != 2) print ''; else print ''; } diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 7b71e3ade9c..fe66e3ac243 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -150,9 +150,9 @@ if ($resql) { $obj = $db->fetch_object($resql); - $var=!$var; + - print ""; + print ''; print ''.img_object($langs->trans("ShowContact"),"contact"); print ' '.$obj->name.''; print "$obj->firstname"; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index f8f987f1222..4bd999b1d5a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -160,15 +160,15 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) print ''; print ''.$langs->trans("ProposalsDraft").($num?' '.$num.'':'').''; + $var=true; if ($num > 0) { $i = 0; - $var=true; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; $propalstatic->id=$obj->rowid; $propalstatic->ref=$obj->ref; $propalstatic->ref_client=$obj->ref_client; @@ -192,14 +192,14 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) } if ($total>0) { - $var=!$var; + print ''.$langs->trans("Total").''.price($total).""; } } else { - $var=!$var; - print ''.$langs->trans("NoProposal").''; + + print ''.$langs->trans("NoProposal").''; } print "
"; @@ -241,15 +241,15 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos print ''; print ''.$langs->trans("SupplierProposalsDraft").($num?' '.$num.'':'').''; + $var=true; if ($num > 0) { $i = 0; - $var=true; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; $supplierproposalstatic->id=$obj->rowid; $supplierproposalstatic->ref=$obj->ref; $supplierproposalstatic->total_ht = $obj->total_ht; @@ -272,14 +272,14 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos } if ($total>0) { - $var=!$var; + print ''.$langs->trans("Total").''.price($total).""; } } else { - $var=!$var; - print ''.$langs->trans("NoProposal").''; + + print ''.$langs->trans("NoProposal").''; } print "
"; @@ -320,15 +320,15 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; print ''.$langs->trans("DraftOrders").($num?' '.$num.'':'').''; - if ($num) + $var = true; + if ($num > 0) { $i = 0; - $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ''; + print ''; $orderstatic->id=$obj->rowid; $orderstatic->ref=$obj->ref; $orderstatic->ref_client=$obj->ref_client; @@ -352,14 +352,14 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) } if ($total>0) { - $var=!$var; + print ''.$langs->trans("Total").''.price($total).""; } } else { - $var=!$var; - print ''.$langs->trans("NoOrder").''; + + print ''.$langs->trans("NoOrder").''; } print "
"; @@ -401,15 +401,15 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande print ''; print ''.$langs->trans("DraftSuppliersOrders").($num?' '.$num.'':'').''; - if ($num) + $var = true; + if ($num > 0) { $i = 0; - $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ''; + print ''; $supplierorderstatic->id=$obj->rowid; $supplierorderstatic->ref=$obj->ref; $supplierorderstatic->ref_supplier=$obj->ref_suppliert; @@ -433,14 +433,14 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande } if ($total>0) { - $var=!$var; + print ''.$langs->trans("Total").''.price($total).""; } } else { - $var=!$var; - print ''.$langs->trans("NoSupplierOrder").''; + + print ''.$langs->trans("NoSupplierOrder").''; } print "
"; @@ -503,7 +503,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas=$objp->canvas; - print ''; + print ''; print ''.$companystatic->getNomUrl(1,'customer',48).''; print ''; print $companystatic->getLibCustProspStatut(); @@ -511,7 +511,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) print ''.dol_print_date($db->jdate($objp->tms),'day').""; print ''; $i++; - $var=!$var; + } @@ -519,7 +519,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; } @@ -562,18 +562,18 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas=$objp->canvas; - print ''; + print ''; print ''.$companystatic->getNomUrl(1,'supplier',44).''; print ''.dol_print_date($db->jdate($objp->dm),'day').''; print ''; - $var=!$var; + $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } @@ -647,7 +647,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO print $companystatic->getNomUrl(1,'customer',44); print ''."\n"; print "".$staticcontrat->LibStatut($obj->statut,3)."\n"; - $var=!$var; + $i++; } print "
"; @@ -695,8 +695,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) while ($i < $nbofloop) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; // Ref print ''; @@ -794,8 +794,8 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) while ($i < $nbofloop) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; // Ref print ''; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2ce6a638191..fe582d56656 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -57,6 +57,7 @@ $hookmanager->initHooks(array('mailingcard','globalcard')); // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) $object->substitutionarray=FormMail::getAvailableSubstitKey('emailing'); +$object->substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation"); $object->substitutionarrayfortest=array( '__ID__' => 'TESTIdRecord', @@ -72,7 +73,7 @@ $object->substitutionarrayfortest=array( '__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''), '__CHECK_READ__' => 'TagCheckMail', '__UNSUBSCRIBE__' => 'TagUnsubscribe' - //,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet + //,'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet ); // List of sending methods @@ -237,7 +238,7 @@ if (empty($reshook)) if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2); } - $substitutionisok=true; + //$substitutionisok=true; complete_substitutions_array($substitutionarray, $langs); $newsubject=make_substitutions($subject,$substitutionarray); $newmessage=make_substitutions($message,$substitutionarray); @@ -259,18 +260,18 @@ if (empty($reshook)) } // Fabrication du mail - $trackid=''; // TODO Define a trackid for mass emailing too. We can use source type for this. - $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid); + $trackid='emailing-'.$obj2->source_type.$obj2->source_id; + $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, '', 'emailing'); if ($mail->error) { $res=0; } - if (! $substitutionisok) + /*if (! $substitutionisok) { $mail->error='Some substitution failed'; $res=0; - } + }*/ // Send mail if ($res) @@ -433,7 +434,8 @@ if (empty($reshook)) } } - $mailfile = new CMailFile($tmpsujet,$object->sendto,$object->email_from,$tmpbody, $arr_file,$arr_mime,$arr_name,'', '', 0, $msgishtml,$object->email_errorsto,$arr_css); + $trackid='emailingtest'; + $mailfile = new CMailFile($tmpsujet, $object->sendto, $object->email_from, $tmpbody, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $object->email_errorsto, $arr_css, $trackid, '', 'emailing'); $result=$mailfile->sendfile(); if ($result) @@ -753,8 +755,6 @@ else $head = emailing_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("Mailing"), 0, 'email'); - // Confirmation back to draft if ($action == 'settodraft') { @@ -779,14 +779,16 @@ else if ($action != 'edit') { + dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email'); + /* * Mailing en mode visu */ if ($action == 'sendall') { // Define message to recommand from command line - - $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; + $sendingmode=$conf->global->EMAILING_MAIL_SENDMODE; + if (empty($sendingmode)) $sendingmode=$conf->global->MAIN_MAIL_SENDMODE; if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function // MAILING_NO_USING_PHPMAIL may be defined or not. @@ -841,7 +843,8 @@ else if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); - + + print '
'; print '
'; print ''; @@ -902,8 +905,10 @@ else print '
'; print "
"; + + dol_fiche_end(); - + // Clone confirmation if ($action == 'clone') { @@ -1105,7 +1110,9 @@ else /* * Mailing en mode edition */ - + + dol_fiche_head($head, 'card', $langs->trans("Mailing"), -1, 'email'); + $linkback = ''.$langs->trans("BackToList").''; $morehtmlright=''; @@ -1113,6 +1120,7 @@ else dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); + print '
'; print '
'; print ''; @@ -1131,9 +1139,6 @@ else // To print ''; - // Status - print ''; - // Nb of distinct emails print '
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'; print $langs->trans("TotalNbOfDistinctRecipients"); @@ -1159,6 +1164,7 @@ else } print '
'; + print '
'; dol_fiche_end(); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 470ee2a4ec1..d3642c50393 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -177,7 +177,7 @@ if ($object->fetch($id) >= 0) { $head = emailing_prepare_head($object); - dol_fiche_head($head, 'targets', $langs->trans("Mailing"), 0, 'email'); + dol_fiche_head($head, 'targets', $langs->trans("Mailing"), -1, 'email'); $linkback = ''.$langs->trans("BackToList").''; @@ -186,16 +186,11 @@ if ($object->fetch($id) >= 0) dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); - + print '
'; print '
'; print ''; -/* - print ''; - print ''; -*/ + print ''; print ''; @@ -204,11 +199,6 @@ if ($object->fetch($id) >= 0) print ''; - // Status -/* print ''; -*/ // Nb of distinct emails print ''; + //print ''; // print '
'; if ($allowaddtarget) { - print '
'; + print ''; print ''; } else @@ -514,7 +505,6 @@ if ($object->fetch($id) >= 0) print ''; print '
'; - $var = true; $i = 0; if ($num) @@ -523,9 +513,7 @@ if ($object->fetch($id) >= 0) { $obj = $db->fetch_object($resql); - $var=!$var; - - print ""; + print ''; print ''; print ''; print ''; @@ -599,7 +587,7 @@ if ($object->fetch($id) >= 0) { if ($object->statut < 2) { - print ''; } diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 0ea109960e7..52eacf6c115 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -57,10 +57,10 @@ print '
'; print ''; print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'id', $linkback); - print '
'.$langs->trans("MailTitle").''.$object->titre.'
'.$langs->trans("MailFrom").''.dol_print_email($object->email_from,0,0,0,0,1).'
'.$langs->trans("MailErrorsTo").''.dol_print_email($object->email_errorsto,0,0,0,0,1); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); - if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; - print '
'; print $langs->trans("TotalNbOfDistinctRecipients"); @@ -229,7 +219,8 @@ if ($object->fetch($id) >= 0) print ""; - $var=!$var; + dol_fiche_end(); + $allowaddtarget=($object->statut == 0); @@ -256,8 +247,8 @@ if ($object->fetch($id) >= 0) clearstatcache(); - $var=true; - + $var = true; + foreach ($modulesdir as $dir) { $modulenames=array(); @@ -311,12 +302,12 @@ if ($object->fetch($id) >= 0) if ($qualified) { $var = !$var; - //print '
'.$obj->email.''.$obj->lastname.''.$obj->firstname.'
'; + print '
'; print $langs->trans("NoTargetYet"); print '
'; print ''; - print ''; print ''; - print ''; print "
'.$langs->trans("SearchAMailing").'
'; + print '
'; print $langs->trans("Ref").':
'; + print '
'; print $langs->trans("Other").':

\n"; @@ -110,7 +110,7 @@ if (is_resource($handle)) foreach ($mailmodule->getSqlArrayForStats() as $sql) { - print ''; + print ''; $result=$db->query($sql); if ($result) @@ -176,9 +176,9 @@ if ($result) while ($i < $num ) { $obj = $db->fetch_object($result); - $var=!$var; + - print ""; + print ''; print ''.img_object($langs->trans("ShowEMail"),"email").' '.$obj->rowid.''; print ''.dol_trunc($obj->titre,38).''; print ''.dol_print_date($db->jdate($obj->date_creat),'day').''; diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index 5280fcfad59..ddb0d4a8fc6 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -27,6 +27,8 @@ require_once DOL_DOCUMENT_ROOT .'/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/emailing.lib.php'; +$id=GETPOST('id'); + $langs->load("mails"); // Security check @@ -45,11 +47,11 @@ $form = new Form($db); $object = new Mailing($db); -if ($object->fetch($_REQUEST["id"]) >= 0) +if ($object->fetch($id) >= 0) { $head = emailing_prepare_head($object); - dol_fiche_head($head, 'info', $langs->trans("Mailing"), 0, 'email'); + dol_fiche_head($head, 'info', $langs->trans("Mailing"), -1, 'email'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 2d6fae37b98..99af5749963 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -122,18 +122,7 @@ if ($result) print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder); - if (! $filteremail) print_liste_field_titre($langs->trans("NbOfEMails"),$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder); - if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); - else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - print ''; + print ''; print ''; @@ -151,17 +140,27 @@ if ($result) print ''; print "\n"; - $var=True; - + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder); + if (! $filteremail) print_liste_field_titre($langs->trans("NbOfEMails"),$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder); + if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); + else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + $email=new Mailing($db); while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; + - print ""; + print ""; print ''; print ''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9b70ee36ace..444669a6f49 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1516,7 +1516,7 @@ if ($action == 'create') // Public note print ''; - print ''; + print ''; print ''; - print ''; + print ''; print '"; + + print ''; print ''; print ''; print "\n"; @@ -176,9 +176,9 @@ if (! empty($conf->propal->enabled)) $var = True; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; $propalstatic->id=$obj->rowid; $propalstatic->ref=$obj->ref; @@ -236,10 +236,10 @@ if ($resql) $var = True; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; + + print ''; // Ref print '"; + print ''; print '"; + print ''; print '"; } print "
'; print ''; print '
'; print img_object($langs->trans("ShowEMail"),"email").' '.stripslashes($obj->rowid).''.$obj->titre.'
' . $langs->trans('NotePublic') . '' . $langs->trans('NotePublic') . ''; $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc)?$objectsrc->note_public:null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -1526,7 +1526,7 @@ if ($action == 'create') if (empty($user->societe_id)) { print '
' . $langs->trans('NotePrivate') . '' . $langs->trans('NotePrivate') . ''; $note_private = $object->getDefaultCreateValueFor('note_private', ((! empty($origin) && ! empty($originid) && is_object($objectsrc))?$objectsrc->note_private:null)); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3489860e1dd..46c6a55cf2f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2010-2016 Philippe Grand + * Copyright (C) 2010-2017 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry @@ -3113,21 +3113,21 @@ class Propal extends CommonObject $line->qty=1; $line->subprice=100; $line->price=100; - $line->tva_tx=19.6; + $line->tva_tx=20; $line->localtax1_tx=0; $line->localtax2_tx=0; if ($xnbp == 2) { $line->total_ht=50; - $line->total_ttc=59.8; - $line->total_tva=9.8; + $line->total_ttc=60; + $line->total_tva=10; $line->remise_percent=50; } else { $line->total_ht=100; - $line->total_ttc=119.6; - $line->total_tva=19.6; + $line->total_ttc=120; + $line->total_tva=20; $line->remise_percent=00; } @@ -3135,6 +3135,7 @@ class Propal extends CommonObject { $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; + $line->product_ref='SPECIMEN'; } $this->lines[$xnbp]=$line; diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 82978daf2c1..82244886763 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -92,7 +92,7 @@ if ($object->id > 0) dol_fiche_head($head, 'document', $langs->trans('Proposal'), -1, 'propal'); // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 82d57f721da..145d1891be3 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -66,7 +66,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; print ''; print ''; - print ''; print "
'.$langs->trans("Search").'
'; + print '
'; print $langs->trans("Proposal").':

\n"; } @@ -122,8 +122,8 @@ if ($resql) $dataseries[]=array('label'=>$propalstatic->LibStatut($status,1),'data'=>(isset($vals[$status])?(int) $vals[$status]:0)); if (! $conf->use_javascript_ajax) { - $var=!$var; - print "
'.$propalstatic->LibStatut($status,0).''.(isset($vals[$status])?$vals[$status]:0).'
'; $propalstatic->id=$obj->rowid; @@ -317,8 +317,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) while ($i < $nbofloop) { $obj = $db->fetch_object($result); - $var=!$var; - print '
'; @@ -405,9 +405,9 @@ if (! empty($conf->propal->enabled)) $var = True; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print "
'; $propalstatic->id=$obj->rowid; @@ -477,9 +477,9 @@ if (! empty($conf->propal->enabled)) $var = True; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print "
'; $propalstatic->id=$obj->rowid; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0ff70fe9107..ce6d6e2bc72 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -556,7 +556,8 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + print '
'; print ''."\n"; @@ -695,7 +696,7 @@ if ($resql) } // Action column print ''; @@ -726,7 +727,7 @@ if ($resql) if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -737,7 +738,7 @@ if ($resql) if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print ''."\n"; $now = dol_now(); @@ -746,12 +747,12 @@ if ($resql) while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $var=!$var; + $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; - print ''; + print ''; if (! empty($arrayfields['p.ref']['checked'])) { @@ -779,7 +780,7 @@ if ($resql) print ''; } // Other picto tool - print ''; if (! $i) $totalarray['nbfield']++; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 04c1af11e1d..abb24b8ffa4 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -242,7 +242,7 @@ $h++; complete_head_from_modules($conf,$langs,null,$head,$h,'propal_stats'); -dol_fiche_head($head,'byyear',$langs->trans("Statistics")); +dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); print '
'; @@ -300,7 +300,7 @@ foreach ($data as $val) while (! empty($year) && $oldyear > $year+1) { // If we have empty year $oldyear--; - $var=!$var; + print '
'; print ''; print ''; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index dd325da7297..f797025a5de 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -40,7 +40,7 @@ $var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $var=!$var; + $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index b68bdb9135e..2364672ccf9 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -58,9 +58,9 @@ if (! empty($conf->propal->enabled)) print ''; print '
'; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -807,7 +808,7 @@ if ($resql) // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; print $companystatic->getNomUrl(1,'customer'); print '
0?'&userid='.$userid:'').'">'.$oldyear.'0
'; print ''; - print ''; - print ''; + print ''; print ''; print "
'.$langs->trans("SearchAProposal").'
'; + print '
'; print $langs->trans("Ref").':
'.$langs->trans("Other").':
'.$langs->trans("Other").':

\n"; } @@ -96,8 +96,8 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print '
'; + + print '
'; print ''; print img_action($langs->trans("Show"),$obj->id).' '; print $langs->trans("StatusProspect".$obj->id); @@ -140,8 +140,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print '
'; + + print '
'; print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.''; print ''; print price($obj->price); @@ -150,7 +150,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $total += $obj->price; } if ($total>0) { - $var=!$var; + print '
'.$langs->trans("Total")."".price($total)."

"; @@ -205,8 +205,8 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; print ''; print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.''; @@ -263,8 +263,8 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; $companystatic->client=$obj->client; diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index cf93c87dabb..2be1981c5ae 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -107,7 +107,7 @@ if ($socid > 0) print ''; print ''; - dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"), 0, 'company'); dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); @@ -119,7 +119,6 @@ if ($socid > 0) // Discount print ''; print $langs->trans("CustomerRelativeDiscount").''.price2num($object->remise_percent)."%"; - print ''; print '
'; @@ -130,11 +129,11 @@ if ($socid > 0) print ''; // New value - print ''; // Motif/Note - print ''; print "
'; + print '
'; print $langs->trans("NewValue").'%
'; + print '
'; print $langs->trans("NoteReason").'
"; @@ -179,21 +178,26 @@ if ($socid > 0) print ''.$langs->trans("NoteReason").''; print ''.$langs->trans("User").''; print ''; - $i = 0 ; $num = $db->num_rows($resql); - - while ($i < $num ) - { - $obj = $db->fetch_object($resql); - $tag = !$tag; - print ''; - print ''.dol_print_date($db->jdate($obj->dc),"dayhour").''; - print ''.price2num($obj->remise_percent).'%'; - print ''.$obj->note.''; - print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; - print ''; - $i++; + if ($num > 0) + { + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + print ''; + print ''.dol_print_date($db->jdate($obj->dc),"dayhour").''; + print ''.price2num($obj->remise_percent).'%'; + print ''.$obj->note.''; + print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; + print ''; + $i++; + } } + else + { + print ''.$langs->trans("None").''; + } $db->free($resql); print ""; } diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 8c35c6c9e1f..375b4d0ecb8 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -92,7 +92,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes') $newdiscount2->fk_facture=$discount->fk_facture; $newdiscount1->fk_facture_line=$discount->fk_facture_line; $newdiscount2->fk_facture_line=$discount->fk_facture_line; - if ($discount->description == '(CREDIT_NOTE)') + if ($discount->description == '(CREDIT_NOTE)' || $discount->description == '(DEPOSIT)') { $newdiscount1->description=$discount->description; $newdiscount2->description=$discount->description; @@ -235,7 +235,7 @@ if ($socid > 0) print ''; print ''; - dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"), 0, 'company'); dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); @@ -274,6 +274,8 @@ if ($socid > 0) } print ''; + print '
'; + if ($user->rights->societe->creer) { print '
'; @@ -294,7 +296,6 @@ if ($socid > 0) print ""; } - print '
'; dol_fiche_end(); @@ -342,8 +343,8 @@ if ($socid > 0) print load_fiche_titre($langs->trans("DiscountStillRemaining")); print ''; print ''; - print ''; // Need 120+ for format with AM/PM - print ''; + print ''; // Need 120+ for format with AM/PM + print ''; print ''; print ''; print ''; @@ -354,73 +355,79 @@ if ($socid > 0) $showconfirminfo=array(); - $var = true; $i = 0; $num = $db->num_rows($resql); - while ($i < $num) + if ($num > 0) { - $obj = $db->fetch_object($resql); - $var = !$var; - print ""; - print ''; - if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) - { - print ''; - } - elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) - { - print ''; - } - elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description)) - { - print ''; - } - else - { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - if ($user->rights->societe->creer || $user->rights->facture->creer) - { - print ''; - } - else print ''; - print ''; - - if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid) - { - $showconfirminfo['rowid']=$obj->rowid; - $showconfirminfo['amount_ttc']=$obj->amount_ttc; - } - $i++; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + print ''; + print ''; + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) + { + print ''; + } + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) + { + print ''; + } + elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description)) + { + print ''; + } + else + { + print ''; + } + print ''; + print ''; + print ''; + print ''; + print ''; + if ($user->rights->societe->creer || $user->rights->facture->creer) + { + print ''; + } + else print ''; + print ''; + + if ($_GET["action"]=='split' && GETPOST('remid') == $obj->rowid) + { + $showconfirminfo['rowid']=$obj->rowid; + $showconfirminfo['amount_ttc']=$obj->amount_ttc; + } + $i++; + } } + else + { + print ''; + } $db->free($resql); print "
'.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("ConsumedBy").''.$langs->trans("AmountHT").''.$langs->trans("VATRate").'
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; - $facturestatic->id=$obj->fk_facture_source; - $facturestatic->ref=$obj->ref; - $facturestatic->type=$obj->type; - print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); - print ''; - $facturestatic->id=$obj->fk_facture_source; - $facturestatic->ref=$obj->ref; - $facturestatic->type=$obj->type; - print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); - print ''; - $facturestatic->id=$obj->fk_facture_source; - $facturestatic->ref=$obj->ref; - $facturestatic->type=$obj->type; - print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1); - print ''; - print $obj->description; - print ''.$langs->trans("NotConsumed").''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; - print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; - print ''; - print 'rowid.'">'.img_picto($langs->trans("SplitDiscount"),'split').''; - print '   '; - print 'rowid.'">'.img_delete($langs->trans("RemoveDiscount")).''; - print ' 
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; + $facturestatic->id=$obj->fk_facture_source; + $facturestatic->ref=$obj->ref; + $facturestatic->type=$obj->type; + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); + print ''; + $facturestatic->id=$obj->fk_facture_source; + $facturestatic->ref=$obj->ref; + $facturestatic->type=$obj->type; + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); + print ''; + $facturestatic->id=$obj->fk_facture_source; + $facturestatic->ref=$obj->ref; + $facturestatic->type=$obj->type; + print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1); + print ''; + print $obj->description; + print ''.$langs->trans("NotConsumed").''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; + print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; + print ''; + print 'rowid.'">'.img_split($langs->trans("SplitDiscount")).''; + print '   '; + print 'rowid.'">'.img_delete($langs->trans("RemoveDiscount")).''; + print ' 
'.$langs->trans("None").'
"; @@ -491,8 +498,8 @@ if ($socid > 0) print load_fiche_titre($langs->trans("DiscountAlreadyCounted")); print ''; print ''; - print ''; // Need 120+ for format with AM/PM - print ''; + print ''; // Need 120+ for format with AM/PM + print ''; print ''; print ''; print ''; @@ -501,15 +508,17 @@ if ($socid > 0) print ''; print ''; - $var = true; $tab_sqlobj=array(); $tab_sqlobjOrder=array(); $num = $db->num_rows($resql); - for ($i = 0;$i < $num;$i++) + if ($num > 0) { - $sqlobj = $db->fetch_object($resql); - $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc); + for ($i = 0;$i < $num; $i++) + { + $sqlobj = $db->fetch_object($resql); + $tab_sqlobj[] = $sqlobj; + $tab_sqlobjOrder[]=$db->jdate($sqlobj->dc); + } } $db->free($resql); @@ -524,57 +533,64 @@ if ($socid > 0) array_multisort($tab_sqlobjOrder,SORT_DESC,$tab_sqlobj); $num = count($tab_sqlobj); - $i = 0 ; - while ($i < $num ) + if ($num > 0) { - $obj = array_shift($tab_sqlobj); - $var = !$var; - print ""; - print ''; - if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) - { - print ''; - } - elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) - { - print ''; - } - elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description)) - { - print ''; - } - else - { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $i++; + $i = 0 ; + while ($i < $num ) + { + $obj = array_shift($tab_sqlobj); + print ''; + print ''; + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) + { + print ''; + } + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) + { + print ''; + } + elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description)) + { + print ''; + } + else + { + print ''; + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } } + else + { + print ''; + } + print "
'.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("Date").''.$langs->trans("ReasonDiscount").''.$langs->trans("ConsumedBy").''.$langs->trans("AmountHT").''.$langs->trans("VATRate").' 
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; - $facturestatic->id=$obj->fk_facture_source; - $facturestatic->ref=$obj->ref; - $facturestatic->type=$obj->type; - print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); - print ''; - $facturestatic->id=$obj->fk_facture_source; - $facturestatic->ref=$obj->ref; - $facturestatic->type=$obj->type; - print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); - print ''; - $facturestatic->id=$obj->fk_facture_source; - $facturestatic->ref=$obj->ref; - $facturestatic->type=$obj->type; - print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1); - print ''; - print $obj->description; - print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; - print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; - print ' 
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; + $facturestatic->id=$obj->fk_facture_source; + $facturestatic->ref=$obj->ref; + $facturestatic->type=$obj->type; + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); + print ''; + $facturestatic->id=$obj->fk_facture_source; + $facturestatic->ref=$obj->ref; + $facturestatic->type=$obj->type; + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); + print ''; + $facturestatic->id=$obj->fk_facture_source; + $facturestatic->ref=$obj->ref; + $facturestatic->type=$obj->type; + print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1); + print ''; + print $obj->description; + print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.''.price($obj->amount_ht).''.price2num($obj->tva_tx,'MU').'%'.price($obj->amount_ttc).''; + print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; + print ' 
'.$langs->trans("None").'
"; } else diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 01a33e550a2..e369a1a7217 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1255,10 +1255,6 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; - /* - * Send mail - */ - // Actions to send emails $actiontypecode='AC_COM'; $trigger_name='ORDER_SENTBYMAIL'; @@ -2589,7 +2585,6 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; // ancre // Documents $comref = dol_sanitizeFileName($object->ref); - $file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf'; $relativepath = $comref . '/' . $comref . '.pdf'; $filedir = $conf->commande->dir_output . '/' . $comref; $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e87923beb8c..82050b7b586 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -464,6 +464,7 @@ class Commande extends CommonOrder if ($this->lines[$i]->fk_product > 0) { $mouvP = new MouvementStock($this->db); + $mouvP->origin = &$this; // We increment stock of product (and sub-products) $result=$mouvP->reception($user, $this->lines[$i]->fk_product, $idwarehouse, $this->lines[$i]->qty, 0, $langs->trans("OrderBackToDraftInDolibarr",$this->ref)); if ($result < 0) { $error++; $this->error=$mouvP->error; break; } @@ -3541,25 +3542,26 @@ class Commande extends CommonOrder $line->qty=1; $line->subprice=100; $line->price=100; - $line->tva_tx=19.6; + $line->tva_tx=20; if ($xnbp == 2) { $line->total_ht=50; - $line->total_ttc=59.8; - $line->total_tva=9.8; + $line->total_ttc=60; + $line->total_tva=10; $line->remise_percent=50; } else { $line->total_ht=100; - $line->total_ttc=119.6; - $line->total_tva=19.6; + $line->total_ttc=120; + $line->total_tva=20; $line->remise_percent=0; } if ($num_prods > 0) { $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; + $line->product_ref='SPECIMEN'; } $this->lines[$xnbp]=$line; diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 5f9a5a570ff..b5672f276e7 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -155,9 +155,9 @@ if ($resql) { $obj = $db->fetch_object($resql); - $var=!$var; + - print ""; + print ''; print ''; $result=''; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 199cb6d43c3..ef4f220f3e4 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -95,7 +95,7 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), -1, 'order'); // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index f24202f7fff..9f7f36f78ca 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -70,7 +70,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; print ''; print ''; - print ''; print "
'.$langs->trans("Search").'
'; + print '
'; print $langs->trans("CustomerOrder").':

\n"; } @@ -141,8 +141,8 @@ if ($resql) { if (! $conf->use_javascript_ajax) { - $var=!$var; - print ""; + + print ''; print ''.$commandestatic->LibStatut($status,$bool,0).''; print ''.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' '; print $commandestatic->LibStatut($status,$bool,3); @@ -196,7 +196,7 @@ if (! empty($conf->commande->enabled)) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); $commandestatic->id=$obj->rowid; @@ -208,7 +208,7 @@ if (! empty($conf->commande->enabled)) $companystatic->code_client=$obj->code_client; $companystatic->canvas=$obj->canvas; - print ""; + print ''; print ''; print $commandestatic->getNomUrl(1); print ""; @@ -220,8 +220,8 @@ if (! empty($conf->commande->enabled)) } else { - $var=!$var; - print ''.$langs->trans("NoOrder").''; + + print ''.$langs->trans("NoOrder").''; } print "
"; } @@ -268,10 +268,10 @@ if ($resql) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; $commandestatic->id=$obj->rowid; @@ -349,9 +349,9 @@ if (! empty($conf->commande->enabled)) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; $commandestatic->id=$obj->rowid; @@ -431,9 +431,9 @@ if (! empty($conf->commande->enabled)) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; $commandestatic->id=$obj->rowid; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 03b9cfce56a..4185518b721 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -199,227 +199,226 @@ if (empty($reshook)) $permtodelete = $user->rights->commande->supprimer; $uploaddir = $conf->commande->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; -} - -if ($massaction == 'confirm_createbills') { - - $orders = GETPOST('toselect'); - $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('valdate_invoices', 'int'); - - $TFact = array(); - $TFactThird = array(); - - $nb_bills_created = 0; - - $db->begin(); - - foreach($orders as $id_order) { - - $cmd = new Commande($db); - if($cmd->fetch($id_order) <= 0) continue; - - $object = new Facture($db); - if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. - else { - - $object->socid = $cmd->socid; - $object->type = Facture::TYPE_STANDARD; - $object->cond_reglement_id = $cmd->cond_reglement_id; - $object->mode_reglement_id = $cmd->mode_reglement_id; - $object->fk_project = $cmd->fk_project; - - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - if (empty($datefacture)) - { - $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); - } - - $object->date = $datefacture; - $object->origin = 'commande'; - $object->origin_id = $id_order; - - $res = $object->create($user); - - if($res > 0) $nb_bills_created++; - - } - - if($object->id > 0) { - - $db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; - $sql.= "fk_source"; - $sql.= ", sourcetype"; - $sql.= ", fk_target"; - $sql.= ", targettype"; - $sql.= ") VALUES ("; - $sql.= $id_order; - $sql.= ", '".$object->origin."'"; - $sql.= ", ".$object->id; - $sql.= ", '".$object->element."'"; - $sql.= ")"; - - if ($db->query($sql)) - { - $db->commit(); - } - else - { - $db->rollback(); - } - - $lines = $cmd->lines; - if (empty($lines) && method_exists($cmd, 'fetch_lines')) - { - $cmd->fetch_lines(); - $lines = $cmd->lines; - } - - $fk_parent_line=0; - $num=count($lines); - - for ($i=0;$i<$num;$i++) - { - $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); - if ($lines[$i]->subprice < 0) - { - // Negative line, we create a discount line - $discount = new DiscountAbsolute($db); - $discount->fk_soc=$object->socid; - $discount->amount_ht=abs($lines[$i]->total_ht); - $discount->amount_tva=abs($lines[$i]->total_tva); - $discount->amount_ttc=abs($lines[$i]->total_ttc); - $discount->tva_tx=$lines[$i]->tva_tx; - $discount->fk_user=$user->id; - $discount->description=$desc; - $discountid=$discount->create($user); - if ($discountid > 0) - { - $result=$object->insert_discount($discountid); - //$result=$discount->link_to_invoice($lineid,$id); - } - else - { - setEventMessages($discount->error, $discount->errors, 'errors'); - $error++; - break; - } - } - else - { - // Positive line - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - // Date start - $date_start=false; - if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; - //Date end - $date_end=false; - if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) - { - $fk_parent_line = 0; - } - $result = $object->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $date_start, - $date_end, - 0, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $product_type, - $ii, - $lines[$i]->special_code, - $object->origin, - $lines[$i]->rowid, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht, - $lines[$i]->label - ); - if ($result > 0) - { - $lineid=$result; - } - else - { - $lineid=0; - $error++; - break; - } - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) - { - $fk_parent_line = $result; - } - } - } - - } - - $cmd->classifyBilled($user); - - if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; - else $TFact[$object->id] = $object; - } - - // Build doc with all invoices - $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; - $toselect = array(); - - if(!empty($validate_invoices)) { - - $massaction = $action = 'builddoc'; - - foreach($TAllFact as &$object) { - $object->validate($user); - $toselect[] = $object->id; // For builddoc action - - // Fac builddoc - $upload_dir = $conf->facture->dir_output; - $permissioncreate=$user->rights->facture->creer; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - } - - $objectclass='Facture'; - $objectlabel='Invoice'; - $permtoread = $user->rights->facture->lire; - $permtodelete = $user->rights->facture->supprimer; - $uploaddir = $conf->facture->dir_output; - include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; - - } - - if (! $error) - { - $db->commit(); - setEventMessage($langs->trans('BillCreated', $nb_bills_created)); - } - else - { - $db->rollback(); - $action='create'; - $_GET["origin"]=$_POST["origin"]; - $_GET["originid"]=$_POST["originid"]; - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - + // TODO Move this into mass action include + if ($massaction == 'confirm_createbills') { + + $orders = GETPOST('toselect'); + $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); + $validate_invoices = GETPOST('valdate_invoices', 'int'); + + $TFact = array(); + $TFactThird = array(); + + $nb_bills_created = 0; + + $db->begin(); + + foreach($orders as $id_order) { + + $cmd = new Commande($db); + if($cmd->fetch($id_order) <= 0) continue; + + $object = new Facture($db); + if(!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. + else { + + $object->socid = $cmd->socid; + $object->type = Facture::TYPE_STANDARD; + $object->cond_reglement_id = $cmd->cond_reglement_id; + $object->mode_reglement_id = $cmd->mode_reglement_id; + $object->fk_project = $cmd->fk_project; + + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($datefacture)) + { + $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); + } + + $object->date = $datefacture; + $object->origin = 'commande'; + $object->origin_id = $id_order; + + $res = $object->create($user); + + if($res > 0) $nb_bills_created++; + + } + + if($object->id > 0) { + + $db->begin(); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; + $sql.= "fk_source"; + $sql.= ", sourcetype"; + $sql.= ", fk_target"; + $sql.= ", targettype"; + $sql.= ") VALUES ("; + $sql.= $id_order; + $sql.= ", '".$object->origin."'"; + $sql.= ", ".$object->id; + $sql.= ", '".$object->element."'"; + $sql.= ")"; + + if ($db->query($sql)) + { + $db->commit(); + } + else + { + $db->rollback(); + } + + $lines = $cmd->lines; + if (empty($lines) && method_exists($cmd, 'fetch_lines')) + { + $cmd->fetch_lines(); + $lines = $cmd->lines; + } + + $fk_parent_line=0; + $num=count($lines); + + for ($i=0;$i<$num;$i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + if ($lines[$i]->subprice < 0) + { + // Negative line, we create a discount line + $discount = new DiscountAbsolute($db); + $discount->fk_soc=$object->socid; + $discount->amount_ht=abs($lines[$i]->total_ht); + $discount->amount_tva=abs($lines[$i]->total_tva); + $discount->amount_ttc=abs($lines[$i]->total_ttc); + $discount->tva_tx=$lines[$i]->tva_tx; + $discount->fk_user=$user->id; + $discount->description=$desc; + $discountid=$discount->create($user); + if ($discountid > 0) + { + $result=$object->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } + else + { + setEventMessages($discount->error, $discount->errors, 'errors'); + $error++; + break; + } + } + else + { + // Positive line + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + // Date start + $date_start=false; + if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + //Date end + $date_end=false; + if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) + { + $fk_parent_line = 0; + } + $result = $object->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $ii, + $lines[$i]->special_code, + $object->origin, + $lines[$i]->rowid, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht, + $lines[$i]->label + ); + if ($result > 0) + { + $lineid=$result; + } + else + { + $lineid=0; + $error++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) + { + $fk_parent_line = $result; + } + } + } + + } + + $cmd->classifyBilled($user); + + if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; + else $TFact[$object->id] = $object; + } + + // Build doc with all invoices + $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; + $toselect = array(); + + if(!empty($validate_invoices)) { + + $massaction = $action = 'builddoc'; + + foreach($TAllFact as &$object) { + $object->validate($user); + $toselect[] = $object->id; // For builddoc action + + // Fac builddoc + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + } + + $objectclass='Facture'; + $objectlabel='Invoice'; + $permtoread = $user->rights->facture->lire; + $permtodelete = $user->rights->facture->supprimer; + $uploaddir = $conf->facture->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + + } + + if (! $error) + { + $db->commit(); + setEventMessage($langs->trans('BillCreated', $nb_bills_created)); + } + else + { + $db->rollback(); + $action='create'; + $_GET["origin"]=$_POST["origin"]; + $_GET["originid"]=$_POST["originid"]; + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } } @@ -435,8 +434,9 @@ $formfile = new FormFile($db); $companystatic = new Societe($db); $formcompany=new FormCompany($db); +$title=$langs->trans("Orders"); $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; -llxHeader('',$langs->trans("Orders"),$help_url); +llxHeader('',$title,$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; @@ -563,8 +563,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit + 1,$offset); - //print $sql; + $resql = $db->query($sql); if ($resql) { @@ -622,7 +622,6 @@ if ($resql) if ($show_files) $param.='&show_files=' .$show_files; if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($billed != '') $param.='&billed='.$billed; - // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -654,6 +653,7 @@ if ($resql) print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, '', '', $limit); + // TODO Move this into an invluce if ($massaction == 'presend') { $langs->load("mails"); @@ -679,9 +679,6 @@ if ($resql) print ''; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail = new FormMail($db); - dol_fiche_head(null, '', ''); $topicmail="SendOrderRef"; @@ -789,7 +786,6 @@ if ($resql) print ''; print '
'; print '
'; - } if ($sall) @@ -841,7 +837,8 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + print '
'; print ''."\n"; @@ -992,7 +989,7 @@ if ($resql) } // Action column print ''; @@ -1021,7 +1018,7 @@ if ($resql) if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -1033,7 +1030,7 @@ if ($resql) if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'],$_SERVER["PHP_SELF"],"c.fk_statut","",$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'],$_SERVER["PHP_SELF"],'c.facture','',$param,'align="center"',$sortfield,$sortorder,''); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print ''."\n"; $total=0; @@ -1048,7 +1045,8 @@ if ($resql) while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - print ''; + + print ''; $notshippable=0; $warning = 0; @@ -1221,7 +1219,7 @@ if ($resql) // Third party if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + + print ''; print ''; print ''; print ''; @@ -335,7 +335,7 @@ foreach ($data as $val) print ''; } - $var=!$var; + print ''; print ''; print ''; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 38efbc91ca2..629cd3c0fb0 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -36,7 +36,7 @@ $var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $var=!$var; + $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index af63247f48d..cb10fd8c3c7 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -144,7 +144,7 @@ else // Onglets $head=bank_prepare_head($object); -dol_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0,'account'); +dol_fiche_head($head, 'annual', $langs->trans("FinancialAccount"), -1, 'account'); $title=$langs->trans("FinancialAccount")." : ".$object->label; $link=($year_start?"".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"')."":""); @@ -203,8 +203,8 @@ print ''; $var=true; for ($mois = 1 ; $mois < 13 ; $mois++) { - $var=!$var; - print ''; + + print ''; print ""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 9af9b6f4707..bddf1292214 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -178,7 +178,7 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_dt_start=''; $search_dt_end=''; @@ -298,7 +298,7 @@ if (GETPOST('save') && $id && ! $cancel && $user->rights->banque->modifier) if (! $error) { $object->fetch($id); - $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); + $insertid = $object->addline($dateop, $operation, $label, $amount, $num_chq, ($cat1 > 0 ? $cat1 : 0), $user); if ($insertid > 0) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); @@ -720,43 +720,8 @@ if ($resql) print '
'; print '
'; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'; + print ''; print $companystatic->getNomUrl(1,'customer'); // If module invoices enabled and user with invoice creation permissions @@ -1391,7 +1389,7 @@ if ($resql) } // Show total line - if (isset($totalarray['totalhtfield']) + if (isset($totalarray['totalhtfield']) || isset($totalarray['totalvatfield']) || isset($totalarray['totalttcfield']) || isset($totalarray['totalamfield']) @@ -1427,8 +1425,6 @@ if ($resql) print ''."\n"; - //print '
'.img_help(1,'').' '.$langs->trans("ToBillSeveralOrderSelectCustomer", $langs->transnoentitiesnoconv("CreateInvoiceForThisCustomer")).'
'; - if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) { /* @@ -1439,7 +1435,7 @@ if ($resql) $filedir=$diroutputmassaction; $genallowed=$user->rights->commande->lire; - $delallowed=$user->rights->commande->lire; + $delallowed=$user->rights->commande->supprimer; print $formfile->showdocuments('massfilesarea_orders','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,''); } @@ -1454,6 +1450,5 @@ else dol_print_error($db); } -// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 17c73c82698..c6b93cb8f0f 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -653,8 +653,8 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) while ($i < $num) { $objp = $db->fetch_object($resql); - $var=!$var; - print '
'; $generic_commande->id=$objp->rowid; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index d900709b835..dd79ee54ba1 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -253,7 +253,7 @@ if ($mode == 'supplier') $type='supplier_order_stats'; complete_head_from_modules($conf,$langs,null,$head,$h,$type); -dol_fiche_head($head,'byyear',$langs->trans("Statistics")); +dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); print '
'; @@ -323,7 +323,7 @@ foreach ($data as $val) while (! empty($year) && $oldyear > $year+1) { // If we have empty year $oldyear--; - $var=!$var; + print '
0?'&userid='.$userid:'').'">'.$oldyear.'0
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].'
".dol_print_date(dol_mktime(1,1,1,$mois,1,2000),"%B")."
'."\n"; - - // Fields title - print ''; - if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev, b.dateo, b.rowid','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder); - // Extra fields - if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); - } - } - } - // Hook fields - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - print ''; + print ''; if (! empty($arrayfields['b.rowid']['checked'])) { print ''; print "\n"; + + // Fields title + print ''; + if (! empty($arrayfields['b.rowid']['checked'])) print_liste_field_titre($arrayfields['b.rowid']['label'],$_SERVER['PHP_SELF'],'b.rowid','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['description']['checked'])) print_liste_field_titre($arrayfields['description']['label'],$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['b.dateo']['checked'])) print_liste_field_titre($arrayfields['b.dateo']['label'],$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['b.datev']['checked'])) print_liste_field_titre($arrayfields['b.datev']['label'],$_SERVER['PHP_SELF'],'b.datev, b.dateo, b.rowid','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['b.num_chq']['checked'])) print_liste_field_titre($arrayfields['b.num_chq']['label'],$_SERVER['PHP_SELF'],'b.num_chq','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['bu.label']['checked'])) print_liste_field_titre($arrayfields['bu.label']['label'],$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['ba.ref']['checked'])) print_liste_field_titre($arrayfields['ba.ref']['label'],$_SERVER['PHP_SELF'],'ba.ref','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['b.debit']['checked'])) print_liste_field_titre($arrayfields['b.debit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + $balance = 0; // For balance $balancecalculated = false; @@ -897,9 +899,9 @@ if ($resql) $bankaccount = $cachebankaccount[$objp->bankid]; } - $var=!$var; + - print ""; + print ''; // Ref if (! empty($arrayfields['b.rowid']['checked'])) diff --git a/htdocs/compta/bank/bilan.php b/htdocs/compta/bank/bilan.php index c1d668df8d7..eb6aea4f2dc 100644 --- a/htdocs/compta/bank/bilan.php +++ b/htdocs/compta/bank/bilan.php @@ -66,22 +66,22 @@ print ""; echo ''; print "\n"; -$var=!$var; + $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."paiement"; $paiem = valeur($sql); print ""; -$var=!$var; + $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank WHERE amount > 0"; $credits = valeur($sql); print ""; -$var=!$var; + $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank WHERE amount < 0"; $debits = valeur($sql); print ""; -$var=!$var; + $sql = "SELECT sum(amount) as amount FROM ".MAIN_DB_PREFIX."bank "; $solde = valeur($sql); print ""; diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index cd6d2adb796..699edd31b7a 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -74,8 +74,8 @@ if ($result) while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; print ""; print ''; print '"; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index dcc0fc85ecc..df6e6b1c8c8 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -117,7 +117,7 @@ if ($action == 'add') if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) { - setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'error'); + setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountancyCode")), null, 'errors'); $action='create'; // Force chargement page en mode creation $error++; } @@ -713,7 +713,7 @@ else print '
'; @@ -837,6 +802,43 @@ if ($resql) print '
'.$langs->trans("Summary").'
Somme des paiements (associes a une facture)".price($paiem)."
Somme des credits".price($credits)."
Somme des debits".price($debits)."
".$langs->trans("BankBalance")."".price($solde)."
rowid\">$objp->label'.$objp->nombre.''.price(abs($objp->somme))."
'; - print ''; + print ''; print ''; // Show fields of bank account @@ -957,7 +957,7 @@ else print '
'; - print '
'; + //print '
'; print '
'.$langs->trans("BankName").'
'.$langs->trans("BankName").''.$object->bank.'
'; @@ -991,7 +991,7 @@ else { print '
'; - print '
'; + //print '
'; print '
'; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 51030242fce..0cf88224e63 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -80,7 +80,7 @@ if ($categid) { llxHeader(); -print load_fiche_titre($langs->trans("Rubriques"), '', 'title_bank.png'); +print load_fiche_titre($langs->trans("RubriquesTransactions"), '', 'title_bank.png'); print ''; print ''; @@ -105,8 +105,8 @@ if ($result) while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; print ''; if (GETPOST("action") == 'edit' && GETPOST("categid")== $objp->rowid) { @@ -136,8 +136,8 @@ if ($result) */ if ($action != 'edit') { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 1670ac2917c..897fd5de496 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -390,7 +390,7 @@ class Account extends CommonObject * @param string $label Descripton * @param float $amount Amount * @param string $num_chq Numero cheque ou virement - * @param string $categorie Categorie optionnelle + * @param int $categorie Category id (optionnal) * @param User $user User that create * @param string $emetteur Name of cheque writer * @param string $banque Bank of cheque writer @@ -480,8 +480,8 @@ class Account extends CommonObject $result = $this->db->query($sql); if (!$result) { + $this->error = $this->db->lasterror(); $this->db->rollback(); - $this->error = $this->db->error(); return -3; } } @@ -1243,9 +1243,10 @@ class Account extends CommonObject * * @param int $withpicto Include picto into link * @param string $mode ''=Link to card, 'transactions'=Link to transactions card + * @param string $option ''=Show ref, 'reflabel'=Show ref+label * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $mode='') + function getNomUrl($withpicto=0, $mode='', $option='') { global $conf, $langs; @@ -1279,7 +1280,7 @@ class Account extends CommonObject } if ($withpicto) $result.=($link.img_object($label, 'account', 'class="classfortooltip"').$linkend.' '); - $result.=$link.$this->ref.$linkend; + $result.=$link.$this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : '').$linkend; return $result; } @@ -1553,7 +1554,8 @@ class AccountLine extends CommonObject var $db; var $element='bank'; var $table_element='bank'; - + var $picto = 'generic'; + var $id; var $ref; var $datec; @@ -2040,5 +2042,61 @@ class AccountLine extends CommonObject return $result; } + + /** + * Return label of status (activity, closed) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @return string Libelle + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id statut + * @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 Libelle du statut + */ + function LibStatut($statut,$mode=0) + { + global $langs; + //$langs->load('companies'); + /* + if ($mode == 0) + { + if ($statut==0) return $langs->trans("ActivityCeased"); + if ($statut==1) return $langs->trans("InActivity"); + } + if ($mode == 1) + { + if ($statut==0) return $langs->trans("ActivityCeased"); + if ($statut==1) return $langs->trans("InActivity"); + } + if ($mode == 2) + { + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); + if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); + } + if ($mode == 3) + { + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); + if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); + } + if ($mode == 4) + { + if ($statut==0) return img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"').' '.$langs->trans("ActivityCeased"); + if ($statut==1) return img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"').' '.$langs->trans("InActivity"); + } + if ($mode == 5) + { + if ($statut==0) return $langs->trans("ActivityCeased").' '.img_picto($langs->trans("ActivityCeased"),'statut5', 'class="pictostatus"'); + if ($statut==1) return $langs->trans("InActivity").' '.img_picto($langs->trans("InActivity"),'statut4', 'class="pictostatus"'); + }*/ + } + } diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 073c28be1ca..176fdb626a5 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -30,10 +30,11 @@ class BankCateg // extends CommonObject { //public $element='bank_categ'; //!< Id that identify managed objects //public $table_element='bank_categ'; //!< Name of table without prefix where object is stored - + public $picto='generic'; + public $id; public $label; - + /** * Constructor diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index db70acc7373..084cddf51cd 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -107,7 +107,7 @@ if ($id > 0 || !empty($ref)) { // Onglets $head = bank_prepare_head($object); - dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), 0, 'account'); + dol_fiche_head($head, 'document', $langs->trans("FinancialAccount"), -1, 'account'); // Construit liste des fichiers diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 29877302104..a92b23fc617 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -285,39 +285,7 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel print '
'; print '
'.$objp->rowid.'
 
'."\n"; -// Fields title -print ''; -if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); -// Extra fields -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) -{ - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); - } - } -} -// Hook fields -$parameters=array('arrayfields'=>$arrayfields); -$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook -print $hookmanager->resPrint; -if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'],$_SERVER["PHP_SELF"],"b.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'],$_SERVER["PHP_SELF"],"b.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder); -if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); -print "\n"; - - -print ''; +print ''; // Ref if (! empty($arrayfields['b.ref']['checked'])) { @@ -419,6 +387,36 @@ print $searchpitco; print ''; print ''; +// Fields title +print ''; +if (! empty($arrayfields['b.ref']['checked'])) print_liste_field_titre($arrayfields['b.ref']['label'],$_SERVER["PHP_SELF"],'b.ref','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titre($arrayfields['b.label']['label'],$_SERVER["PHP_SELF"],'b.label','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } +} +// Hook fields +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['b.datec']['checked'])) print_liste_field_titre($arrayfields['b.datec']['label'],$_SERVER["PHP_SELF"],"b.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['b.tms']['checked'])) print_liste_field_titre($arrayfields['b.tms']['label'],$_SERVER["PHP_SELF"],"b.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['b.clos']['checked'])) print_liste_field_titre($arrayfields['b.clos']['label'],$_SERVER["PHP_SELF"],'b.clos','',$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; $total = array(); $found = 0; $i=0; $lastcurrencycode=''; @@ -444,7 +442,7 @@ foreach ($accounts as $key=>$type) $lastcurrencycode=$acc->currency_code; } - print ''; + print ''; // Ref if (! empty($arrayfields['b.ref']['checked'])) @@ -578,7 +576,7 @@ foreach ($accounts as $key=>$type) $i++; } -if (! $found) print ''; +if (! $found) print ''; // Show total line if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') // If there is several currency, $lastcurrencycode is set to 'various' before diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php index a1952ab5957..15555e45338 100644 --- a/htdocs/compta/bank/info.php +++ b/htdocs/compta/bank/info.php @@ -30,6 +30,8 @@ $langs->load("banks"); $langs->load("categories"); $langs->load("companies"); +$id = GETPOST("rowid"); + /* * View @@ -37,27 +39,35 @@ $langs->load("companies"); llxHeader(); -$line = new AccountLine($db); -$line->fetch($_GET["rowid"]); -$line->info($_GET["rowid"]); +$object = new AccountLine($db); +$object->fetch($id); +$object->info($id); $h=0; -$head[$h][0] = DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$_GET["rowid"]; +$head[$h][0] = DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$id; $head[$h][1] = $langs->trans("Card"); $h++; -$head[$h][0] = DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$_GET["rowid"]; +$head[$h][0] = DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$id; $head[$h][1] = $langs->trans("Info"); $hselected = $h; $h++; -dol_fiche_head($head, $hselected, $langs->trans("LineRecord"),0,'account'); +dol_fiche_head($head, $hselected, $langs->trans("LineRecord"), -1, 'account'); + +$linkback = ''.$langs->trans("BackToList").''; + + +dol_banner_tab($object, 'rowid', $linkback); + +print '
'; +print '
'; print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'; -dol_print_object_info($line); +dol_print_object_info($object); print '
'; print '
'; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 558f1b0c042..b50bf07d31a 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Xavier DUTOIT - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015-2017 Alexandre Spangaro @@ -30,6 +30,7 @@ require('../../main.inc.php'); require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $langs->load("banks"); $langs->load("categories"); @@ -47,6 +48,8 @@ $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); $rowid=GETPOST("rowid",'int'); $orig_account=GETPOST("orig_account"); +$backtopage=GETPOST('backtopage'); +$cancel=GETPOSt('cancel'); // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); @@ -59,6 +62,14 @@ if (! $user->rights->banque->lire && ! $user->rights->banque->consolidate) acces /* * Actions */ +if ($cancel) +{ + if ($backtopage) + { + header("Location: ".$backtopage); + exit; + } +} if ($user->rights->banque->consolidate && $action == 'dvnext') { @@ -81,21 +92,6 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban } } -if ($user->rights->banque->modifier && $action == 'class') -{ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid." AND fk_categ = ".GETPOST('cat1', 'int'); - if (! $db->query($sql)) - { - dol_print_error($db); - } - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".GETPOST('cat1', 'int').")"; - if (! $db->query($sql)) - { - dol_print_error($db); - } -} - if ($user->rights->banque->modifier && $action == "update") { $error=0; @@ -145,7 +141,36 @@ if ($user->rights->banque->modifier && $action == "update") $sql.= " WHERE rowid = ".$rowid; $result = $db->query($sql); - if ($result) + if (! $result) + { + $error++; + } + + if (! $error) + { + $arrayofcategs=GETPOST('custcats', 'array'); + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".$rowid; + if (! $db->query($sql)) + { + $error++; + dol_print_error($db); + } + if (count($arrayofcategs)) + { + foreach($arrayofcategs as $val) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES (".$rowid.", ".$val.")"; + if (! $db->query($sql)) + { + $error++; + dol_print_error($db); + } + } + // $arrayselected will be loaded after in page output + } + } + + if (! $error) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); @@ -204,19 +229,14 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == $form = new Form($db); -llxHeader(); +llxHeader('', $langs->trans("BankTransaction")); -// Load bank groups -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; -$bankcateg = new BankCateg($db); -$options = array(); - -foreach ($bankcateg->fetchAll() as $bankcategory) { - $options[$bankcategory->id] = $bankcategory->label; +$c = new Categorie($db); +$cats = $c->containing($rowid, Categorie::TYPE_BANK_LINE); +foreach ($cats as $cat) { + $arrayselected[] = $cat->id; } -$var=false; - $tabs = array( array( DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$rowid, @@ -228,7 +248,6 @@ $tabs = array( ) ); -dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account'); $sql = "SELECT b.rowid,b.dateo as do,b.datev as dv, b.amount, b.label, b.rappro,"; $sql.= " b.num_releve, b.fk_user_author, b.num_chq, b.fk_type, b.fk_account, b.fk_bordereau as receiptid,"; @@ -269,31 +288,39 @@ if ($result) print ''; print ''; - print ''; - + dol_fiche_head($tabs, 0, $langs->trans('LineRecord'), 0, 'account'); + $linkback = ''.$langs->trans("BackToList").''; + + dol_banner_tab($bankline, 'rowid', $linkback); + + + print '
'; + print '
'; + // Ref + /* print '"; print ''; print ''; - + */ + $i++; - // Bank account - print ""; + print ''; print ''; print ''; // Show links of bank transactions if (count($links)) { - print ""; + print ''; print ''; } else @@ -437,7 +464,7 @@ if ($result) if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; } else @@ -491,7 +518,7 @@ if ($result) if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; } else @@ -525,7 +552,7 @@ if ($result) if ($user->rights->banque->modifier) { print ''; } else @@ -536,23 +563,41 @@ if ($result) } print ""; + // Categories + if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + { + $langs->load('categories'); + + // Bank line + print '"; + } + print "
'.$langs->trans("Ref")."'; print $form->showrefnav($bankline, 'rowid', $linkback, 1, 'rowid', 'rowid'); print '
".$langs->trans("Account")."
'.$langs->trans("Account").''; - print $acct->getNomUrl(1,'transactions'); + print $acct->getNomUrl(1,'transactions','reflabel'); print '
".$langs->trans("Links")."
'.$langs->trans("Links").''; foreach($links as $key=>$val) { @@ -423,7 +450,7 @@ if ($result) if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print 'rappro?' disabled':'').' value="'; + print 'rappro?' disabled':'').' value="'; if (preg_match('/^\((.*)\)$/i',$objp->label,$reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant @@ -501,7 +528,7 @@ if ($result) { print $objp->label; } - print '" size="50">'; + print '">'; print ''; - print 'rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code); + print 'rappro?' disabled':'').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code); print '
' . fieldLabel('RubriquesTransactions', 'custcats') . ''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); + print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); + print "
"; - - print '
'; - + + dol_fiche_end(); + + + print '

'; + print ""; + + // Releve rappro if ($acct->canBeConciliated() > 0) // Si compte rapprochable { - print '

'."\n"; - print load_fiche_titre($langs->trans("Reconciliation"), '', 'title_bank.png'); + print '
'."\n"; + print '
'; print ''; print ''; print ''; - + print ''; + print ''; print '"; @@ -591,7 +636,15 @@ if ($result) print ''; print '
'.$langs->trans("Conciliation")."
'; - print '
'; + print '
'; + + print ''; + if ($backtopage) + { + print '   '; + print ''; + } + print '
'; print '
'; } @@ -601,57 +654,6 @@ if ($result) $db->free($result); } else dol_print_error($db); -print '
'; - - - -// List of bank categories -print '
'; - -print '
'; -print ''; -print ''; -print ''; - -print ''; -print ''; -} -print ''; - -$sql = "SELECT c.label, c.rowid"; -$sql.= " FROM ".MAIN_DB_PREFIX."bank_class as a, ".MAIN_DB_PREFIX."bank_categ as c"; -$sql.= " WHERE a.lineid=".$rowid." AND a.fk_categ = c.rowid"; -$sql.= " ORDER BY c.label"; -$result = $db->query($sql); -if ($result) -{ - $var=True; - $num = $db->num_rows($result); - $i = 0; $total = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - - $var=!$var; - print ""; - - print ""; - print ""; - if ($user->rights->banque->modifier) - { - print ''; - } - print ''; - - $i++; - } - $db->free($result); -} -print '
'.$langs->trans("Rubriques").''; -if ($user->rights->banque->modifier) -{ - print Form::selectarray('cat1', $options, '', 1).' '; - print '
".$objp->label."rowid."\">".$langs->trans("ListBankTransactions")."'.img_delete($langs->trans("Remove")).'
'; llxFooter(); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ffadceafb2e..4e5fc5dea81 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -1,8 +1,9 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2017 Patrick Delcroix * * 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 @@ -34,6 +35,11 @@ require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +//show files +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $langs->load("banks"); $langs->load("categories"); @@ -44,7 +50,7 @@ $action=GETPOST('action', 'alpha'); $id=GETPOST('account'); $ref=GETPOST('ref'); $dvid=GETPOST('dvid'); -$num=GETPOST('num'); +$numref=GETPOST('num'); // Security check $fieldid = (! empty($ref)?$ref:$id); @@ -89,6 +95,191 @@ if ($id > 0 || ! empty($ref)) // Initialize technical object to manage context to save list fields $contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id); +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; +$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; +$sql.= " b.fk_bordereau,"; +$sql.= " bc.ref,"; +$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; +$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; +$sql.= ", ".MAIN_DB_PREFIX."bank as b"; +$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau'; +$sql.= " WHERE b.num_releve='".$db->escape($numref)."'"; +if (!isset($numref)) $sql.= " OR b.num_releve is null"; +$sql.= " AND b.fk_account = ".$object->id; +$sql.= " AND b.fk_account = ba.rowid"; +$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day + +$sqlrequestforbankline = $sql; + + + +/* + * Actions + */ + +// ZIP creation +if ($action=="dl" && $numref > 0) +{ + // TODO Replace this with a standard builddoc action that use a document generation module to build the ZIP + $log = ''; + + $outdir = $conf->bank->dir_temp.'/'.$numref.'-'.$object->label; + $outdirinvoices = $outdir.'/'.$langs->trans("BillsCustomers"); + $outdirsupplierinvoices = $outdir.'/'.$langs->trans("BillsSuppliers"); + + dol_mkdir($outdir); + dol_mkdir($outdirinvoices); + dol_mkdir($outdirsupplierinvoices); + + //$zipname = $object->label.'-'.$numref . '.zip'; + //$zip = new ZipArchive(); + //$zip->open($zipname, ZipArchive::OVERWRITE); + + $sql = $sqlrequestforbankline; + + $facturestatic=new Facture($db); + + $resd = $db->query($sql); + if ($resd) { + $numd = $db->num_rows($resd); + $i = 0; + if ($numd > 0) + { + $objd = $db->fetch_object($resd); + + $log.='Transaction '.$objd->rowid; + $links = $object->get_url($objd->rowid); + + foreach($links as $key=>$val) + { + $link = ''; $upload_dir = ''; + + switch ($val['type']) { + case "payment": + $payment = new Paiement($db); + $payment->fetch($val['url_id']); + $arraybill = $payment->getBillsArray(); + if (count($arraybill) > 0) + { + foreach ($arraybill as $billid) + { + $facturestatic->fetch($billid); + $subdir = get_exdir($facturestatic->id, 2, 0, 0, $facturestatic, 'invoice'); + + $arrayofinclusion=array(); // TODO Find a way to get doc ODT or other + // TODO Use get_exdir + $arrayofinclusion[]=preg_quote($facturestatic->ref.'.pdf','/'); + $listoffiles = dol_dir_list($conf->facture->dir_output.$subdir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); + // build list of files with full path + $files = array(); + foreach($listoffiles as $filefound) + { + if (strstr($filefound["name"],$facturestatic->ref)) + { + $files[] = $uploaddir.'/'.$facturestatic->ref.'/'.$filefound["name"]; + break; + } + } + /*var_dump($files);*/ + //var_dump($listoffiles); + foreach($listoffiles as $key => $srcfileobj) + { + $srcfile = $srcfileobj['fullname']; + $destfile = $outdirinvoices.'/'.$srcfileobj['name']; + //var_dump($srcfile.' - '.$destfile); + dol_copy($srcfile, $destfile); + } + } + } + break; + case "payment_supplier": + $payment = new PaiementFourn($db); + $payment->fetch($val['url_id']); + $arraybill = $payment->getBillsArray(); + if (count($arraybill) > 0) + { + foreach ($arraybill as $billid) + { + $facturestatic->fetch($billid); + $subdir = get_exdir($facturestatic->id, 2, 0, 0, $facturestatic, 'invoice_supplier'); + + $arrayofinclusion=array(); // TODO Find a way to get doc ODT or other + // TODO Use get_exdir + $arrayofinclusion[]=preg_quote($facturestatic->ref.'.pdf','/'); + $listoffiles = dol_dir_list($conf->fournisseur->facture->dir_output.$subdir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); + // build list of files with full path + $files = array(); + foreach($listoffiles as $filefound) + { + if (strstr($filefound["name"],$facturestatic->ref)) + { + $files[] = $uploaddir.'/'.$facturestatic->ref.'/'.$filefound["name"]; + break; + } + } + /*var_dump($files);*/ + //var_dump($listoffiles); + foreach($listoffiles as $key => $srcfileobj) + { + $srcfile = $srcfileobj['fullname']; + $destfile = $outdirinvoices.'/'.$srcfileobj['name']; + //var_dump($srcfile.' - '.$destfile); + dol_copy($srcfile, $destfile); + } + } + } + break; + case "payment_expensereport": + /*$subdir = dol_sanitizeFileName($objd->refe); + $upload_dir = $conf->expensereport->dir_output . '/' . $subdir;*/ + break; + case "payment_salary": + /*$subdir = dol_sanitizeFileName($objd->ids); + $upload_dir = $conf->salaries->dir_output . '/' . $subdir;*/ + break; + case "payment_donation": + /*$subdir = get_exdir(null, 2, 0, 1, $objd, 'donation') . '/' . dol_sanitizeFileName($objd->idd); + $upload_dir = $conf->don->dir_output . '/' . $subdir;*/ + break; + default: + break; + } + } + $log.="\n"; + + /*if (! empty($upload_dir)) + { + $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1); + + if (is_array($files)) { + foreach ($files as $file) { + $zip->addFile($file["fullname"], $file["name"]); // + $log .= $key . ',' . $file["name"] . "\n"; + } + } else { + $log .= $key . ',' . $langs->trans("Nofile") . "\n"; + } + + }*/ + } + } + + $db->free($resd); + + + //$zip->addFromString('log '.$numref.'.csv', $log); + //$zip->close(); + + // /Then download the zipped file. + /*header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename=' . $zipname); + header('Content-Length: ' . filesize($zipname)); + + readfile($zipname); + + exit;*/ +} + /* * View @@ -116,11 +307,9 @@ if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($id > 0) $param.='&id='.urlencode($id); -if (empty($num)) +if (empty($numref)) { - /* - * Vue liste tous releves confondus - */ + // List of all standing receipts $sql = "SELECT DISTINCT(b.num_releve) as numr"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; $sql.= " WHERE b.fk_account = ".$object->id; @@ -176,14 +365,14 @@ if (empty($num)) while ($i < min($numrows,$conf->liste_limit)) { $objp = $db->fetch_object($result); - $var=!$var; + if (! isset($objp->numr)) { // } else { - print ''.$objp->numr.''; + print ''.$objp->numr.''; // Calculate start amount $sql = "SELECT sum(b.amount) as amount"; @@ -240,7 +429,7 @@ else // Recherche valeur pour num = numero releve precedent $sql = "SELECT DISTINCT(b.num_releve) as num"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql.= " WHERE b.num_releve < '".$db->escape($num)."'"; + $sql.= " WHERE b.num_releve < '".$db->escape($numref)."'"; $sql.= " AND b.fk_account = ".$object->id; $sql.= " ORDER BY b.num_releve DESC"; @@ -252,7 +441,7 @@ else if ($numrows > 0) { $obj = $db->fetch_object($resql); - $num = $obj->num; + $numref = $obj->num; $found=true; } } @@ -262,7 +451,7 @@ else // Recherche valeur pour num = numero releve precedent $sql = "SELECT DISTINCT(b.num_releve) as num"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql.= " WHERE b.num_releve > '".$db->escape($num)."'"; + $sql.= " WHERE b.num_releve > '".$db->escape($numref)."'"; $sql.= " AND b.fk_account = ".$object->id; $sql.= " ORDER BY b.num_releve ASC"; @@ -274,7 +463,7 @@ else if ($numrows > 0) { $obj = $db->fetch_object($resql); - $num = $obj->num; + $numref = $obj->num; $found=true; } } @@ -286,13 +475,16 @@ else $mesprevnext=''; $mesprevnext.=''; - print load_fiche_titre($langs->trans("AccountStatement").' '.$num.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0, 'receipts'), $mesprevnext, 'title_bank.png'); + + $title=$langs->trans("AccountStatement").' '.$numref.', '.$langs->trans("BankAccount").' : '.$object->getNomUrl(0, 'receipts'); + print load_fiche_titre($title, $mesprevnext, 'title_bank.png'); + //print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, 0, $nbtotalofrecords, 'title_bank.png', 0, '', '', 0, 1); print '
'; print "
"; @@ -315,7 +507,7 @@ else // Calcul du solde de depart du releve $sql = "SELECT sum(b.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."bank as b"; - $sql.= " WHERE b.num_releve < '".$db->escape($num)."'"; + $sql.= " WHERE b.num_releve < '".$db->escape($numref)."'"; $sql.= " AND b.fk_account = ".$object->id; $resql=$db->query($sql); @@ -327,20 +519,8 @@ else } // Recherche les ecritures pour le releve - $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; - $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; - $sql.= " b.fk_bordereau,"; - $sql.= " bc.ref,"; - $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; - $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; - $sql.= ", ".MAIN_DB_PREFIX."bank as b"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau'; - $sql.= " WHERE b.num_releve='".$db->escape($num)."'"; - if (!isset($num)) $sql.= " OR b.num_releve is null"; - $sql.= " AND b.fk_account = ".$object->id; - $sql.= " AND b.fk_account = ba.rowid"; - $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day - + $sql = $sqlrequestforbankline; + $result = $db->query($sql); if ($result) { @@ -349,9 +529,9 @@ else $i = 0; // Ligne Solde debut releve - print ""; - print "".$langs->trans("InitialBankBalance")." :"; - print ''.price($total).' '; + print ''; + print ''.$langs->trans("InitialBankBalance")." :"; + print ''.price($total).' '; print "\n"; while ($i < $numrows) @@ -359,8 +539,7 @@ else $objp = $db->fetch_object($result); $total = $total + $objp->amount; - $var=!$var; - print ""; + print ''; // Date operation print ''.dol_print_date($db->jdate($objp->do),"day").''; @@ -368,9 +547,9 @@ else // Date de valeur print ''; print dol_print_date($db->jdate($objp->dv),"day") .' '; - print ''; + print ''; print img_edit_remove() . " "; - print ''; + print ''; print img_edit_add() .""; print "\n"; print ''; @@ -434,6 +613,14 @@ else $paymentvatstatic->ref=$langs->trans("Payment"); print ' '.$paymentvatstatic->getNomUrl(1); } + elseif ($links[$key]['type']=='payment_salary') + { + print ''; + print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; + print $langs->trans("Payment"); + print ''; + $newline=0; + } elseif ($links[$key]['type']=='banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. if ($objp->amount > 0) @@ -476,6 +663,13 @@ else print ''; $newline=0; } + elseif ($links[$key]['type']=='user') { + print ''; + print img_object($langs->trans('ShowUser'),'user').' '; + print $links[$key]['label']; + print ''; + $newline=0; + } elseif ($links[$key]['type']=='sc') { print ''; print img_object($langs->trans('ShowBill'),'bill').' '; @@ -519,7 +713,6 @@ else dol_print_error($db); } } - print ""; if ($objp->amount < 0) @@ -537,7 +730,7 @@ else if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print "rowid&account=".$object->id."\">"; + print ''; print img_edit(); print ""; } @@ -556,12 +749,19 @@ else // Line Balance print "\n ".$langs->trans("EndBankBalance")." :"; - print "".price($total)." "; + print ''.price($total)." "; print "\n"; print ""; print "
"; print "\n"; + + // Add a download button + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // Started a rewrite to make this feature more Dolibarr compliant. Still need dev to be completed. + { + // TODO Replace this with standard box to generate document. + print ''.$langs->trans('DownloadPackageWithAllDocuments')." \n"; + } } diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 9e26d532348..73e94a3d197 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -168,7 +168,7 @@ print ''.$langs->trans("TransferFrom").''.$langs->trans("TransferTo print ''; $var=false; -print ''; +print ''; $form->select_comptes($account_from,'account_from',0,'',1); print ""; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index e889b4dff19..1dbe17d6a13 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -91,7 +91,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Onglets $head=bank_prepare_head($object); - dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account'); + dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), -1, 'account'); $linkback = ''.$langs->trans("BackToList").''; @@ -120,13 +120,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $var=true; // Current balance - $var=!$var; + print ''; print ''.$langs->trans("CurrentBalance").''; print ''.price($solde).''; print ''; - $var=!$var; + print ''; print ''.$langs->trans("RemainderToPay").''; print ' '; @@ -293,10 +293,10 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // We discard lines with a remainder to pay to 0 if (price2num($total_ttc) != 0) { - $var=!$var; + // Show line - print ""; + print ''; print ''; if ($obj->dlr) print dol_print_date($db->jdate($obj->dlr),"day"); else print $langs->trans("NotDefined"); @@ -318,7 +318,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) } // Solde actuel - $var=!$var; + print ''; print ''.$langs->trans("FutureBalance").' ('.$object->currency_code.')'; print ''.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).''; diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 3fa15deb9c2..5311aca0618 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -85,7 +85,7 @@ if ($object->id) // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 7366c0cf2a5..6c4b41333f1 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -193,8 +193,8 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; $variousstatic->id=$obj->rowid; $variousstatic->ref=$obj->rowid; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 6215f2343e8..ee71290be2d 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -171,7 +171,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { $obj = $db->fetch_object($resql); $var = !$var; - print ""; + print ''; // Date $date=$obj->periode; if (empty($date)) $date=$obj->date_ech; @@ -293,8 +293,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $total = $total + $obj->amount; - $var=!$var; - print ""; + + print ''; print ''.dol_print_date($db->jdate($obj->dm),'day').''."\n"; print "".$obj->label."\n"; @@ -423,8 +423,8 @@ while($j<$numlt) $total = $total + $obj->amount; - $var=!$var; - print ""; + + print ''; print ''.dol_print_date($db->jdate($obj->dm),'day').''."\n"; print "".$obj->label."\n"; @@ -507,8 +507,8 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $total = $total + $obj->amount; - $var=!$var; - print ""; + + print ''; print ''.dol_print_date($db->jdate($obj->dateep),'day').''."\n"; diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 6a3052a938d..28eaa0a7c9b 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -178,9 +178,9 @@ if ($resql) { $obj = $db->fetch_object($resql); - $var=!$var; + - print ""; + print ''; print ''; $thirdpartystatic->id=$obj->rowid; $thirdpartystatic->name=$obj->name; diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 4154778306e..6fa539ba297 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -94,7 +94,7 @@ if ($object->id) // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 63556eeaee6..bb6d58293b6 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -173,21 +173,21 @@ if ($result) $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; - print ''; + print ''; print ''.$deplacementstatic->getNomUrl(1).''; print ''.$userstatic->getNomUrl(1).''; print ''.$obj->km.''; print ''.dol_print_date($db->jdate($obj->dm),'day').''; print ''.$deplacementstatic->LibStatut($obj->fk_statut,3).''; print ''; - $var=!$var; + $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 66fab1b9279..95f4082e082 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -178,8 +178,8 @@ if ($resql) $soc = new Societe($db); if ($obj->socid) $soc->fetch($obj->socid); - $var=!$var; - print ''; + + print ''; // Id print ''.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.''; // Type diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 216988b6a7a..36bc107d672 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -223,7 +223,7 @@ $h++; complete_head_from_modules($conf,$langs,null,$head,$h,'trip_stats'); -dol_fiche_head($head,'byyear',$langs->trans("Statistics")); +dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); print '
'; diff --git a/htdocs/compta/facture/admin/facture_cust_extrafields.php b/htdocs/compta/facture/admin/facture_cust_extrafields.php index ae545c695c3..c7a43c737de 100644 --- a/htdocs/compta/facture/admin/facture_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facture_cust_extrafields.php @@ -70,7 +70,7 @@ print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); $head = invoice_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), 0, 'invoice'); +dol_fiche_head($head, 'attributes', $langs->trans("Invoices"), -1, 'invoice'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php index d7fd3367b67..3a5f8c3387f 100644 --- a/htdocs/compta/facture/admin/facturedet_cust_extrafields.php +++ b/htdocs/compta/facture/admin/facturedet_cust_extrafields.php @@ -71,7 +71,7 @@ print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup'); $head = invoice_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), 0, 'invoice'); +dol_fiche_head($head, 'attributeslines', $langs->trans("Invoices"), -1, 'invoice'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 663c0374b9a..70eea532a79 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2191,7 +2191,7 @@ if ($action == 'create') else { print ''; - print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty'); + print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { @@ -2645,7 +2645,7 @@ if ($action == 'create') // Public note print ''; - print ''; + print ''; print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); print ''; print ''; @@ -2656,7 +2656,7 @@ if ($action == 'create') if (empty($user->societe_id)) { print ''; - print ''; + print ''; print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); print ''; print ''; @@ -3360,33 +3360,29 @@ else if ($id > 0 || ! empty($ref)) } print ''; - // Multicurrency rate - //if ($object->multicurrency_code != $conf->currency) - //{ - print ''; - print ''; - print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) - print ''; - print '
'; - print fieldLabel('CurrencyRate','multicurrency_tx'); - print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; - print ''; - if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { - if($action == 'actualizemulticurrencyrate') { - list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); - } - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); - } else { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); - if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { - print '
        '; - print ''.$langs->trans("ActualizeCurrency").''; - print '
'; - } - } - print ''; - //} + print ''; + print ''; + print ''; + if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) + print ''; + print '
'; + print fieldLabel('CurrencyRate','multicurrency_tx'); + print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; + print ''; + if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { + if($action == 'actualizemulticurrencyrate') { + list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code); + } + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + } else { + $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code); + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { + print '
        '; + print ''.$langs->trans("ActualizeCurrency").''; + print '
'; + } + } + print ''; } // Bank Account @@ -3499,38 +3495,38 @@ else if ($id > 0 || ! empty($ref)) { // Multicurrency Amount HT print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ''; - print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; + print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; // Multicurrency Amount VAT print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ''; - print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; + print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; // Multicurrency Amount TTC print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ''; - print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; + print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ''; print ''; } // Amount - print '' . $langs->trans('AmountHT') . ''; - print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; + print '' . $langs->trans('AmountHT') . ''; + print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ''; // Vat - print '' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ''; + print '' . $langs->trans('AmountVAT') . '' . price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency) . ''; print ''; // Amount Local Taxes if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) // Localtax1 { print '' . $langs->transcountry("AmountLT1", $mysoc->country_code) . ''; - print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ''; + print '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . ''; } if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) // Localtax2 { print '' . $langs->transcountry("AmountLT2", $mysoc->country_code) . ''; - print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ''; + print '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . ''; } // Revenue stamp @@ -3561,7 +3557,7 @@ else if ($id > 0 || ! empty($ref)) } // Total with tax - print '' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ''; + print '' . $langs->trans('AmountTTC') . '' . price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency) . ''; print ''; @@ -3696,8 +3692,6 @@ else if ($id > 0 || ! empty($ref)) print ' '; print ''; - $var = true; - // Payments already done (from payment on this invoice) $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement, p.rowid, p.fk_bank,'; $sql .= ' c.code as payment_code, c.libelle as payment_label,'; @@ -3719,8 +3713,7 @@ else if ($id > 0 || ! empty($ref)) if ($num > 0) { while ($i < $num) { $objp = $db->fetch_object($result); - $var = ! $var; - print ''; + print ''; $paymentstatic->id = $objp->rowid; $paymentstatic->datepaye = $db->jdate($objp->dp); $paymentstatic->ref = $objp->ref; @@ -3745,9 +3738,10 @@ else if ($id > 0 || ! empty($ref)) print ''; $i ++; } - } else { - print '' . $langs->trans("None") . ''; - } + } + /*else { + print '' . $langs->trans("None") . ''; + }*/ // } $db->free($result); } else { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 963534da934..4b9ced1c4c0 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -359,7 +359,6 @@ class Facture extends CommonInvoice '__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'), ); - $substitutionisok=true; complete_substitutions_array($substitutionarray, $outputlangs); $this->note_public=make_substitutions($this->note_public,$substitutionarray); @@ -2872,7 +2871,7 @@ class Facture extends CommonInvoice // Cap percentages to 100 if ($percent > 100) $percent = 100; $line->situation_percent = $percent; - $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->product_type, 'HT', 0, 0, $mysoc, '', $percent); + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $percent); $line->total_ht = $tabprice[0]; $line->total_tva = $tabprice[1]; $line->total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 45c6102ce1c..2d2ff5cc073 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -102,7 +102,7 @@ if ($id > 0 || ! empty($ref)) $totalpaye = $object->getSommePaiement(); // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 9d4329a671b..706807c8f02 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -38,6 +38,7 @@ if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; $langs->load('bills'); $langs->load('compta'); @@ -109,6 +110,7 @@ $arrayfields=array( 'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), 'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1), + 'f.nb_gen_done'=>array('label'=>$langs->trans("NbGeneration"), 'checked'=>1), 'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1), 'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), @@ -936,7 +938,8 @@ if ($action == 'create') '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')', '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')' ); - + $substitutionarray['__(TRANSKEY)__']=$langs->trans("TransKey"); + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($substitutionarray as $key => $val) { @@ -947,7 +950,7 @@ if ($action == 'create') // Public note print ''; print ''; - print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'); print ''; print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -958,7 +961,7 @@ if ($action == 'create') { print ''; print ''; - print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'); print ''; print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -994,7 +997,7 @@ if ($action == 'create') // Bank account if ($object->fk_account > 0) { - print "".$langs->trans('BankAccount').""; + print "".$langs->trans('RIB').""; $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); print ""; } @@ -1109,13 +1112,9 @@ else $author = new User($db); $author->fetch($object->user_author); - $head=array(); - $h=0; - $head[$h][0] = $_SERVER["PHP_SELF"].'?id='.$object->id; - $head[$h][1] = $langs->trans("CardBill"); - $head[$h][2] = 'card'; + $head=invoice_rec_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"),0,'bill'); // Add a div + dol_fiche_head($head, 'card', $langs->trans("RepeatableInvoice"), -1, 'bill'); // Add a div // Recurring invoice content @@ -1243,7 +1242,8 @@ else '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' ); - + $substitutionarray['__(TRANSKEY)__']=$langs->trans("TransKey"); + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; foreach($substitutionarray as $key => $val) { @@ -1253,7 +1253,7 @@ else // Note public print ''; - print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext), 'note_public', $object->note_public, $object, $user->rights->facture->creer); + print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $user->rights->facture->creer); print ''; print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print ''; @@ -1261,16 +1261,18 @@ else // Note private print ''; - print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext), 'note_private', $object->note_private, $object, $user->rights->facture->creer); + print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $user->rights->facture->creer); print ''; print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print ''; print ''; // Bank Account + $langs->load('banks'); + print ''; print ''; @@ -1294,16 +1296,17 @@ else print '
'; print '
'; - print '
'; - print $langs->trans('BankAccount'); + print $langs->trans('RIB'); print ''; if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; /* * Recurrence */ $title = $langs->trans("Recurrence"); - print load_fiche_titre($title, '', 'calendar'); + //print load_fiche_titre($title, '', 'calendar'); print '
'; + print ''; + // if "frequency" is empty or = 0, the reccurence is disabled print ''; + + print ''; $donationstatic->id=$objp->rowid; $donationstatic->lastname=$objp->lastname; $donationstatic->firstname=$objp->firstname; @@ -547,7 +545,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) } else { - print ''; + print ''; } print '
'.$title.'
'; print ''; + print ''; print ''; + print ''; } print '
'; @@ -1538,10 +1541,16 @@ else * List mode */ $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,"; - $sql.= " f.date_last_gen, f.date_when"; + $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; + if (! $user->rights->societe->client->voir && ! $socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; + if (! $user->rights->societe->client->voir && ! $socid) { + $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + } if ($search_ref) $sql .= natural_search('f.titre', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency); @@ -1637,61 +1646,54 @@ else print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre(''); // Field may contains ling text - print "\n"; - - // Filters lines - print ''; + print ''; // Ref if (! empty($arrayfields['f.titre']['checked'])) { print ''; } // Thirpdarty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['f.total']['checked'])) { // Amount print ''; } if (! empty($arrayfields['f.tva']['checked'])) { // Amount print ''; } if (! empty($arrayfields['f.total_ttc']['checked'])) { // Amount print ''; } if (! empty($arrayfields['f.frequency']['checked'])) { - // Amount + // Recurring or not print ''; } + if (! empty($arrayfields['f.nb_gen_done']['checked'])) + { + // Nb generation + print ''; + } // Date invoice if (! empty($arrayfields['f.date_last_gen']['checked'])) { @@ -1756,28 +1758,47 @@ else print ''; print "\n"; - + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER['PHP_SELF'],"f.total","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.nb_gen_done']['checked'])) + { + print_liste_field_titre($langs->trans("NbOfGenerationDone"),$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder); + } + print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre(''); // Field may contains ling text + print "\n"; + + if ($num > 0) { $var=true; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + print ''; print '\n"; $companystatic->id=$objp->socid; $companystatic->name=$objp->name; - print ''; + print ''; print ''."\n"; print ''."\n"; print ''."\n"; print ''; + if (! empty($arrayfields['f.nb_gen_done']['checked'])) + { + print ''; + } print ''; print ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8ed52eddb97..562455e9e5a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -7,10 +7,11 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2015-2016 Ferran Marcet + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015-2016 Ferran Marcet + * Copyright (C) 2017 Josep Lluís Amador * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,6 +75,8 @@ $search_type=GETPOST('search_type','int'); $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_vat=GETPOST('search_montant_vat','alpha'); +$search_montant_localtax1=GETPOST('search_montant_localtax1','alpha'); +$search_montant_localtax2=GETPOST('search_montant_localtax2','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); $search_status=GETPOST('search_status','int'); $search_paymentmode=GETPOST('search_paymentmode','int'); @@ -155,6 +158,8 @@ $arrayfields=array( 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), + 'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj=="1"), + 'f.total_localtax2'=>array('label'=>$langs->transcountry("AmountLT2", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax2_assuj=="1"), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), @@ -198,6 +203,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS $search_societe=''; $search_montant_ht=''; $search_montant_vat=''; + $search_montant_localtax1=''; + $search_montant_localtax2=''; $search_montant_ttc=''; $search_status=''; $search_paymentmode=''; @@ -344,6 +351,7 @@ llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factur $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; +$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.datec as date_creation, f.tms as date_update,'; @@ -415,6 +423,8 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdp if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); +if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1); +if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_status != '' && $search_status >= 0) { @@ -478,6 +488,7 @@ $sql.=$hookmanager->resPrint; if (! $sall) { $sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,'; + $sql.= ' f.localtax1, f.localtax2,'; $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.datec, f.tms,'; @@ -506,7 +517,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } -$sql.= $db->plimit($limit+1,$offset); +$sql.= $db->plimit($limit,$offset); //print $sql; $resql = $db->query($sql); @@ -541,6 +552,8 @@ if ($resql) if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category); if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); + if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); + if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); if ($search_status != '') $param.='&search_status='.urlencode($search_status); if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); @@ -738,64 +751,25 @@ if ($resql) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + print '
'; print '
'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print $form->selectyesno('search_frequency', $search_frequency, 1, false, 1); print ''; + print '
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre; print "'.$companystatic->getNomUrl(1,'customer').''.$companystatic->getNomUrl(1,'customer').''.price($objp->total).''.price($objp->total_vat).''.price($objp->total_ttc).''.yn($objp->frequency?1:0).''.($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '').''.($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : '').''.($objp->frequency ? dol_print_date($objp->date_when,'day') : '').'
'."\n"; - print ''; - if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'],$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); - // Extra fields - if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) - { - foreach($extrafields->attribute_label as $key => $val) - { - if (! empty($arrayfields["ef.".$key]['checked'])) - { - $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); - } - } - } - // Hook fields - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - // Filters lines - print ''; + print ''; // Ref if (! empty($arrayfields['f.facnumber']['checked'])) { print ''; } // Ref customer if (! empty($arrayfields['f.ref_client']['checked'])) { print ''; } // Type @@ -816,8 +790,8 @@ if ($resql) if (! empty($arrayfields['f.date']['checked'])) { print ''; } @@ -825,8 +799,8 @@ if ($resql) if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { print ''; @@ -837,9 +811,9 @@ if ($resql) print ''; } // Town - if (! empty($arrayfields['s.town']['checked'])) print ''; + if (! empty($arrayfields['s.town']['checked'])) print ''; // Zip - if (! empty($arrayfields['s.zip']['checked'])) print ''; + if (! empty($arrayfields['s.zip']['checked'])) print ''; // State if (! empty($arrayfields['state.nom']['checked'])) { @@ -872,21 +846,35 @@ if ($resql) { // Amount print ''; } if (! empty($arrayfields['f.total_vat']['checked'])) { // Amount print ''; + } + if (! empty($arrayfields['f.total_localtax1']['checked'])) + { + // Amount + print ''; + } + if (! empty($arrayfields['f.total_localtax2']['checked'])) + { + // Amount + print ''; } if (! empty($arrayfields['f.total_ttc']['checked'])) { // Amount print ''; } if (! empty($arrayfields['dynamount_payed']['checked'])) @@ -948,20 +936,60 @@ if ($resql) } // Action column print ''; print "\n"; + print ''; + if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'],$_SERVER["PHP_SELF"],"f.fk_mode_reglement","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'],$_SERVER['PHP_SELF'],'f.localtax1','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'],$_SERVER['PHP_SELF'],'f.localtax2','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + // Extra fields + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) + { + $align=$extrafields->getAlignFlag($key); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + } + } + } + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + if ($num > 0) { $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $var=!$var; $datelimit=$db->jdate($obj->datelimite); $facturestatic->id=$obj->facid; @@ -978,7 +1006,7 @@ if ($resql) $totalpay = $paiement + $totalcreditnotes + $totaldeposits; $remaintopay = $obj->total_ttc - $totalpay; - print ''; + print ''; if (! empty($arrayfields['f.facnumber']['checked'])) { print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totallocaltax1field']=$totalarray['nbfield']; + $totalarray['totallocaltax1'] += $obj->total_localtax1; + } + // Amount LocalTax2 + if (! empty($arrayfields['f.total_localtax2']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totallocaltax2field']=$totalarray['nbfield']; + $totalarray['totallocaltax2'] += $obj->total_localtax2; + } // Amount TTC if (! empty($arrayfields['f.total_ttc']['checked'])) { @@ -1212,6 +1256,8 @@ if ($resql) // Show total line if (isset($totalarray['totalhtfield']) || isset($totalarray['totalvatfield']) + || isset($totalarray['totallocaltax1field']) + || isset($totalarray['totallocaltax2field']) || isset($totalarray['totalttcfield']) || isset($totalarray['totalamfield']) || isset($totalarray['totalrtpfield']) @@ -1229,9 +1275,11 @@ if ($resql) } elseif ($totalarray['totalhtfield'] == $i) print ''; elseif ($totalarray['totalvatfield'] == $i) print ''; + elseif ($totalarray['totallocaltax1field'] == $i) print ''; + elseif ($totalarray['totallocaltax2field'] == $i) print ''; elseif ($totalarray['totalttcfield'] == $i) print ''; elseif ($totalarray['totalamfield'] == $i) print ''; - elseif ($totalarray['totalrtpfield'] == $i) print ''; + elseif ($totalarray['totalrtpfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index ea886fbd65c..f3d83278885 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -612,9 +612,9 @@ if ($object->id > 0) while ($i < $num) { $obj = $db->fetch_object($result_sql); - $var=!$var; + - print ""; + print ''; print '\n"; print ''; print ''; @@ -663,9 +663,9 @@ if ($object->id > 0) while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; + - print ""; + print ''; print '\n"; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 5c5aa8489be..77191136338 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -225,7 +225,7 @@ if ($mode == 'supplier') $type='supplier_invoice_stats'; complete_head_from_modules($conf,$langs,null,$head,$h,$type); -dol_fiche_head($head,'byyear',$langs->trans("Statistics")); +dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); $tmp_companies = $form->select_thirdparty_list($socid,'socid',$filter,1, 0, 0, array(), '', 1); //Array passed as an argument to Form::selectarray to build a proper select input @@ -300,7 +300,7 @@ foreach ($data as $val) while ($year && $oldyear > $year+1) { // If we have empty year $oldyear--; - $var=!$var; + print ''; print ''; print ''; @@ -311,7 +311,7 @@ foreach ($data as $val) print ''; print ''; } - $var=!$var; + print ''; print ''; print ''; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 2fb2a7089ea..63c16afae15 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -36,7 +36,7 @@ $var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $var=!$var; + $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index 781f5609915..2e7858fdb08 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -36,7 +36,7 @@ $var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $var=!$var; + $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ea8d47b264e..321c2456ddd 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -172,7 +172,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - print ''; $tot_ttc+=$obj->total_ttc; $i++; - $var=!$var; + } print ''; @@ -202,7 +202,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) } else { - print ''; + print ''; } print "
'; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($year?$year:-1,'year',1, 20, 5); print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($year_lim?$year_lim:-1,'year_lim',1, 20, 5); print '
'.$langs->trans("Late"); print '
'; - print ''; + print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'; @@ -1045,7 +1073,7 @@ if ($resql) // Third party if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; $thirdparty=new Societe($db); $thirdparty->id=$obj->socid; $thirdparty->name=$obj->name; @@ -1121,6 +1149,22 @@ if ($resql) if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; } + // Amount LocalTax1 + if (! empty($arrayfields['f.total_localtax1']['checked'])) + { + print ''.price($obj->total_localtax1)."'.price($obj->total_localtax2)."'.price($totalarray['totalht']).''.price($totalarray['totalvat']).''.price($totalarray['totallocaltax1']).''.price($totalarray['totallocaltax2']).''.price($totalarray['totalttc']).''.price($totalarray['totalam']).''.price($totalarray['totalrtp']).''.price($totalarray['totalrtp']).'
'.dol_print_date($db->jdate($obj->date_demande),'day')."'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.price($obj->amount).'
'.dol_print_date($db->jdate($obj->date_demande),'day')."
0?'&userid='.$userid:'').'">'.$oldyear.'0
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].'
'; + print '
'; $facturestatic->ref=$obj->facnumber; $facturestatic->id=$obj->rowid; $facturestatic->total_ht=$obj->total_ht; @@ -193,7 +193,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'.$langs->trans("Total").'
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

"; $db->free($resql); @@ -233,7 +233,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- if ( $resql ) { - $var = false; $num = $db->num_rows($resql); print ''; @@ -248,7 +247,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- while ($i < $num) { $obj = $db->fetch_object($resql); - print ''; $tot_ttc+=$obj->total_ttc; $i++; - $var=!$var; } print ''; @@ -278,7 +276,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- } else { - print ''; + print ''; } print "
'; + print '
'; $facturesupplierstatic->ref=$obj->ref; $facturesupplierstatic->id=$obj->rowid; $facturesupplierstatic->total_ht=$obj->total_ht; @@ -269,7 +268,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print '
'.$langs->trans("Total").'
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

"; $db->free($resql); @@ -337,7 +335,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $obj = $db->fetch_object($resql); - print '
'; print ''; @@ -382,7 +380,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $total_ttc += $obj->total_ttc; $total += $obj->total; $totalam += $obj->am; - $var=!$var; + $i++; } } @@ -390,7 +388,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $colspan=5; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print ''; + print ''; } print '
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

'; $db->free($resql); @@ -445,7 +443,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- while ($i < $num) { $obj = $db->fetch_object($resql); - print '
'; + print '
'; $facstatic->ref=$obj->ref; $facstatic->id = $obj->rowid; $facstatic->total_ht = $obj->total_ht; @@ -477,7 +475,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $colspan=5; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print '
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

'; } @@ -527,8 +525,8 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) while ($i < $num && $i < $max) { $objp = $db->fetch_object($result); - $var=!$var; - print '
'.$langs->trans("None").'
'.$langs->trans("None").'

'; } @@ -594,7 +592,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - print ""; + print ''; $chargestatic->id=$obj->rowid; $chargestatic->ref=$obj->libelle; $chargestatic->lib=$obj->libelle; @@ -618,7 +616,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; $db->free($resql); @@ -679,7 +677,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us { $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; $commandestatic->id=$obj->rowid; @@ -719,7 +717,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us //print "x".$tot_ttc."z".$obj->tot_fttc; $tot_tobill += ($obj->total_ttc-$obj->tot_fttc); $i++; - $var=!$var; + } print ''.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).') '; @@ -768,6 +766,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $num = $db->num_rows($resql); $i = 0; + print '
'; print ''; print ''; print ''; @@ -784,7 +783,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $obj = $db->fetch_object($resql); - print ''; + print ''; print '
'.$langs->trans("BillsCustomersUnpaid",$num).' '.$num.''.$langs->trans("DateDue").'
'; print ''; @@ -830,7 +829,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $total_ttc += $obj->total_ttc; $total += $obj->total_ht; $totalam += $obj->am; - $var=!$var; + $i++; } @@ -846,9 +845,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $colspan=6; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print ''; + print ''; } - print '
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

'; + print '

'; $db->free($resql); } else @@ -890,6 +889,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $var=false; $num = $db->num_rows($resql); + print '
'; print ''; print ''; print ''; @@ -907,7 +907,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $obj = $db->fetch_object($resql); - print ''; + print ''; } - print '
'.$langs->trans("BillsSuppliersUnpaid",$num).' '.$num.''.$langs->trans("DateDue").'
'; + print '
'; $facstatic->ref=$obj->ref; $facstatic->id = $obj->rowid; $facstatic->total_ht = $obj->total_ht; @@ -946,9 +946,9 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- { $colspan=6; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; - print '
'.$langs->trans("NoInvoice").'
'.$langs->trans("NoInvoice").'

'; + print '

'; } else { @@ -970,7 +970,7 @@ if ($resql) while ($i < $db->num_rows($resql)) { $obj = $db->fetch_object($resql); - $var=!$var; + print "".dol_print_date($db->jdate($obj->da),"day").""; print ''.$obj->libelle.' '.$obj->label.''; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 5c21b67a891..40a5805f2b3 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -183,7 +183,7 @@ if($calc ==0 || $calc == 2) { if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) !=0) { - $var=!$var; + $intra = str_replace($find,$replace,$coll->tva_intra); if(empty($intra)) { @@ -196,7 +196,7 @@ if($calc ==0 || $calc == 2) $intra = ''; } } - print ""; + print ''; print ''.$i.""; $company_static->id=$coll->socid; $company_static->name=$coll->name; @@ -258,7 +258,7 @@ if($calc ==0 || $calc == 1){ { if(($min == 0 or ($min > 0 && $coll->amount > $min)) && ($local==1?$coll->localtax1:$coll->localtax2) != 0) { - $var=!$var; + $intra = str_replace($find,$replace,$coll->tva_intra); if(empty($intra)) { @@ -271,7 +271,7 @@ if($calc ==0 || $calc == 1){ $intra = ''; } } - print ""; + print ''; print ''.$i.""; $company_static->id=$coll->socid; $company_static->name=$coll->name; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 642c37b9d65..5d17688fc68 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -81,8 +81,8 @@ function pt ($db, $sql, $date) $var=True; while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; print ''.$obj->dm."\n"; $total = $total + $obj->mm; @@ -190,8 +190,8 @@ for ($m = 1 ; $m < 13 ; $m++ ) { break; } - $var=!$var; - print ''; + + print ''; print ''.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").''; if($CalcLT==0) { $x_coll = 0; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 175ff6cf98f..13c753db464 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -338,8 +338,8 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - $var=!$var; - print ''; + + print ''; // Ref print ''.$fields['link'].''; @@ -501,8 +501,8 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - $var=!$var; - print ''; + + print ''; // Ref print ''.$fields['link'].''; diff --git a/htdocs/compta/localtax/reglement.php b/htdocs/compta/localtax/reglement.php index df96d0b7d67..54183ef72b9 100644 --- a/htdocs/compta/localtax/reglement.php +++ b/htdocs/compta/localtax/reglement.php @@ -66,8 +66,8 @@ if ($result) while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; $localtax_static->id=$obj->rowid; $localtax_static->ref=$obj->rowid; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 6a3e0e1a433..96f77e85758 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -599,7 +599,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie while ($i < $num) { $objp = $db->fetch_object($resql); - $var=!$var; + $soc = new Societe($db); $soc->fetch($objp->socid); @@ -622,7 +622,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $multicurrency_remaintopay=price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,'MT'); } - print ''; + print ''; print ''; print $invoice->getNomUrl(1,''); @@ -859,8 +859,8 @@ if (! GETPOST('action')) while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; print ''.$objp->facnumber."\n"; print ''.dol_print_date($db->jdate($objp->dp))."\n"; print ''.$objp->paiement_type.' '.$objp->num_paiement."\n"; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index a244a1feb60..1f00da90a8c 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -111,8 +111,8 @@ if ($resql) while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; print ''.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.''; print ''.dol_print_date($db->jdate($objp->dp),'day')."\n"; print "$objp->paiement_type $objp->num_paiement\n"; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 31b4ea8e993..523d5256816 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -38,10 +38,12 @@ $langs->load('bills'); $langs->load('banks'); $langs->load('companies'); -// Security check $id=GETPOST('id','int'); +$ref=GETPOST('ref', 'alpha'); $action=GETPOST('action','alpha'); $confirm=GETPOST('confirm','alpha'); + +// Security check if ($user->societe_id) $socid=$user->societe_id; // TODO ajouter regle pour restreindre acces paiement //$result = restrictedArea($user, 'facture', $id,''); @@ -163,11 +165,11 @@ if ($action == 'setdatep' && ! empty($_POST['datepday'])) * View */ -llxHeader(); +llxHeader('', $langs->trans("Payment")); $thirdpartystatic=new Societe($db); -$result=$object->fetch($id); +$result=$object->fetch($id, $ref); if ($result <= 0) { dol_print_error($db,'Payement '.$id.' not found in database'); @@ -178,7 +180,7 @@ $form = new Form($db); $head = payment_prepare_head($object); -dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), 0, 'payment'); +dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment'); /* * Confirmation de la suppression du paiement @@ -199,19 +201,18 @@ if ($action == 'valide') } - $linkback = '' . $langs->trans("BackToList") . ''; +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', ''); + + +print '
'; +print '
'; print ''."\n"; -// Ref -print ''; - // Date payment -print ''; @@ -236,7 +237,7 @@ $disable_delete = 0; // Bank account if (! empty($conf->banque->enabled)) { - if ($object->bank_account) + if ($object->fk_account > 0) { $bankline=new AccountLine($db); $bankline->fetch($object->bank_line); @@ -257,9 +258,8 @@ if (! empty($conf->banque->enabled)) print ''; print ''; print ''; @@ -281,6 +281,8 @@ if (! empty($conf->banque->enabled)) print '
'.$langs->trans('Ref').''; -print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); -print '
'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).''; +print '
'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).''; print $form->editfieldval("Date",'datep',$object->date,$object,$user->rights->facture->paiement,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded')); print '
'.$langs->trans('BankAccount').''; $accountstatic=new Account($db); - $accountstatic->id=$bankline->fk_account; - $accountstatic->label=$bankline->bank_account_ref.' - '.$bankline->bank_account_label; - print $accountstatic->getNomUrl(0); + $accountstatic->fetch($bankline->fk_account); + print $accountstatic->getNomUrl(1); print '
'; +print '
'; + dol_fiche_end(); @@ -325,8 +327,8 @@ if ($resql) while ($i < $num) { $objp = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; $invoice=new Facture($db); $invoice->fetch($objp->facid); @@ -370,7 +372,7 @@ if ($resql) $i++; } } - $var=!$var; + print "\n"; print '
'; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 58a6cc3e747..625b2be518e 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -494,14 +494,14 @@ if ($action == 'new') foreach ($lines[$bid] as $lid => $value) { - $var=!$var; + $account_id = $bid; if (! isset($accounts[$bid])) $accounts[$bid]=0; $accounts[$bid] += 1; - print ""; + print ''; print ''.dol_print_date($value["date"],'day').''; print ''.$value["numero"]."\n"; print ''.$value["emetteur"]."\n"; @@ -694,7 +694,7 @@ else $accounts[$objp->bid]=0; $accounts[$objp->bid] += 1; - print ""; + print ''; print ''.$i.''; print ''.dol_print_date($db->jdate($objp->date),'day').''; // Date operation print ''.($objp->num_chq?$objp->num_chq:' ').''; @@ -742,7 +742,7 @@ else } print ''; print ''; - $var=!$var; + $i++; } print ""; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index bba49827104..2d77cb71061 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -77,7 +77,7 @@ if ($resql) { $num = $row[0]; } - print ""; + print ''; print ''.$langs->trans("BankChecksToReceipt").''; print ''; print ''.$num.''; @@ -129,7 +129,7 @@ if ($resql) $accountstatic->id=$objp->bid; $accountstatic->label=$objp->label; - $var=!$var; + print "\n"; print ''.$checkdepositstatic->getNomUrl(1).''; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index ae9bc315877..f1a9a839792 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -186,8 +186,8 @@ if ($resql) while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; // Num ref cheque print ''; @@ -225,7 +225,7 @@ if ($resql) } else { - print ""; + print ''; print ''.$langs->trans("None").""; print ''; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 099d05cfa84..53035dca96f 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -37,7 +37,8 @@ class Paiement extends CommonObject { public $element='payment'; public $table_element='paiement'; - + public $picto = 'payment'; + var $facid; var $datepaye; /** @@ -95,7 +96,7 @@ class Paiement extends CommonObject if ($id > 0) $sql.= ' AND p.rowid = '.$id; else if ($ref) - $sql.= ' AND p.rowid = '.$ref; + $sql.= " AND p.ref = '".$ref."'"; else if ($fk_bank) $sql.= ' AND p.fk_bank = '.$fk_bank; @@ -964,26 +965,29 @@ class Paiement extends CommonObject * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option Sur quoi pointe le lien + * @param string $mode 'withlistofinvoices'=Include list of invoices into tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0,$option='',$mode='withlistofinvoices') { global $langs; $result=''; $label = $langs->trans("ShowPayment").': '.$this->ref; - $arraybill = $this->getBillsArray(); - if (count($arraybill) >0) - { - require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $facturestatic=new Facture($this->db); - foreach ($arraybill as $billid) - { - $facturestatic->fetch($billid); - $label .='
'.$facturestatic->getNomUrl(1).' '.$facturestatic->getLibStatut(2,1); - } - } - + if ($mode == 'withlistofinvoices') + { + $arraybill = $this->getBillsArray(); + if (count($arraybill) > 0) + { + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $facturestatic=new Facture($this->db); + foreach ($arraybill as $billid) + { + $facturestatic->fetch($billid); + $label .='
'.$facturestatic->getNomUrl(1).' '.$facturestatic->getLibStatut(2,1); + } + } + } $link = ''; $linkend=''; @@ -1016,7 +1020,7 @@ class Paiement extends CommonObject global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); - if ($mode == 0) + /*if ($mode == 0) { if ($status == 0) return $langs->trans('ToValidate'); if ($status == 1) return $langs->trans('Validated'); @@ -1046,7 +1050,12 @@ class Paiement extends CommonObject if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); } - return $langs->trans('Unknown'); + if ($mode == 6) + { + if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); + }*/ + return ''; } } diff --git a/htdocs/compta/paiement/info.php b/htdocs/compta/paiement/info.php index e1b12225aad..d0bda152b21 100644 --- a/htdocs/compta/paiement/info.php +++ b/htdocs/compta/paiement/info.php @@ -32,33 +32,39 @@ $langs->load("bills"); $langs->load("companies"); $id=GETPOST('id'); +$ref=GETPOST('ref', 'alpha'); +$action=GETPOST('action','alpha'); +$confirm=GETPOST('confirm','alpha'); + +/* + * Actions + */ + +// None /* * View */ -llxHeader(); +llxHeader('', $langs->trans("Payment")); $object = new Paiement($db); -$object->fetch($id); -$object->info($id); +$object->fetch($id, $ref); +$object->info($object->id); $head = payment_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("PaymentCustomerInvoice"), 0, 'payment'); +dol_fiche_head($head, 'info', $langs->trans("PaymentCustomerInvoice"), -1, 'payment'); -print ''; $linkback = '' . $langs->trans("BackToList") . ''; +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', ''); -// Ref -print ''; -print '
'.$langs->trans('Ref').''; -print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); -print '
'; +print '
'; +print '
'; print '
'; @@ -68,5 +74,7 @@ print ''; print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 4cb63b7d905..d0ba0373457 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -225,29 +225,8 @@ if ($resql) print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) - { - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - } - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder); - - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - // Lines for filters fields - print ''; + print ''; print ''; @@ -285,12 +264,32 @@ if ($resql) } print "\n"; - $var=true; + print ''; + print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) + { + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + } + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder); + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; print '".''; diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 342294dfc12..bd262eaa675 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -266,9 +266,9 @@ if ($action == 'create') { $objp = $charge; - $var=!$var; + - print ""; + print ''; if ($objp->date_ech > 0) { diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index b64d92d873f..2d653f2ba05 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -239,8 +239,8 @@ if ($resql) { $objp = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; // Ref print '
'; print ''; print '
'; $paymentstatic->id=$objp->rowid; diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 27f34bef269..e9a90667e69 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -152,7 +152,7 @@ if ($year) { if (preg_match('/^payment/i',$file)) { - $var=!$var; + $tfile = $dir . '/'.$year.'/'.$file; $relativepath = $year.'/'.$file; print "
'.img_pdf().' '.$file.'
'; $socialcontrib->fetch($objp->scid); @@ -268,7 +268,7 @@ if ($resql) $i++; } } - $var=!$var; + print "
\n"; $db->free($resql); diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 8f90183f0f7..dbbf9d09ac7 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -134,7 +134,7 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; + print ""; diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index bd16ec0e23b..62e57813886 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -322,7 +322,7 @@ if ($id > 0) { $obj = $db->fetch_object($result); - print ""; + print ''; // Status of line print ""; @@ -354,7 +354,7 @@ if ($id > 0) print ''; $total += $obj->amount; - $var=!$var; + $i++; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index b45a49dbe69..5d77a9b9771 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -194,8 +194,8 @@ if ($resql) while ($i < $num && $i < 20) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; print ''; $invoicestatic->id=$obj->rowid; $invoicestatic->ref=$obj->facnumber; @@ -268,9 +268,9 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; + - print ""; + print ''; print ""; $bprev->id=$obj->rowid; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index e104ba75a1a..c1c8bd7e929 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -136,8 +136,8 @@ if ($resql) while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; // Ref facture print ''; diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 33a7a4486a0..72d775a49c3 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -197,7 +197,7 @@ if ($result) $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; - print ""; + print ''; print ""; print $invoicetmp->getNomUrl(1); @@ -233,7 +233,7 @@ if ($result) print "\n"; $total += $obj->total_ttc; - $var=!$var; + $i++; } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index d013f605504..064f41e41e8 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -164,7 +164,7 @@ if ($resql) print "\n"; $total += $obj->amount; - $var=!$var; + $i++; } } diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index a86280e66bd..c5d441e3260 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -146,7 +146,7 @@ if ($prev_id) print "\n"; - $var=!$var; + $i++; } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 440af1cdbaf..32257a71a0f 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -75,15 +75,15 @@ $var=true; print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; -$var=!$var; -print ''; + +print ''; print '
'.$langs->trans("Statistics").'
'.$langs->trans("NbOfInvoiceToWithdraw").'
'.$langs->trans("NbOfInvoiceToWithdraw").''; print ''; print $bprev->NbFactureAPrelever(); print ''; print '
'.$langs->trans("AmountToWithdraw").'
'.$langs->trans("AmountToWithdraw").''; print price($bprev->SommeAPrelever(),'','',1,-1,-1,'auto'); print '

'; @@ -129,8 +129,8 @@ if ($resql) $invoicestatic->type=$obj->type; $alreadypayed=$invoicestatic->getSommePaiement(); - $var=!$var; - print ''; + + print ''; print $invoicestatic->getNomUrl(1,'withdraw'); print ''; @@ -197,9 +197,9 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; + - print ""; + print ''; print ""; $bprev->id=$obj->rowid; diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index d5ae2514034..f7fe4b77e7d 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -165,7 +165,7 @@ if ($result) { $obj = $db->fetch_object($result); - $var=!$var; + print ""; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 78a11e898df..ef72ca8f6e5 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -112,7 +112,7 @@ if ($result) print ''.$rej->motifs[$obj->motif].''; print "\n"; - $var=!$var; + $i++; } diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index ceeef191aee..b666b355e24 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -120,7 +120,7 @@ if ($resql) print round($row[0]/$total*100,2)." %"; print ''; - $var=!$var; + $i++; } @@ -218,7 +218,7 @@ if ($resql) print ''; - $var=!$var; + $i++; } diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index aec371ac0b3..2a1234fccc1 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -198,8 +198,8 @@ if ($id > 0) // Display array foreach($TData as $data) { - $var=!$var; - print ""; + + print ''; print "".dol_print_date($data['date'],'day')."\n"; print ''.$data['link']."\n"; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 6f780de554b..5c77bbba21d 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -235,7 +235,7 @@ if ($result) { while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; + print " "; print "".$langs->trans("Bills").' '.$objp->name."\n"; @@ -280,7 +280,7 @@ if ($modecompta != 'CREANCES-DETTES') while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; + print " "; print "".$langs->trans("Bills")." ".$langs->trans("Other")." (".$langs->trans("PaymentsNotLinkedToInvoice").")\n"; @@ -304,7 +304,7 @@ if ($modecompta != 'CREANCES-DETTES') if ($total_ttc == 0) { - $var=!$var; + print " "; print ''.$langs->trans("None").''; print ''; @@ -367,7 +367,7 @@ if ($result) { while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; + print " "; print "".$langs->trans("Bills")." socid."\">".$objp->name."\n"; @@ -387,7 +387,7 @@ if ($result) { } else { - $var=!$var; + print " "; print ''.$langs->trans("None").''; print ''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 5b2c6b70a13..fe64bb7b999 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -671,8 +671,8 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $mois_modulo = $mois; if($mois>12) {$mois_modulo = $mois-12;} - $var=!$var; - print ''; + + print ''; print "".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,$annee),"%B").""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { @@ -704,7 +704,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) } // Total -$var=!$var; + $nbcols=0; print ''.$langs->trans("TotalTTC").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) @@ -721,7 +721,7 @@ print ' '; print "\n"; // Balance -$var=!$var; + print ''.$langs->trans("AccountingResult").''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index df83f5b9958..569aa81629e 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -202,11 +202,7 @@ if ($id) } } -/* ************************************************************************** */ -/* */ -/* create mode */ -/* */ -/* ************************************************************************** */ +// Create if ($action == 'create') { $year_current = strftime("%Y",dol_now()); @@ -332,19 +328,19 @@ if ($id) $head=salaries_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), 0, 'payment'); - - print ''; + dol_fiche_head($head, 'card', $langs->trans("SalaryPayment"), -1, 'payment'); $linkback = ''.$langs->trans("BackToList").''; - print ""; - print ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', ''); + + print '
'; + print '
'; + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', ''); - print '
'; // Employee - print '
'.$langs->trans("Employee").''; + print '
'.$langs->trans("Employee").''; $usersal=new User($db); $usersal->fetch($object->fk_user); print $usersal->getNomUrl(1); @@ -394,7 +390,9 @@ if ($id) $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
'; - + + print '
'; + dol_fiche_end(); diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index a4bee09d7de..6c151272035 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -33,20 +33,21 @@ class PaymentSalary extends CommonObject { //public $element='payment_salary'; //!< Id that identify managed objects //public $table_element='payment_salary'; //!< Name of table without prefix where object is stored - - var $tms; - var $fk_user; - var $datep; - var $datev; - var $amount; - var $type_payment; - var $num_payment; - var $label; - var $datesp; - var $dateep; - var $fk_bank; - var $fk_user_author; - var $fk_user_modif; + public $picto='payment'; + + public $tms; + public $fk_user; + public $datep; + public $datev; + public $amount; + public $type_payment; + public $num_payment; + public $label; + public $datesp; + public $dateep; + public $fk_bank; + public $fk_user_author; + public $fk_user_modif; /** @@ -547,4 +548,66 @@ class PaymentSalary extends CommonObject } } + + /** + * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) + * + * @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 Libelle + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->statut,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $status Statut + * @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 Libelle du statut + */ + function LibStatut($status,$mode=0) + { + global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage + + $langs->load('compta'); + /*if ($mode == 0) + { + if ($status == 0) return $langs->trans('ToValidate'); + if ($status == 1) return $langs->trans('Validated'); + } + if ($mode == 1) + { + if ($status == 0) return $langs->trans('ToValidate'); + if ($status == 1) return $langs->trans('Validated'); + } + if ($mode == 2) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); + } + if ($mode == 3) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4'); + } + if ($mode == 4) + { + if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate'); + if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); + } + if ($mode == 5) + { + if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); + } + if ($mode == 6) + { + if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1'); + if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); + }*/ + return ''; + } + } diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 9e48533846a..7b24a0762f3 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -94,7 +94,7 @@ if ($object->id) // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 88414e45566..597b8aabad0 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -85,7 +85,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP * View */ -llxHeader(); +llxHeader('', $langs->trans("Salaries")); $form = new Form($db); $salstatic = new PaymentSalary($db); @@ -155,18 +155,7 @@ if ($result) print '
'; print ''."\n"; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - print ''; + print ''; // Ref print ''; + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + print "\n"; while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; $userstatic->id=$obj->uid; $userstatic->lastname=$obj->lastname; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 76456aee99b..aa479ec4369 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -602,7 +602,7 @@ if ($id > 0) while ($i < $num) { $objp = $db->fetch_object($resql); - $var=!$var; + print "'; print '\n"; @@ -616,8 +616,8 @@ if ($id > 0) } else { - $var=!$var; - print ''; + + print ''; } //if ($object->status == ChargeSociales::STATUS_DRAFT) diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 4d3f908e73c..cf42a11b515 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -117,7 +117,7 @@ if ($object->id) print '
'; // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 66d6a65dd56..706c75fab07 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -177,18 +177,7 @@ if ($resql) print '
'; print '
'; print ''; @@ -198,13 +187,24 @@ if ($result) print $searchpitco; print '
"; print ''.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp),'day')."
'.$langs->trans("None").'
'.$langs->trans("None").'
'."\n"; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - print ''; + print ''; // Ref print ''; print "\n"; + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + $i=0; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $var = !$var; - print ""; + print ''; // Ref print '"; + print ''; // Ref payment $payment_sc_static->id=$obj->pid; $payment_sc_static->ref=$obj->pid; @@ -259,8 +259,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $total = $total + $obj->amount; - $var=!$var; - print ""; + + print ''; print ''."\n"; print "\n"; @@ -361,8 +361,8 @@ while($j<$numlt) $total = $total + $obj->amount; - $var=!$var; - print ""; + + print ''; print ''."\n"; print "\n"; @@ -443,8 +443,8 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $total = $total + $obj->amount; - $var=!$var; - print ""; + + print ''; print ''."\n"; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 236e22ba981..ee6e7f1be27 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -357,8 +357,8 @@ if ($modecompta == 'CREANCES-DETTES') if (count($name)) { foreach($name as $key=>$value) { - $var=!$var; - print ""; + + print ''; // Product $fullname=$name[$key]; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index d72b06a1bb0..fff94c898c2 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -352,8 +352,8 @@ if (count($amount)) { $i = 0; foreach($arrayforsort as $key => $value) { - $var=!$var; - print ""; + + print ''; // Third party $fullname=$name[$key]; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 636c4e29d17..548809f4317 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -517,8 +517,8 @@ if (count($amount)) { } foreach($arrayforsort as $key=>$value) { - $var=!$var; - print ""; + + print ''; // Third party $fullname=$name[$key]; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 9d942caf57a..2bb9a7d50a0 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -222,8 +222,8 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $mois_modulo = $mois;// ajout if($mois>12){$mois_modulo = $mois-12;} // ajout - $var=!$var; - print ""; + + print ''; print ""; for ($annee = $year_start -1 ; $annee <= $year_end ; $annee++) // We start one year before to have data to be able to make delta @@ -312,8 +312,8 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) /* for ($mois = 1 ; $mois < 13 ; $mois++) { - $var=!$var; - print ""; + + print ''; print ""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) @@ -480,7 +480,7 @@ print ''; $totalam_Rac += $obj->am; $i++; } - $var=!$var; + print ""; } $db->free($resql); @@ -530,7 +530,7 @@ print ''; $total_pr += $obj->total_ttc-$obj->tot_fttc; $i++; } - $var=!$var; + print ""; } $db->free($resql); diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 84940bae414..0ede7fa091e 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -260,7 +260,7 @@ if (is_array($coll_list)) { $i = 1; foreach ($coll_list as $coll) { if ($min == 0 or ($min > 0 && $coll->amount > $min)) { - $var=!$var; + $intra = str_replace($find,$replace,$coll->tva_intra); if(empty($intra)) { if($coll->assuj == '1') { @@ -270,7 +270,7 @@ if (is_array($coll_list)) { $intra = ''; } } - print ""; + print ''; print '"; $company_static->id=$coll->socid; $company_static->name=$coll->name; @@ -340,7 +340,7 @@ if (is_array($coll_list)) { $i = 1; foreach ($coll_list as $coll) { if ($min == 0 or ($min > 0 && $coll->amount > $min)) { - $var=!$var; + $intra = str_replace($find,$replace,$coll->tva_intra); if (empty($intra)) { if ($coll->assuj == '1') { @@ -350,7 +350,7 @@ if (is_array($coll_list)) { $intra = ''; } } - print ""; + print ''; print '"; $company_static->id=$coll->socid; $company_static->name=$coll->name; diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index c9a65ac2f03..105bfcb2bf6 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -83,8 +83,8 @@ function pt ($db, $sql, $date) while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; print '\n"; $total = $total + $obj->mm; @@ -171,8 +171,8 @@ for ($m = 1 ; $m < 13 ; $m++ ) break; } - $var=!$var; - print ""; + + print ''; print ''; $x_coll = 0; diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index 57ce32b72fe..6d33c358af2 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -259,8 +259,8 @@ if ($conf->global->ACCOUNTING_MODE == "CREANCES-DETTES") $x_paye_sum = 0; $x_paye_ht = 0; foreach($x_both as $rate => $both){ - $var=!$var; - print ""; + + print ''; print ""; print ""; print ""; @@ -282,8 +282,8 @@ if ($conf->global->ACCOUNTING_MODE == "CREANCES-DETTES") $total = $total + $diff; $subtotal = $subtotal + $diff; - $var=!$var; - print ""; + + print ''; print ''; print "\n"; print "\n"; diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index e0a19d7a0f3..513eb25ff7e 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -396,8 +396,8 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - $var=!$var; - print ''; + + print ''; // Ref print ''; @@ -553,8 +553,8 @@ else if (! empty($fields['ddate_start'])) $type=1; if (! empty($fields['ddate_end'])) $type=1; - $var=!$var; - print ''; + + print ''; // Ref print ''; diff --git a/htdocs/compta/tva/quarter_report.php b/htdocs/compta/tva/quarter_report.php index 626a0fd6c34..a3d902ed3f3 100644 --- a/htdocs/compta/tva/quarter_report.php +++ b/htdocs/compta/tva/quarter_report.php @@ -408,8 +408,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $type=1; } - $var=!$var; - print ''; + + print ''; // Ref print ''; @@ -576,8 +576,8 @@ if (!is_array($x_coll) || !is_array($x_paye)) { $type=1; } - $var=!$var; - print ''; + + print ''; // Ref print ''; diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index 1a45b8a91c7..15a6df0a717 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -157,19 +157,10 @@ if ($result) print_barre_liste($langs->trans("VATPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit); + print '
'; print '
'; print ''; @@ -218,14 +207,24 @@ if ($resql) print '
'; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 017bcb7686e..eda1633480a 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -163,7 +163,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) { $obj = $db->fetch_object($resql); $var = !$var; - print "
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."
'.dol_print_date($db->jdate($obj->dm),'day').'".$obj->label."
'.dol_print_date($db->jdate($obj->dateep),'day').'
".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,2000),"%B")."
".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")."
Facture a encaisser : ".price($total_ttc_Rac)."<-- bug ici car n'exclut pas le deja r�gl� des factures partiellement r�gl�es
Signe et non facture:".price($total_pr)."<-- bug ici, ca devrait exclure le deja facture
'.$i."
'.$i."
'.$obj->dm."
'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'
$rate%".price($both['coll']['totalht'])."".price($both['coll']['vat'])."
".price($diff)."
'.$fields['link'].'
'.$fields['link'].'
'.$fields['link'].'
'.$fields['link'].'
'; - print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - print ''; + print ''; print ''; print ''; print ''; @@ -196,10 +187,20 @@ if ($result) print ''; print "\n"; + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; if ($obj->payment_code <> '') { @@ -210,7 +211,7 @@ if ($result) $type = ''; } - print ""; + print ''; $tva_static->id=$obj->rowid; $tva_static->ref=$obj->rowid; @@ -254,7 +255,8 @@ if ($result) print ""; print "
 
 
"; - + print '
'; + print ''; $db->free($result); diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index 8d003e14cf5..b0067d81ec1 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -100,7 +100,7 @@ if ($object->id) // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 80649ef4e06..ef26c9c80e2 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -631,7 +631,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -642,7 +642,7 @@ print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -651,7 +651,7 @@ while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - print ""; + print ''; $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=''; @@ -669,8 +669,8 @@ while ($i < min($num,$limit)) if (! empty($arrayfields['p.lastname']['checked'])) { print ''; - print $contactstatic->getNomUrl(1,'',0); - print ''; + print $contactstatic->getNomUrl(1,'',0); + print ''; } // Firstname if (! empty($arrayfields['p.firstname']['checked'])) @@ -784,12 +784,13 @@ while ($i < min($num,$limit)) print ''.$contactstatic->getLibStatut(3).''; } // Action column - Links Add action and Export vcard - print ''; - print ''.img_object($langs->trans("AddAction"),"action").''; + print ''; + /*print ''.img_object($langs->trans("AddAction"),"action").''; print '   '; - print ''; + print ''; print img_picto($langs->trans("VCard"),'vcard.png').' '; - print ''; + print ''; */ + print ''; print "\n"; $i++; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 34f44c4f690..0e5f3fca093 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1507,7 +1507,7 @@ else $objp = $db->fetch_object($result); - //$var=!$var; + // if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) { @@ -1868,7 +1868,7 @@ else print '
'; print ''; - print ''; + print '
'; // Definie date debut et fin par defaut $dateactstart = $objp->date_debut; @@ -1887,23 +1887,25 @@ else } } - print ''; + print ''; print ''; - print ''; - - print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print '
'.$langs->trans("DateServiceActivate").''; print $form->select_date($dateactstart,'',$usehm,$usehm,'',"active",1,0,1); print ''.$langs->trans("DateEndPlanned").''; print $form->select_date($dateactend,"end",$usehm,$usehm,'',"active",1,0,1); print ''; - print '
'; - print ''; + print '
'; print '
'.$langs->trans("Comment").'
'.$langs->trans("Comment").''; + print '   '; + print ''; + print '
'; @@ -1913,13 +1915,13 @@ else if ($user->rights->contrat->activer && $action == 'unactivateline' && $object->lines[$cursorline-1]->id == GETPOST('ligne')) { /** - * Desactiver la ligne de contrat + * Disable a contract line */ print ''; print ''; - print ''; + print '
'; // Definie date debut et fin par defaut $dateactstart = $objp->date_debut_reelle; @@ -1940,7 +1942,7 @@ else $now=dol_now(); if ($dateactend > $now) $dateactend=$now; - print ''; - - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; if ($objp->statut >= 4) { if ($objp->statut == 4) @@ -1950,13 +1952,17 @@ else } } print ''; - print '
'; - print ''; + print '
'; print '
'.$langs->trans("Comment").'
'.$langs->trans("Comment").''; + print '   '; + print ''; + print '
'; print '
'; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index d4d41b2f60c..f0a34e982c8 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1819,13 +1819,13 @@ class Contrat extends CommonObject $text.=':     '; } $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofserviceswait > 0) ? $this->nbofserviceswait.' '.$line->LibStatut(0,3).'   ' : ''; + $text.=($mode != 7 || $this->nbofserviceswait > 0) ? $this->nbofserviceswait.' '.$line->LibStatut(0,3).(($this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofservicesopened > 0) ? $this->nbofservicesopened.' '.$line->LibStatut(4,3,0).'   ' : ''; + $text.=($mode != 7 || $this->nbofservicesopened > 0) ? $this->nbofservicesopened.' '.$line->LibStatut(4,3,0).(($this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? $this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).'   ' : ''; + $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? $this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).(($this->nbofservicesclosed)?'   ':'') : ''; $text.=($mode == 7?'
':''); - $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? $this->nbofservicesclosed.' '.$line->LibStatut(5,3).'   ' : ''; + $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? $this->nbofservicesclosed.' '.$line->LibStatut(5,3) : ''; $text.=($mode == 7?'
':''); return $text; } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index e6607729767..8510888cf35 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref)) $hselected=1; - dol_fiche_head($head, $hselected, $langs->trans("Contract"), 0, 'contract'); + dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract'); // Contract card diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 289ec50b78b..7c0263f8376 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -93,11 +93,11 @@ if ($object->id) { $head=contract_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("Contract"), 0, 'contract'); + dol_fiche_head($head, 'documents', $langs->trans("Contract"), -1, 'contract'); // Construit liste des fichiers - $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); $totalsize=0; foreach($filearray as $key => $file) { diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 9ec924254a9..ea9c06d0b2f 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -82,7 +82,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print "
'.$langs->trans("Search").'
'.$langs->trans("Contract").':
\n"; @@ -188,8 +188,8 @@ foreach($listofstatus as $status) $dataseries[]=array('label'=>$staticcontratligne->LibStatut($status,1,($bool?1:0)),'data'=>(isset($nb[$status.$bool])?(int) $nb[$status.$bool]:0)); if (empty($conf->use_javascript_ajax)) { - $var=!$var; - print ''; + + print ''; print ''.$staticcontratligne->LibStatut($status,0,($bool?1:0)).''; print ''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).''; print "\n"; @@ -210,8 +210,8 @@ foreach($listofstatus as $status) { if (empty($conf->use_javascript_ajax)) { - $var=!$var; - print ''; + + print ''; print ''.$staticcontratligne->LibStatut($status,0,($bool?1:0)).''; print ''.($nb[$status.$bool]?$nb[$status.$bool]:0).' '.$staticcontratligne->LibStatut($status,3,($bool?1:0)).''; if ($status==4 && ! $bool) $bool=true; @@ -258,7 +258,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - print ''; + print ''; $staticcontrat->ref=$obj->ref; $staticcontrat->id=$obj->rowid; print $staticcontrat->getNomUrl(1,''); @@ -272,7 +272,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) print ''; //$tot_ttc+=$obj->total_ttc; $i++; - $var=!$var; + } } else @@ -334,9 +334,9 @@ if ($result) while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; + - print ''; + print ''; print ''; $staticcontrat->ref=($obj->ref?$obj->ref:$obj->cid); $staticcontrat->id=$obj->cid; @@ -401,8 +401,8 @@ if ($resql) while ($i < min($num,$max)) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; print ''; $staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat); $staticcontrat->id=$obj->fk_contrat; @@ -482,8 +482,8 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; print ''; $staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat); @@ -563,8 +563,8 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; print ''; $staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat); diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 7f20b21c888..35cca237b21 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -28,10 +28,14 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $langs->load("contracts"); +$action = GETPOST('action','alpha'); +$confirm = GETPOST('confirm','alpha'); +$id = GETPOST('id','int'); +$ref = GETPOST('ref','alpha'); + // Security check -$contratid = GETPOST("id",'int'); if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'contrat',$contratid,''); +$result = restrictedArea($user, 'contrat', $id, ''); /* @@ -41,13 +45,17 @@ $result = restrictedArea($user, 'contrat',$contratid,''); llxHeader('',$langs->trans("Contract"),""); $object = new Contrat($db); -$object->fetch($contratid); -$object->fetch_thirdparty(); -$object->info($contratid); +$object->fetch($id, $ref); +if ($object->id > 0) +{ + $object->fetch_thirdparty(); +} + +$object->info($object->id); $head = contract_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("Contract"), 0, 'contract'); +dol_fiche_head($head, 'info', $langs->trans("Contract"), -1, 'contract'); // Contract card diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index c382bfc7612..be1b2e5fccf 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -534,7 +534,7 @@ if ($resql) if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -551,7 +551,7 @@ if ($resql) print_liste_field_titre($staticcontratligne->LibStatut(4,3,1), '', '', '', '', 'width="16"'); print_liste_field_titre($staticcontratligne->LibStatut(5,3), '', '', '', '', 'width="16"'); } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; while ($i < min($num,$limit)) @@ -563,7 +563,7 @@ if ($resql) $contracttmp->ref_customer=$obj->ref_customer; $contracttmp->ref_supplier=$obj->ref_supplier; - print ''; + print ''; if (! empty($arrayfields['c.ref']['checked'])) { print ''; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 212fa465266..7d4927d19b8 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -70,7 +70,7 @@ if ($id > 0 || ! empty($ref)) $hselected = 2; - dol_fiche_head($head, 'note', $langs->trans("Contract"), 0, 'contract'); + dol_fiche_head($head, 'note', $langs->trans("Contract"), -1, 'contract'); // Contract card diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 42ff4b04e83..d92bcd16679 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -371,7 +371,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab if (! empty($arrayfields["ef.".$key]['checked'])) { $align=$extrafields->getAlignFlag($key); - print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],"ef.".$key,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -382,7 +382,7 @@ print $hookmanager->resPrint; if (! empty($arrayfields['cd.datec']['checked'])) print_liste_field_titre($arrayfields['cd.datec']['label'],$_SERVER["PHP_SELF"],"cd.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['cd.tms']['checked'])) print_liste_field_titre($arrayfields['cd.tms']['label'],$_SERVER["PHP_SELF"],"cd.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['status']['checked'])) print_liste_field_titre($arrayfields['status']['label'],$_SERVER["PHP_SELF"],"cd.statut,c.statut","",$param,'align="right"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; print ''; @@ -519,9 +519,9 @@ while ($i < min($num,$limit)) $contractstatic->id=$obj->cid; $contractstatic->ref=$obj->ref?$obj->ref:$obj->cid; - $var=!$var; + - print ""; + print ''; // Ref if (! empty($arrayfields['c.ref']['checked'])) diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 1257e3503a9..a2da6cef24e 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -33,7 +33,7 @@ $var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $var=!$var; + $trclass=($var?'pair':'impair'); if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 95c0c59a9cd..74badc6daae 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -434,8 +434,11 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Create output dir if not exists dol_mkdir($diroutputmassaction); - // Save merged file + // Defined name of merged file $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/','_',$filename); + + // Save merged file if ($filter=='paye:0') { if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); @@ -486,7 +489,8 @@ if (! $error && $massaction == 'delete' && $permtodelete) $result=$objecttmp->fetch($toselectid); if ($result > 0) { - $result = $objecttmp->delete($user); + if ($objecttmp->element == 'societe') $result = $objecttmp->delete($objecttmp->id, $user, 1); + else $result = $objecttmp->delete($user); if ($result <= 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 061b98d1e9c..dbf446d2112 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -36,7 +36,7 @@ if ($action == 'print_file' and $user->rights->printing->read) $list = $objectprint->listDrivers($db, 10); if (! empty($list)) { $errorprint=0; - $printed=0; + $printerfound=0; foreach ($list as $driver) { require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; $langs->load($driver); @@ -46,27 +46,35 @@ if ($action == 'print_file' and $user->rights->printing->read) if (! empty($conf->global->{$printer->active})) { + $printerfound++; + $subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':''); $module = GETPOST('printer', 'alpha'); if ($module =='commande_fournisseur') { $module = 'fournisseur'; $subdir = 'commande'; } - $ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir); - if ($ret > 0) { - //print '
'.print_r($printer->errors, true).'
'; - setEventMessages($printer->error, $printer->errors, 'errors'); + try { + $ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir); + if ($ret > 0) { + //print '
'.print_r($printer->errors, true).'
'; + setEventMessages($printer->error, $printer->errors, 'errors'); + } + if ($ret==0) + { + //print '
'.print_r($printer->errors, true).'
'; + setEventMessages($printer->error, $printer->errors); + setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); + } } - if ($ret==0) + catch(Exception $e) { - //print '
'.print_r($printer->errors, true).'
'; - setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); - $printed++; + $ret = 1; + setEventMessages($e->getMessage(), null, 'errors'); } } } - if ($printed==0) setEventMessages($langs->trans("NoActivePrintingModuleFound"), null, 'warnings'); + if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound"), null, 'warnings'); } else { setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); } diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 52411613e0b..3fec57091cb 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -150,7 +150,7 @@ if ($type == 'directory') $formfile=new FormFile($db); $maxlengthname=40; - $excludefiles = array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview\.png)$','^temp$','^payments$','^CVS$','^thumbs$'); + $excludefiles = array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview.*\.png)$','^temp$','^payments$','^CVS$','^thumbs$'); $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); // Right area. If module is defined, we are in automatic ecm. @@ -212,7 +212,7 @@ if ($type == 'directory') { $filearray=array(); } - else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); + else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview.*\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); if ($section) { diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 41d411f01fd..331b4ceaac8 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2010-2015 Regis Houssin + * Copyright (C) 2017 Laurent Destailleur * * 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 diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index b6d38d17b53..e856d52c2b6 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -191,7 +191,7 @@ class box_actions extends ModeleBoxes // on affiche que les évènement du jours ou passé // qui ne sont pas à 100% $actioncejour=true; - $var=!$var; + // TR $logo=$contents[$line][0]['logo']; $label=$contents[$line][1]['text']; diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index fe460f7d512..be9a868109d 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -121,7 +121,7 @@ class box_commandes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => '', + 'td' => 'class="tdoverflowmax100"', 'text' => $societestatic->getNomUrl(1), 'asis' => 1, ); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 315293281cc..7c3d6ab4e7f 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -223,7 +223,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); $stringtoshow.='
'; $stringtoshow.=$langs->trans("Year").' '; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=''; $stringtoshow.='
'; if ($shownb && $showtot) diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index a709a7aef3a..2b3c69a9e15 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -249,6 +249,8 @@ class box_graph_product_distribution extends ModeleBoxes if (! empty($conf->commande->enabled) && ! empty($user->rights->commande->lire)) { + $langs->load("orders"); + // Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...) if ($showordernb) { diff --git a/htdocs/core/boxes/box_lastlogin.php b/htdocs/core/boxes/box_lastlogin.php index 7211877a593..05bd3043b0a 100644 --- a/htdocs/core/boxes/box_lastlogin.php +++ b/htdocs/core/boxes/box_lastlogin.php @@ -79,7 +79,7 @@ class box_lastlogin extends ModeleBoxes ); $this->info_box_contents[$line][1] = array( 'td' => '', - 'text' => $user->getNomUrl(1), + 'text' => $user->getNomUrl(-1), 'asis' => 1 ); diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index d3945ddb940..3f7b37f186a 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -116,8 +116,8 @@ class box_propales extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => '', - 'text' => $societestatic->getNomUrl(1,'',40), + 'td' => 'class="tdoverflowmax100"', + 'text' => $societestatic->getNomUrl(1), 'asis' => 1, ); diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 26ee34bdca0..f5fa32e590d 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -234,7 +234,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" // Show box title if (! empty($head['text']) || ! empty($head['sublink']) || ! empty($head['subpicto'])) { - $out.= ''; + $out.= ''; $out.= ' 0) { $out.= ' colspan="'.$nbcol.'"'; } $out.= '>'; @@ -247,25 +247,26 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" $s=dol_trunc($head['text'],isset($head['limit'])?$head['limit']:$MAXLENGTHBOX); $out.= $s; } - $out.= ' '; - - $sublink=''; - if (! empty($head['sublink'])) $sublink.= ''; - if (! empty($head['subpicto'])) $sublink.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); - if (! empty($head['sublink'])) $sublink.= ''; + $out.= ''; + if (! empty($conf->use_javascript_ajax)) { - $out.= ''; + $sublink=''; + if (! empty($head['sublink'])) $sublink.= ''; + if (! empty($head['subpicto'])) $sublink.= img_picto($head['subtext'], $head['subpicto'], 'class="'.(empty($head['subclass'])?'':$head['subclass']).'" id="idsubimg'.$this->boxcode.'"'); + if (! empty($head['sublink'])) $sublink.= ''; + + $out.= ''; $out.=$sublink; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); - $out.= img_picto($langs->trans("CloseBox",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); + $out.= img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone cursormove"'); + $out.= img_picto($langs->trans("CloseBox",$this->box_id),'close_title','class="boxclose cursorpointer" rel="x:y" id="imgclose'.$this->box_id.'"'); $label=$head['text']; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; $out.= ''; $out.= ''; } - $out.= ''; + $out.= "\n"; } @@ -277,7 +278,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" { if (isset($contents[$i])) { - $var=!$var; + // TR if (isset($contents[$i][0]['tr'])) $out.= ''; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 396952ace9c..3da7f3abcf3 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -31,16 +31,20 @@ /** * Class to send emails (with attachments or not) - * Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid); + * Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext); * $mailfile->sendfile(); */ class CMailFile { + public $sendcontext; + public $sendmode; + public $sendsetup; + var $subject; // Topic: Subject of email var $addr_from; // From: Label and EMail of sender (must include '<>'). For example '' or 'John Doe ' or ''). Note that with gmail smtps, value here is forced by google to account (but not the reply-to). - // Sender: Who send the email ("Sender" has sent emails on behalf of "From"). - // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain. - // Return-Path: Email where to send bounds. + // Sender: Who send the email ("Sender" has sent emails on behalf of "From"). + // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain. + // Return-Path: Email where to send bounds. var $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined) var $errors_to; // Errors-To: Email where to send errors. var $addr_to; @@ -55,7 +59,6 @@ class CMailFile var $eol; var $eol2; - var $atleastonefile=0; var $error=''; var $smtps; // Contains SMTPs object (if this method is used) @@ -74,17 +77,17 @@ class CMailFile // Image var $html; var $image_boundary; - var $atleastoneimage=0; + var $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). var $html_images=array(); var $images_encoded=array(); var $image_types = array('gif' => 'image/gif', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'bmp' => 'image/bmp', - 'png' => 'image/png', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff'); + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'bmp' => 'image/bmp', + 'png' => 'image/png', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff'); /** @@ -103,12 +106,23 @@ class CMailFile * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown make autodetection (with fast mode, not reliable) * @param string $errors_to Email for errors-to * @param string $css Css option - * @param string $trackid Tracking string + * @param string $trackid Tracking string (contains type and id of related element) * @param string $moreinheader More in header. $moreinheader must contains the "\r\n" (TODO not supported for other MAIL_SEND_MODE different than 'phpmail' and 'smtps' for the moment) + * @param string $sendcontext 'standard', 'emailing', ... */ - function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='') + function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='',$sendcontext='standard') { - global $conf; + global $conf, $dolibarr_main_data_root; + + $this->sendcontext = $sendcontext; + + $this->sendmode = ''; + if ($this->sendcontext == 'emailing') $this->sendmode = $conf->global->EMAILING_MAIL_SENDMODE; + if (empty($this->sendmode)) $this->sendmode=$conf->global->MAIN_MAIL_SENDMODE; + if (empty($this->sendmode)) $this->sendmode='mail'; + + $this->sendsetup = array(); + // We define end of line (RFC 821). $this->eol="\r\n"; @@ -130,17 +144,14 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - // If ending method not defined - if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail'; - - dol_syslog("CMailFile::CMailfile: MAIN_MAIL_SENDMODE=".$conf->global->MAIN_MAIL_SENDMODE." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=$subject, deliveryreceipt=$deliveryreceipt, msgishtml=$msgishtml", LOG_DEBUG); if (empty($subject)) { - dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); - $this->error='ErrorSubjectIsRequired'; - return; + dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); + $this->error='ErrorSubjectIsRequired'; + return; } // Detect if message is HTML (use fast method) @@ -160,7 +171,11 @@ class CMailFile if ($this->msgishtml) { $this->html = $msg; - $findimg = $this->findHtmlImages($conf->fckeditor->dir_output); + + if (! empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) + { + $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias'); + } // Define if there is at least one file if ($findimg) @@ -190,7 +205,7 @@ class CMailFile if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO; // Action according to choosed sending method - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') + if ($this->sendmode == 'mail') { // Use mail php function (default PHP method) // ------------------------------------------ @@ -210,9 +225,9 @@ class CMailFile $this->addr_bcc = $addr_bcc; $this->deliveryreceipt = $deliveryreceipt; $this->trackid = $trackid; - + $smtp_headers = $this->write_smtpheaders(); - if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n + if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n // Define mime_headers $mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list); @@ -231,17 +246,6 @@ class CMailFile // Define body in text_body $text_body = $this->write_body($msg); - // Encode images - $images_encoded = ''; - if ($this->atleastoneimage) - { - $images_encoded.= $this->write_images($this->images_encoded); - // always end related and end alternative after inline images - $images_encoded.= "--" . $this->related_boundary . "--" . $this->eol; - $images_encoded.= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol; - $images_encoded.= $this->eol; - } - // Add attachments to text_encoded if ($this->atleastonefile) { @@ -255,11 +259,11 @@ class CMailFile // comme des injections mail par les serveurs de messagerie. $this->headers = preg_replace("/([\r\n]+)$/i","",$this->headers); - $this->message = 'This is a message with multiple parts in MIME format.'.$this->eol; - $this->message.= $text_body . $images_encoded . $files_encoded; + $this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol; + $this->message.= $text_body . $files_encoded; $this->message.= "--" . $this->mixed_boundary . "--" . $this->eol; } - else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') + else if ($this->sendmode == 'smtps') { // Use SMTPS library // ------------------------------------------ @@ -315,7 +319,7 @@ class CMailFile $this->smtps=$smtps; } // TODO not stable, in progress - else if ($conf->global->MAIN_MAIL_SENDMODE == 'phpmailer') + else if ($this->sendmode == 'phpmailer') { // Use PHPMailer library // ------------------------------------------ @@ -330,7 +334,7 @@ class CMailFile $this->phpmailer->SetReplyTo($this->getValidAddress($from,0,1)); // Set property with this->phpmailer->setReplyTo after constructor if you want to use another value than the From // TODO Add trackid into smtp header // TODO if (! empty($moreinheader)) ... - + if (! empty($this->html)) { if (!empty($css)) @@ -367,94 +371,94 @@ class CMailFile $this->phpmailer->setErrorsTo($errors_to); $this->phpmailer->setDeliveryReceipt($deliveryreceipt); } - else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') - { - // Use Swift Mailer library - // ------------------------------------------ - - $host = dol_getprefix('email'); - - require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; - // Create the message - $this->message = Swift_Message::newInstance(); + else if ($this->sendmode == 'swiftmailer') + { + // Use Swift Mailer library + // ------------------------------------------ - // Adding a trackid header to a message - $headers = $this->message->getHeaders(); - $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); - $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; - $msgid = $headers->get('Message-ID'); - $msgid->setId($headerID); - $headers->addIdHeader('References', $headerID); - // TODO if (! empty($moreinheader)) ... - - // Give the message a subject - $this->message->setSubject($this->encodetorfc2822($subject)); + $host = dol_getprefix('email'); - // Set the From address with an associative array - //$this->message->setFrom(array('john@doe.com' => 'John Doe')); - if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from)); + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; + // Create the message + $this->message = Swift_Message::newInstance(); - // Set the To addresses with an associative array - if (! empty($to)) $this->message->setTo($this->getArrayAddress($to)); + // Adding a trackid header to a message + $headers = $this->message->getHeaders(); + $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); + $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; + $msgid = $headers->get('Message-ID'); + $msgid->setId($headerID); + $headers->addIdHeader('References', $headerID); + // TODO if (! empty($moreinheader)) ... - if (! empty($from)) $this->message->SetReplyTo($this->getArrayAddress($from)); + // Give the message a subject + $this->message->setSubject($this->encodetorfc2822($subject)); - $this->message->setCharSet($conf->file->character_set_client); + // Set the From address with an associative array + //$this->message->setFrom(array('john@doe.com' => 'John Doe')); + if (! empty($from)) $this->message->setFrom($this->getArrayAddress($from)); - if (! empty($this->html)) - { - if (!empty($css)) - { - $this->css = $css; - $this->buildCSS(); - } - $msg = $this->html; - $msg = $this->checkIfHTML($msg); - } + // Set the To addresses with an associative array + if (! empty($to)) $this->message->setTo($this->getArrayAddress($to)); - if ($this->atleastoneimage) - { - foreach ($this->images_encoded as $img) - { - //$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid'] - $attachment = Swift_Image::fromPath($img['fullpath'], $img['content_type']); - // embed image - $imgcid = $this->message->embed($attachment); - // replace cid by the one created by swiftmail in html message - $msg = str_replace("cid:".$img['cid'], $imgcid, $msg); - } - } + if (! empty($from)) $this->message->SetReplyTo($this->getArrayAddress($from)); - if ($this->msgishtml) { - $this->message->setBody($msg,'text/html'); - // And optionally an alternative body - //$this->message->addPart('Here is the message itself', 'text/plain'); - } else { - $this->message->setBody($msg,'text/plain'); - // And optionally an alternative body - //$this->message->addPart('Here is the message itself', 'text/html'); - } + $this->message->setCharSet($conf->file->character_set_client); - if ($this->atleastonefile) - { - foreach ($filename_list as $i => $val) - { - //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); - $attachment = Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]); - $this->message->attach($attachment); - } - } + if (! empty($this->html)) + { + if (!empty($css)) + { + $this->css = $css; + $this->buildCSS(); + } + $msg = $this->html; + $msg = $this->checkIfHTML($msg); + } - if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc)); - if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc)); - //if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to); - if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from)); - } + if ($this->atleastoneimage) + { + foreach ($this->images_encoded as $img) + { + //$img['fullpath'],$img['image_encoded'],$img['name'],$img['content_type'],$img['cid'] + $attachment = Swift_Image::fromPath($img['fullpath'], $img['content_type']); + // embed image + $imgcid = $this->message->embed($attachment); + // replace cid by the one created by swiftmail in html message + $msg = str_replace("cid:".$img['cid'], $imgcid, $msg); + } + } + + if ($this->msgishtml) { + $this->message->setBody($msg,'text/html'); + // And optionally an alternative body + //$this->message->addPart('Here is the message itself', 'text/plain'); + } else { + $this->message->setBody($msg,'text/plain'); + // And optionally an alternative body + //$this->message->addPart('Here is the message itself', 'text/html'); + } + + if ($this->atleastonefile) + { + foreach ($filename_list as $i => $val) + { + //$this->message->attach(Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i])); + $attachment = Swift_Attachment::fromPath($filename_list[$i],$mimetype_list[$i]); + $this->message->attach($attachment); + } + } + + if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc)); + if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc)); + //if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to); + if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from)); + } else { // Send mail method not correctly defined // -------------------------------------- - $this->error = 'Bad value for MAIN_MAIL_SENDMODE constant'; + $this->error = 'Bad value for sendmode'; } } @@ -476,55 +480,55 @@ class CMailFile if (empty($conf->global->MAIN_DISABLE_ALL_MAILS)) { - require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); - $hookmanager->initHooks(array( - 'maildao' - )); - $reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (! empty($reshook)) - { - $this->error = "Error in hook maildao doactions " . $reshook; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR); + require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + $hookmanager->initHooks(array( + 'maildao' + )); + $reshook = $hookmanager->executeHooks('doactions', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if (! empty($reshook)) + { + $this->error = "Error in hook maildao doactions " . $reshook; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR); - return $reshook; - } + return $reshook; + } - // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10; - $tmparray1 = explode(',', $this->addr_to); - if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) - { - $this->error = 'Too much recipients in to:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); - return false; - } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10; - $tmparray2 = explode(',', $this->addr_cc); - if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) - { - $this->error = 'Too much recipients in cc:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); - return false; - } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10; - $tmparray3 = explode(',', $this->addr_bcc); - if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) - { - $this->error = 'Too much recipients in bcc:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); - return false; - } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; - if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) - { - $this->error = 'Too much recipients in to:, cc:, bcc:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); - return false; - } + // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10; + $tmparray1 = explode(',', $this->addr_to); + if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10; + $tmparray2 = explode(',', $this->addr_cc); + if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in cc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10; + $tmparray3 = explode(',', $this->addr_bcc); + if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; + if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + { + $this->error = 'Too much recipients in to:, cc:, bcc:'; + dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + return false; + } // Action according to choosed sending method - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') + if ($this->sendmode == 'mail') { // Use mail php function (default PHP method) // ------------------------------------------ @@ -560,15 +564,15 @@ class CMailFile // Having this variable not defined may create problems with some other sendmail (option -f required) $additionnalparam .= ($additionnalparam?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO,2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from,2) : '') ); } - if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender - { - $additionnalparam .= ($additionnalparam?' ':'').'-ba'; - } + if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender + { + $additionnalparam .= ($additionnalparam?' ':'').'-ba'; + } + + if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params + + dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG); - if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params - - dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG); - $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); @@ -605,27 +609,38 @@ class CMailFile if (! empty($conf->global->MAIN_MAIL_SMTP_SERVER)) ini_restore('SMTP'); if (! empty($conf->global->MAIN_MAIL_SMTP_PORT)) ini_restore('smtp_port'); } - else if ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') + else if ($this->sendmode == 'smtps') { // Use SMTPS library // ------------------------------------------ $this->smtps->setTransportType(0); // Only this method is coded in SMTPs library - // Forcage parametres + // Clean parameters if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP'); if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port'); + // TODO Manage alternative parameters + // If we use SSL/TLS $server=$conf->global->MAIN_MAIL_SMTP_SERVER; if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server; + $port=$conf->global->MAIN_MAIL_SMTP_PORT; $this->smtps->setHost($server); - $this->smtps->setPort($conf->global->MAIN_MAIL_SMTP_PORT); // 25, 465...; + $this->smtps->setPort($port); // 25, 465...; - if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->smtps->setID($conf->global->MAIN_MAIL_SMTPS_ID); - if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->smtps->setPW($conf->global->MAIN_MAIL_SMTPS_PW); - //$smtps->_msgReplyTo = 'reply@web.com'; + $loginid=''; $loginpass=''; + if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) + { + $loginid = $conf->global->MAIN_MAIL_SMTPS_ID; + $this->smtps->setID($loginid); + } + if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) + { + $loginpass = $conf->global->MAIN_MAIL_SMTPS_PW; + $this->smtps->setPW($loginpass); + } $res=true; $from=$this->smtps->getFrom('org'); @@ -646,6 +661,7 @@ class CMailFile if ($res) { if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true); + $result=$this->smtps->sendMsg(); //print $result; @@ -661,63 +677,63 @@ class CMailFile } } } - else if ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') - { + else if ($this->sendmode == 'swiftmailer') + { - // Use Swift Mailer library - // ------------------------------------------ - require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; + // Use Swift Mailer library + // ------------------------------------------ + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; - // Forcage parametres - if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP'); - if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port'); + // Forcage parametres + if (empty($conf->global->MAIN_MAIL_SMTP_SERVER)) $conf->global->MAIN_MAIL_SMTP_SERVER=ini_get('SMTP'); + if (empty($conf->global->MAIN_MAIL_SMTP_PORT)) $conf->global->MAIN_MAIL_SMTP_PORT=ini_get('smtp_port'); - // If we use SSL/TLS - $server=$conf->global->MAIN_MAIL_SMTP_SERVER; - $secure=''; - //var_dump(stream_get_transports()); - if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl'; - if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls'; + // If we use SSL/TLS + $server=$conf->global->MAIN_MAIL_SMTP_SERVER; + $secure=''; + //var_dump(stream_get_transports()); + if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $secure='ssl'; + if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $secure='tls'; - $this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure); + $this->transport = Swift_SmtpTransport::newInstance($server, $conf->global->MAIN_MAIL_SMTP_PORT, $secure); - if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID); - if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW); - //$smtps->_msgReplyTo = 'reply@web.com'; + if (! empty($conf->global->MAIN_MAIL_SMTPS_ID)) $this->transport->setUsername($conf->global->MAIN_MAIL_SMTPS_ID); + if (! empty($conf->global->MAIN_MAIL_SMTPS_PW)) $this->transport->setPassword($conf->global->MAIN_MAIL_SMTPS_PW); + //$smtps->_msgReplyTo = 'reply@web.com'; - // Create the Mailer using your created Transport - $this->mailer = Swift_Mailer::newInstance($this->transport); + // Create the Mailer using your created Transport + $this->mailer = Swift_Mailer::newInstance($this->transport); - if (! empty($conf->global->MAIN_MAIL_DEBUG)) { - // To use the ArrayLogger - $this->logger = new Swift_Plugins_Loggers_ArrayLogger(); - // Or to use the Echo Logger - //$this->logger = new Swift_Plugins_Loggers_EchoLogger(); - $this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger)); - } - // send mail - try { - $result = $this->mailer->send($this->message); - } catch (Exception $e) { - $this->error = $e->getMessage(); - } - if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); + if (! empty($conf->global->MAIN_MAIL_DEBUG)) { + // To use the ArrayLogger + $this->logger = new Swift_Plugins_Loggers_ArrayLogger(); + // Or to use the Echo Logger + //$this->logger = new Swift_Plugins_Loggers_EchoLogger(); + $this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger)); + } + // send mail + try { + $result = $this->mailer->send($this->message); + } catch (Exception $e) { + $this->error = $e->getMessage(); + } + if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); - $res = true; - if (! empty($this->error) && ! $result) { - dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; - } else { - $this->error = sprintf ("Sent %d messages\n", $result); - } - } + $res = true; + if (! empty($this->error) && ! $result) { + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); + $res=false; + } else { + $this->error = sprintf ("Sent %d messages\n", $result); + } + } else { // Send mail method not correctly defined // -------------------------------------- - return 'Bad value for MAIN_MAIL_SENDMODE constant'; + return 'Bad value for sendmode'; } } @@ -785,81 +801,81 @@ class CMailFile $outputfile=$dolibarr_main_data_root."/dolibarr_mail.log"; $fp = fopen($outputfile,"w"); - if ($conf->global->MAIN_MAIL_SENDMODE == 'mail') + if ($this->sendmode == 'mail') { fputs($fp, $this->headers); fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log fputs($fp, $this->message); } - elseif ($conf->global->MAIN_MAIL_SENDMODE == 'smtps') + elseif ($this->sendmode == 'smtps') { fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on } - elseif ($conf->global->MAIN_MAIL_SENDMODE == 'swiftmailer') - { - fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on - } + elseif ($this->sendmode == 'swiftmailer') + { + fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on + } fclose($fp); if (! empty($conf->global->MAIN_UMASK)) - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); + @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); } } - /** - * Correct an uncomplete html string - * - * @param string $msg String - * @return string Completed string - */ - function checkIfHTML($msg) - { - if (!preg_match('/^[\s\t]*styleCSS)) $out.= $this->styleCSS; - $out.= "bodyCSS)) $out.= $this->bodyCSS; - $out.= ">"; - $out.= $msg; - $out.= ""; - } - else - { - $out = $msg; - } + /** + * Correct an uncomplete html string + * + * @param string $msg String + * @return string Completed string + */ + function checkIfHTML($msg) + { + if (!preg_match('/^[\s\t]*styleCSS)) $out.= $this->styleCSS; + $out.= "bodyCSS)) $out.= $this->bodyCSS; + $out.= ">"; + $out.= $msg; + $out.= ""; + } + else + { + $out = $msg; + } - return $out; - } + return $out; + } - /** - * Build a css style (mode = all) into this->styleCSS and this->bodyCSS - * - * @return css - */ - function buildCSS() - { - if (! empty($this->css)) - { - // Style CSS - $this->styleCSS = ''; - } - } + if ($this->css['bgcolor']) + { + $this->styleCSS.= ' background-color: '.$this->css['bgcolor'].';'; + $this->bodyCSS.= ' bgcolor="'.$this->css['bgcolor'].'"'; + } + if ($this->css['bgimage']) + { + // TODO recuperer cid + $this->styleCSS.= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");'; + } + $this->styleCSS.= '}'; + $this->styleCSS.= ''; + } + } /** @@ -973,40 +989,56 @@ class CMailFile $out.= "--" . $this->alternative_boundary . $this->eol; } - if ($this->msgishtml) - { - // Check if html header already in message - $strContent = $this->checkIfHTML($msgtext); - } - else - { - $strContent = $msgtext; - } - // Make RFC821 Compliant, replace bare linefeeds - $strContent = preg_replace("/(?global->MAIN_FIX_FOR_BUGGED_MTA)) { $strContent = preg_replace("/\r\n/si", "\n", $strContent); } + $strContentAltText = ''; + if ($this->msgishtml) + { + $strContentAltText = html_entity_decode(strip_tags($strContent)); + $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n")); + + // Check if html header already in message, if not complete the message + $strContent = $this->checkIfHTML($strContent); + } + // Make RFC2045 Compliant, split lines - //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content - $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. + //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content + $strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { if ($this->atleastoneimage) { $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; - $out.= $this->eol.strip_tags($strContent).$this->eol; // Add plain text message + $out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message $out.= "--" . $this->alternative_boundary . $this->eol; $out.= "Content-Type: multipart/related; boundary=\"".$this->related_boundary."\"".$this->eol; $out.= $this->eol; $out.= "--" . $this->related_boundary . $this->eol; } + + if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part + { + $out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol; + $out.= $this->eol; + $out.= "--" . $this->alternative_boundary . $this->eol; + $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; + $out.= $this->eol.$strContentAltText.$this->eol; + $out.= "--" . $this->alternative_boundary . $this->eol; + } + $out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol; $out.= $this->eol.$strContent.$this->eol; + + if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part + { + $out.= "--" . $this->alternative_boundary . "--". $this->eol; + } } else { @@ -1016,6 +1048,16 @@ class CMailFile $out.= $this->eol; + // Encode images + if ($this->atleastoneimage) + { + $out .= $this->write_images($this->images_encoded); + // always end related and end alternative after inline images + $out .= "--" . $this->related_boundary . "--" . $this->eol; + $out .= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol; + $out .= $this->eol; + } + return $out; } @@ -1041,10 +1083,12 @@ class CMailFile if ($encoded >= 0) { if ($mimefilename_list[$i]) $filename_list[$i] = $mimefilename_list[$i]; - if (! $mimetype_list[$i]) { $mimetype_list[$i] = "application/octet-stream"; } + if (! $mimetype_list[$i]) { + $mimetype_list[$i] = "application/octet-stream"; + } $out.= "--" . $this->mixed_boundary . $this->eol; - $out.= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol; + $out.= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol; $out.= "Content-Type: " . $mimetype_list[$i] . "; name=\"".$filename_list[$i]."\"".$this->eol; $out.= "Content-Transfer-Encoding: base64".$this->eol; $out.= "Content-Description: File Attachment".$this->eol; @@ -1104,25 +1148,25 @@ class CMailFile */ function check_server_port($host,$port) { - global $conf; + global $conf; $_retVal=0; $timeout=5; // Timeout in seconds if (function_exists('fsockopen')) { - // If we use SSL/TLS - if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host; - // tls smtp start with no encryption - //if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host; + // If we use SSL/TLS + if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $host='ssl://'.$host; + // tls smtp start with no encryption + //if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host; dol_syslog("Try socket connection to host=".$host." port=".$port); //See if we can connect to the SMTP server if ($socket = @fsockopen( - $host, // Host to test, IP or domain. Add ssl:// for SSL/TLS. - $port, // which Port number to use - $errno, // actual system level error - $errstr, // and any text that goes with the error - $timeout + $host, // Host to test, IP or domain. Add ssl:// for SSL/TLS. + $port, // which Port number to use + $errno, // actual system level error + $errstr, // and any text that goes with the error + $timeout )) // timeout for reading/writing data over the socket { // Windows still does not have support for this timeout function @@ -1184,14 +1228,15 @@ class CMailFile $extensions = array_keys($this->image_types); - preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); + preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found if ($matches) { $i=0; foreach ($matches[1] as $full) { - if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs)) + + if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i',$full,$regs)) // If xxx is 'file=aaa' { $img = $regs[1]; @@ -1272,7 +1317,7 @@ class CMailFile * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' * @param int $format 0=auto, 1=emails with <>, 2=emails without <>, 3=auto + label between " * @param int $encode 0=No encode name, 1=Encode name to RFC2822 - * @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more. + * @param int $maxnumberofemail 0=No limit. Otherwise, maximum number of emails returned ($address may contains several email separated with ','). Add '...' if there is more. * @return string If format 0: '' or 'John Doe ' or '=?UTF-8?B?Sm9obiBEb2U=?= ' * If format 1: '' * If format 2: 'john@doe.com' @@ -1304,12 +1349,12 @@ class CMailFile if ($email) { - $i++; - + $i++; + $newemail=''; if ($format == 4) { - $newemail = $name?$name:$email; + $newemail = $name?$name:$email; } if ($format == 2) { @@ -1327,12 +1372,12 @@ class CMailFile } $ret=($ret ? $ret.',' : '').$newemail; - + // Stop if we have too much records if ($maxnumberofemail && $i >= $maxnumberofemail) { - if (count($arrayaddress) > $maxnumberofemail) $ret.='...'; - break; + if (count($arrayaddress) > $maxnumberofemail) $ret.='...'; + break; } } } @@ -1340,38 +1385,38 @@ class CMailFile return $ret; } - /** - * Return a formatted array of address string for SMTP protocol - * - * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' - * @return array array of email => name - */ - function getArrayAddress($address) - { - global $conf; + /** + * Return a formatted array of address string for SMTP protocol + * + * @param string $address Example: 'John Doe , Alan Smith ' or 'john@doe.com, alan@smith.com' + * @return array array of email => name + */ + function getArrayAddress($address) + { + global $conf; - $ret=array(); + $ret=array(); - $arrayaddress=explode(',',$address); + $arrayaddress=explode(',',$address); - // Boucle sur chaque composant de l'adresse - foreach($arrayaddress as $val) - { - if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs)) - { - $name = trim($regs[1]); - $email = trim($regs[2]); - } - else - { - $name = null; - $email = trim($val); - } + // Boucle sur chaque composant de l'adresse + foreach($arrayaddress as $val) + { + if (preg_match('/^(.*)<(.*)>$/i',trim($val),$regs)) + { + $name = trim($regs[1]); + $email = trim($regs[2]); + } + else + { + $name = null; + $email = trim($val); + } - $ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null; - } + $ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null; + } - return $ret; - } + return $ret; + } } diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index ac7bb3175fb..3e9d56f8f8c 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -307,7 +307,7 @@ abstract class CommonInvoice extends CommonObject * * @param int $paye Status field paye * @param int $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short 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 * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @param int $type Type invoice * @return string Libelle du statut @@ -408,9 +408,10 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6').' '.$langs->trans('BillStatusPaid'); } } - if ($mode == 5) + if ($mode == 5 || $mode == 6) { - $prefix='Short'; + $prefix=''; + if ($mode == 5) $prefix='Short'; if (! $paye) { if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b79c72e6336..e03db1b4773 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -42,50 +42,59 @@ abstract class CommonObject * @var DoliDb Database handler (result of a new DoliDB) */ public $db; - /** * @var int The object identifier */ public $id; - /** * @var string Error string * @deprecated Use instead the array of error strings * @see errors */ public $error; - /** * @var string[] Array of error strings */ public $errors=array(); - + /** + * @var string + */ + public $element; + /** + * @var string + */ + public $table_element; + /** + * @var + */ + public $table_element_line; /** * @var string Key value used to track if data is coming from import wizard */ public $import_key; - /** * @var mixed Contains data to manage extrafields */ public $array_options=array(); - /** * @var int[] Array of linked objects ids. Loaded by ->fetchObjectLinked */ public $linkedObjectsIds; - /** * @var mixed Array of linked objects. Loaded by ->fetchObjectLinked */ public $linkedObjects; - + /** + * @var Object To store a cloned copy of object before to edit it and keep track of old properties + */ + public $oldcopy; + /** * @var string Column name of the ref field. */ protected $table_ref_field = ''; - + // Following vars are used by some objects only. We keep this property here in CommonObject to be able to provide common method using them. @@ -166,19 +175,6 @@ abstract class CommonObject */ public $ref_ext; - /** - * @var string - */ - public $element; - /** - * @var string - */ - public $table_element; - /** - * @var - */ - public $table_element_line; - /** * @var int The object's status * @see setStatut() @@ -332,8 +328,10 @@ abstract class CommonObject public $firstname; public $civility_id; + // No constructor as it is an abstract class + /** * Check an object id/ref exists * If you don't need/want to instantiate object and just need to know if object exists, use this method instead of fetch @@ -495,7 +493,7 @@ abstract class CommonObject $out.=dol_print_phone($this->phone_pro,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePro")); $outdone++; } if (! empty($this->phone_mobile)) { - $out.=dol_print_phone($this->phone_mobile,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhoneMobile")); $outdone++; + $out.=dol_print_phone($this->phone_mobile,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','mobile',$langs->trans("PhoneMobile")); $outdone++; } if (! empty($this->phone_perso)) { $out.=dol_print_phone($this->phone_perso,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePerso")); $outdone++; @@ -507,7 +505,7 @@ abstract class CommonObject $out.=dol_print_phone($this->office_phone,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhonePro")); $outdone++; } if (! empty($this->user_mobile)) { - $out.=dol_print_phone($this->user_mobile,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','phone',$langs->trans("PhoneMobile")); $outdone++; + $out.=dol_print_phone($this->user_mobile,$this->country_code,$contactid,$thirdpartyid,'AC_TEL',' ','mobile',$langs->trans("PhoneMobile")); $outdone++; } if (! empty($this->office_fax)) { $out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX',' ','fax',$langs->trans("Fax")); $outdone++; @@ -781,7 +779,7 @@ abstract class CommonObject $tab=array(); $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user - if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact"; + if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact, t.login, t.photo"; if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid, t.statut as statuscontact"; $sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; $sql.= ", tc.source, tc.element, tc.code, tc.libelle"; @@ -815,7 +813,7 @@ abstract class CommonObject $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id, 'nom'=>$obj->lastname, // For backward compatibility - 'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'statuscontact'=>$obj->statuscontact, + 'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'login'=>$obj->login, 'photo'=>$obj->photo, 'statuscontact'=>$obj->statuscontact, 'rowid'=>$obj->rowid, 'code'=>$obj->code, 'libelle'=>$libelle_type, 'status'=>$obj->statuslink, 'fk_c_type_contact'=>$obj->fk_c_type_contact); } else @@ -3164,8 +3162,16 @@ abstract class CommonObject $resql = $this->db->query($sql); if ($resql) { - $res = $this->db->fetch_object($resql); - return 'Incoterm : '.$res->code.' - '.$this->location_incoterms; + $num = $this->db->num_rows($resql); + if ($num > 0) + { + $res = $this->db->fetch_object($resql); + return 'Incoterm : '.$res->code.' - '.$this->location_incoterms; + } + else + { + return ''; + } } else { @@ -3422,7 +3428,7 @@ abstract class CommonObject //Line extrafield $line->fetch_optionals($line->id,$extralabelslines); - $var=!$var; + //if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) if (is_object($hookmanager)) // Old code is commented on preceding line. @@ -3603,7 +3609,7 @@ abstract class CommonObject foreach ($this->lines as $line) { - $var=!$var; + if (is_object($hookmanager) && (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line))) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 1692b58c5f9..9446020e3ff 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -128,11 +128,7 @@ class Conf dol_syslog(get_class($this)."::setValues"); - /* - * Definition de toutes les constantes globales d'environnement - * - En constante php (TODO a virer) - * - En $this->global->key=value - */ + //Define all global constants into $this->global->key=value $sql = "SELECT ".$db->decrypt('name')." as name,"; $sql.= " ".$db->decrypt('value')." as value, entity"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; @@ -158,7 +154,7 @@ class Conf $value=$objp->value; if ($key) { - if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install) + //if (! defined("$key")) define("$key", $value); // In some cases, the constant might be already forced (Example: SYSLOG_HANDLERS during install) $this->global->$key=$value; if ($value && preg_match('/^MAIN_MODULE_/',$key)) @@ -207,7 +203,7 @@ class Conf $db->free($resql); } - // Include other local consts.php files and fetch their values to the corresponding database constants + // Include other local consts.php files and fetch their values to the corresponding database constants. if (! empty($this->global->LOCAL_CONSTS_FILES)) { $filesList = explode(":", $this->global->LOCAL_CONSTS_FILES); foreach ($filesList as $file) { @@ -333,13 +329,12 @@ class Conf $this->propal->dir_output=$rootfordata."/propale"; $this->propal->dir_temp=$rootfordata."/propale/temp"; - // Exception: Some dir are not the name of module. So we keep exception here - // for backward compatibility. + // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. // Sous module bons d'expedition - $this->expedition_bon->enabled= defined("MAIN_SUBMODULE_EXPEDITION")?MAIN_SUBMODULE_EXPEDITION:0; + $this->expedition_bon->enabled=$this->global->MAIN_SUBMODULE_EXPEDITION?$this->global->MAIN_SUBMODULE_EXPEDITION:0; // Sous module bons de livraison - $this->livraison_bon->enabled=defined("MAIN_SUBMODULE_LIVRAISON")?MAIN_SUBMODULE_LIVRAISON:0; + $this->livraison_bon->enabled=$this->global->MAIN_SUBMODULE_LIVRAISON?$this->global->MAIN_SUBMODULE_LIVRAISON:0; // Module fournisseur if (! empty($this->fournisseur)) @@ -390,7 +385,8 @@ class Conf // Set some default values $this->global->MAIN_ACTIVATE_HTML5=1; - + $this->global->MAIN_MAIL_USE_MULTI_PART=1; + // societe if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard"; if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; @@ -598,8 +594,8 @@ class Conf } // We init log handlers - if (defined('SYSLOG_HANDLERS')) { - $handlers = json_decode(constant('SYSLOG_HANDLERS')); + if (! empty($this->global->SYSLOG_HANDLERS)) { + $handlers = json_decode($this->global->SYSLOG_HANDLERS); } else { $handlers = array(); } @@ -631,6 +627,7 @@ class Conf $this->loghandlers[$handler] = $loghandlerinstance; } } + } } diff --git a/htdocs/core/class/dolprintipp.class.php b/htdocs/core/class/dolprintipp.class.php index 869b26e2f75..99f3c14f15c 100644 --- a/htdocs/core/class/dolprintipp.class.php +++ b/htdocs/core/class/dolprintipp.class.php @@ -116,8 +116,8 @@ class dolprintIPP { foreach ($jobs as $value) { - $var=!$var; - print ""; + + print ''; print ''.$value->job_id->_value0.''; print ''.$value->job_originating_user_name->_value0.''; print ''.$value->printer_uri->_value0.''; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 24023eb4d89..f86f786e0fb 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -112,7 +112,7 @@ class ExtraFields * * @param string $attrname Code of attribute * @param string $label label of attribute - * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour') + * @param int $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) * @param int $pos Position of attribute * @param string $size Size/length of attribute * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) @@ -164,7 +164,7 @@ class ExtraFields * This is a private method. For public method, use addExtraField. * * @param string $attrname code of attribute - * @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour') + * @param int $type Type of attribute ('boolean', 'int', 'text', 'varchar', 'date', 'datehour','price','phone','mail','password','url','select','checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not @@ -641,7 +641,6 @@ class ExtraFields if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; $sql.= " ORDER BY pos"; - dol_syslog(get_class($this)."::fetch_name_optionals_label", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -728,6 +727,10 @@ class ExtraFields { $showsize='minwidth400imp'; } + elseif ($type == 'boolean') + { + $showsize=''; + } else { if (round($size) < 12) @@ -993,23 +996,12 @@ class ExtraFields } elseif ($type == 'checkbox') { - $out=''; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; + $form = new Form($db); + $value_arr=explode(',',$value); + $out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $param['options'], $value_arr, '', 0, '', 0, '100%'); - foreach ($param['options'] as $keyopt=>$val ) - { - - $out.=''; - } } elseif ($type == 'radio') { @@ -1101,6 +1093,9 @@ class ExtraFields if ($resql) { $num = $this->db->num_rows($resql); $i = 0; + + $data=array(); + while ( $i < $num ) { $labeltoshow = ''; $obj = $this->db->fetch_object($resql); @@ -1126,12 +1121,9 @@ class ExtraFields $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; } } - $out .= 'rowid . '"'; - - $out .= 'checked'; - - $out .= '/>' . $labeltoshow . '
'; + + $data[$obj->rowid]=$labeltoshow; + } else { if (! $notrans) { $translabel = $langs->trans($obj->{$InfoFieldList[1]}); @@ -1145,32 +1137,25 @@ class ExtraFields $labeltoshow = '(not defined)'; if (is_array($value_arr) && in_array($obj->rowid, $value_arr)) { - $out .= 'rowid . '"'; - - $out .= 'checked'; - $out .= ''; - - $out .= '/>' . $labeltoshow . '
'; + $data[$obj->rowid]=$labeltoshow; } if (! empty($InfoFieldList[3])) { $parent = $parentName . ':' . $obj->{$parentField}; } - $out .= 'rowid . '"'; - - $out .= ((is_array($value_arr) && in_array($obj->rowid, $value_arr)) ? ' checked ' : ''); - ; - $out .= ''; - - $out .= '/>' . $labeltoshow . '
'; + $data[$obj->rowid]=$labeltoshow; } - + $i ++; } $this->db->free($resql); + + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; + $form = new Form($db); + + $out=$form->multiselectarray($keysuffix.'options_'.$key.$keyprefix, $data, $value_arr, '', 0, '', 0, '100%'); + } else { print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.
'; } @@ -1381,9 +1366,10 @@ class ExtraFields if (is_array($value_arr)) { foreach ($value_arr as $keyval=>$valueval) { - $value.=$params['options'][$valueval].'
'; + $toprint[]='
  • '.$params['options'][$valueval].'
  • '; } } + $value='
      '.implode(' ', $toprint).'
    '; } elseif ($type == 'chkbxlst') { @@ -1418,7 +1404,7 @@ class ExtraFields $resql = $this->db->query($sql); if ($resql) { $value = ''; // value was used, so now we reste it to use it to build final output - + $toprint=array(); while ( $obj = $this->db->fetch_object($resql) ) { // Several field into label (eq table:code|libelle:rowid) @@ -1431,9 +1417,9 @@ class ExtraFields $translabel = $langs->trans($obj->$field_toshow); } if ($translabel != $field_toshow) { - $value .= dol_trunc($translabel, 18) . '
    '; + $toprint[]='
  • '.dol_trunc($translabel, 18).'
  • '; } else { - $value .= $obj->$field_toshow . '
    '; + $toprint[]='
  • '.$obj->$field_toshow.'
  • '; } } } else { @@ -1442,15 +1428,18 @@ class ExtraFields $translabel = $langs->trans($obj->{$InfoFieldList[1]}); } if ($translabel != $obj->{$InfoFieldList[1]}) { - $value .= dol_trunc($translabel, 18) . '
    '; + $toprint[]='
  • '.dol_trunc($translabel, 18).'
  • '; } else { - $value .= $obj->{$InfoFieldList[1]} . '
    '; + $toprint[]='
  • '.$obj->{$InfoFieldList[1]}.'
  • '; } } } } - } else + $value='
      '.implode(' ', $toprint).'
    '; + + } else { dol_syslog(get_class($this) . '::showOutputField error ' . $this->db->lasterror(), LOG_WARNING); + } } elseif ($type == 'link') { diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index a4d84f008db..590f8060296 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -126,7 +126,7 @@ class HookManager if (! is_array($this->hooks) || empty($this->hooks)) return ''; $parameters['context']=join(':',$this->contextarray); - dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); + //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray). $hooktype='output'; @@ -202,6 +202,9 @@ class HookManager // test to avoid running twice a hook, when a module implements several active contexts if (in_array($module,$modulealreadyexecuted)) continue; + + dol_syslog(get_class($this).'::executeHooks a qualified hook was found for method='.$method.' module='.$module." action=".$action." context=".$context); + $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method to avoid running twice // Clean class (an error may have been set from a previous call of another method for same module/hook) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 271f87ab4a0..3275ee0f303 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -219,10 +219,10 @@ class Form if (empty($notabletag)) $ret.=''; if (empty($notabletag)) $ret.=''; - else $ret.='
    '; - $ret.=''; + //else $ret.='
    '; + $ret.=''; if (preg_match('/ckeditor|textarea/',$typeofdata) && empty($notabletag)) $ret.='
    '."\n"; - $ret.=''; + $ret.=''; if (empty($notabletag)) $ret.=''; if (empty($notabletag)) $ret.=''."\n"; @@ -404,7 +404,7 @@ class Form * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span * @param string $incbefore Include code before the text * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param int $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) * @return string Code html du tooltip (texte+picto) * @see Use function textwithpicto if you can. * TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip @@ -487,7 +487,7 @@ class Form * @param string $extracss Add a CSS style to td, div or span tag * @param int $noencodehtmltext Do not encode into html entity the htmltext * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param int $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) * @return string HTML code of text, picto, tooltip */ function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger='') @@ -951,36 +951,40 @@ class Form /** * Output html form to select a third party * - * @param string $selected Preselected type - * @param string $htmlname Name of field in form - * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)') - * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty') - * @param int $showtype Show third party type in combolist (customer, prospect or supplier) - * @param int $forcecombo Force to use combo box - * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) - * @param int $limit Maximum number of elements - * @param string $morecss Add more css styles to the SELECT component - * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container - * @return string HTML string with select box for thirdparty. + * @param string $selected Preselected type + * @param string $htmlname Name of field in form + * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client IN (1,3)') + * @param string $showempty Add an empty field (Can be '1' or text key to use on empty line like 'SelectThirdParty') + * @param int $showtype Show third party type in combolist (customer, prospect or supplier) + * @param int $forcecombo Force to use combo box + * @param array $events Ajax event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param int $limit Maximum number of elements + * @param string $morecss Add more css styles to the SELECT component + * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param string $selected_input_value Value of preselected input text (for use with ajax) + * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) + * @param array $ajaxoptions Options for ajax_autocompleter + * @return string HTML string with select box for thirdparty. */ - function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='') + function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array()) { + global $conf,$user,$langs; + $out=''; - /* TODO Use ajax_autocompleter like for products (not finished) if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT) && ! $forcecombo) { $placeholder=''; - if ($selected && empty($selected_input_value)) { - require_once DOL_DOCUMENT_ROOT.'/societe/ajaxcompanies.php'; - $societe = new Societe($this->db); - $societe->fetch($selected); - $selected_input_value=$societe->ref; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $societetmp = new Societe($this->db); + $societetmp->fetch($selected); + $selected_input_value=$societetmp->name; + unset($societetmp); } - // mode=1 means customers products - $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished; + // mode 1 + $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; else if ($hidelabel > 1) { @@ -990,15 +994,15 @@ class Form print img_picto($langs->trans("Search"), 'search'); } } - print ''; + print 'global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />'; if ($hidelabel == 3) { print img_picto($langs->trans("Search"), 'search'); } } else - {*/ + { $out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam); - //} + } return $out; } @@ -1024,7 +1028,8 @@ class Form { global $conf,$user,$langs; - $out=''; $num=0; + $out=''; + $num=0; $outarray=array(); // On recherche les societes @@ -1040,19 +1045,18 @@ class Form if ($filterkey && $filterkey != '') { $sql.=" AND ("; - if (! empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)) // Can use index - { - $sql.="(s.name LIKE '".$this->db->escape($filterkey)."%')"; + $prefix=empty($conf->global->COMPANY_DONOTSEARCH_ANYWHERE)?'%':''; // Can use index if COMPANY_DONOTSEARCH_ANYWHERE is on + // For natural search + $scrit = explode(' ', $filterkey); + $i=0; + if (count($scrit) > 1) $sql.="("; + foreach ($scrit as $crit) { + if ($i > 0) $sql.=" AND "; + $sql.="(s.nom LIKE '".$this->db->escape($prefix.$crit)."%')"; + $i++; } - else - { - // For natural search - $scrit = explode(' ', $filterkey); - foreach ($scrit as $crit) { - $sql.=" AND (s.name LIKE '%".$this->db->escape($crit)."%')"; - } - } - if (! empty($conf->barcode->enabled)) + if (count($scrit) > 1) $sql.=")"; + if (! empty($conf->barcode->enabled)) { $sql .= " OR s.barcode LIKE '".$this->db->escape($filterkey)."%'"; } @@ -1061,10 +1065,13 @@ class Form $sql.=$this->db->order("nom","ASC"); if ($limit > 0) $sql.=$this->db->plimit($limit); + // Build output string dol_syslog(get_class($this)."::select_thirdparty_list", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { + $events = null; + if ($conf->use_javascript_ajax && ! $forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; @@ -1085,7 +1092,7 @@ class Form } if ($showempty) $out.= ''."\n"; - $num = $this->db->num_rows($resql); + $num = $this->db->num_rows($resql); $i = 0; if ($num) { @@ -1128,7 +1135,7 @@ class Form $out.= ''; } - array_push($outarray, array('key'=>$obj->rowid, 'value'=>$obj->rowid, 'label'=>$label)); + array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); $i++; if (($i % 10) == 0) $out.="\n"; @@ -1634,7 +1641,7 @@ class Form { if ($value['id'] == $ownerid) continue; $userstatic->fetch($value['id']); - $out.=$userstatic->getNomUrl(1); + $out.=$userstatic->getNomUrl(-1); if ($i == 0) { $ownerid = $value['id']; $out.=' ('.$langs->trans("Owner").')'; } if ($nbassignetouser > 1 && $action != 'view') $out.=' '; //$out.=' '.($value['mandatory']?$langs->trans("Mandatory"):$langs->trans("Optional")); @@ -3370,11 +3377,14 @@ class Form print ''; print ''; } else { + + $langs->load('banks'); + if ($selected) { require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; $bankstatic=new Account($this->db); $bankstatic->fetch($selected); - print $this->textwithpicto($bankstatic->label,$langs->trans("AccountCurrency").' '.$bankstatic->currency_code); + print $this->textwithpicto($bankstatic->getNomUrl(1),$langs->trans("AccountCurrency").' '.$bankstatic->currency_code); } else { print " "; } @@ -3395,7 +3405,7 @@ class Form */ function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0) { - global $langs; + global $conf, $langs; $langs->load("categories"); include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -3406,9 +3416,35 @@ class Form dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); } - $cat = new Categorie($this->db); - $cate_arbo = $cat->get_full_arbo($type,$excludeafterid); - + if ($type === Categorie::TYPE_BANK_LINE) + { + // TODO Move this into common category feature + $categids=array(); + $sql = "SELECT c.label, c.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ as c"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " ORDER BY c.label"; + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; + while ($i < $num) + { + $objp = $this->db->fetch_object($result); + if ($objp) $cate_arbo[$objp->rowid]=array('id'=>$objp->rowid, 'fulllabel'=>$objp->label); + $i++; + } + $this->db->free($result); + } + else dol_print_error($this->db); + } + else + { + $cat = new Categorie($this->db); + $cate_arbo = $cat->get_full_arbo($type,$excludeafterid); + } + $output = ''; + $retstring.=''; } else return 'BadValueForParameterTypeHour'; @@ -4944,7 +4980,7 @@ class Form } elseif ($typehour=='text' ) { - $retstring.=''; + $retstring.=''; } if ($typehour!='text') $retstring.=' '.$langs->trans('MinuteShort'); @@ -5087,7 +5123,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 if caller request to have html delayed content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string */ static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) @@ -5282,7 +5318,7 @@ class Form */ static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage) { - global $conf,$user; + global $conf,$langs,$user; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return ''; @@ -5315,7 +5351,7 @@ class Form } if ($val['label']) { - $lis.='
  • '.dol_escape_htmltag($val['label']).'
  • '; + $lis.='
  • '.dol_escape_htmltag($langs->trans($val['label'])).'
  • '; $listcheckedstring.=(empty($val['checked'])?'':$key.','); } } @@ -5547,20 +5583,27 @@ class Form if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); - $possiblelinks=array( - 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), - 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id) - ); - + $possiblelinks=array(); + if (is_object($object->thirdparty) && ! empty($object->thirdparty->id) && $object->thirdparty->id > 0) + { + $listofidcompanytoscan=$object->thirdparty->id; + if (($object->thirdparty->parent > 0) && ! empty($conf->global->THIRDPARTY_INCLUDE_PARENT_IN_LINKTO)) $listofidcompanytoscan.=','.$object->thirdparty->parent; + + $possiblelinks=array( + 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal',1).')'), + 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande',1).')'), + 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture',1).')'), + 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract',1).')'), + 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention',1).')'), + 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal',1).')'), + 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur',1).')'), + 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn',1).')') + ); + } + global $action; - // Can complet the possiblelink array + // Can complete the possiblelink array $hookmanager->initHooks(array('commonobject')); $parameters=array(); $reshook=$hookmanager->executeHooks('showLinkToObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -6188,7 +6231,7 @@ class Form global $conf, $langs; $out=''; - if (! empty($conf->use_javascript_ajax)) $out.=''; + if (! empty($conf->use_javascript_ajax)) $out.='
    '; $out.=' -
    + -
    @@ -222,9 +218,10 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file ?> -
    +
    + +
    -
    diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 83725580db5..d02f820d0d5 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -56,9 +56,11 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { ?> - - - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> + + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + +
    trans('AddNewLine'); ?>trans("FreeZone"); ?> element == 'supplier_proposal') { ?> @@ -112,15 +114,20 @@ if ($nolinesbefore) { - + global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay=2; } + $coldisplay=2; + ?> + + - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> + global->MAIN_VIEW_LINE_NUMBER)) { ?> -
    +
    info_bits & 2) == 2) { ?> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index b641627b789..bdc38b08873 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -32,7 +32,7 @@ print top_htmlhead('',$langs->trans('SendNewPassword')); ?> - +global->MAIN_LOGIN_BACKGROUND)?'':' style="background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> dol_use_jmobile)) { ?> '."\n"; + if (defined('JS_JQUERY') && constant('JS_JQUERY')) print ''."\n"; else print ''."\n"; - if (constant('JS_JQUERY_UI')) print ''."\n"; + if (! empty($conf->global->MAIN_FEATURES_LEVEL)) + { + if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) print ''."\n"; + else print ''."\n"; + } + if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) print ''."\n"; else print ''."\n"; if (! defined('DISABLE_JQUERY_TABLEDND')) print ''."\n"; if (! defined('DISABLE_JQUERY_TIPTIP')) print ''."\n"; @@ -1377,8 +1381,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $menumanager->showmenu('top', array('searchform'=>$searchform, 'bookmarks'=>$bookmarks)); // This contains a \n print "
    \n"; - //$form=new Form($db); - // Define link to login card $appli=constant('DOL_APPLICATION_TITLE'); if (! empty($conf->global->MAIN_APPLICATION_TITLE)) @@ -1403,7 +1405,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $logouthtmltext.=$langs->trans("Logout").'
    '; $logouttext .=''; - $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + $logouttext .=''; $logouttext .=''; } else @@ -1427,6 +1430,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu.=''; $toprightmenu.=''; + $arrayofselected=is_array($toselect)?$toselect:array(); + + + // List of variants + print ''; + + + // List of mass actions available + /* + $arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), + 'builddoc'=>$langs->trans("PDFMerge"), + ); + if ($user->rights->product->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + */ + + $aaa=''; + if (count($productCombinations)) + { + $aaa = ''; + $aaa .= ''; + $aaa .= ''; + $aaa .= ''; + } + $massactionbutton = $aaa; + + $title = $langs->trans("ProductCombinations"); + + print_barre_liste($title, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $aaa, 0); + + print '
    '; ?> - - - - - - - - - + + + + + + + + '; + $searchpitco=$form->showCheckAddButtons('checkforselect', 1); + print $searchpitco; + print ''; + ?> fetch($currcomb->fk_product_child); ?> - > - + - - + + - + '; + if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($prodstatic->id, $arrayofselected)) $selected=1; + print ''; + } + print ''; + ?>
    - - - - trans('Product') ?>trans('Combination') ?>trans('PriceImpact') ?>trans('WeightImpact') ?>trans('OnSell') ?>trans('OnBuy') ?>trans('Product') ?>trans('Combination') ?>trans('PriceImpact') ?>trans('WeightImpact') ?>trans('OnSell') ?>trans('OnBuy') ?>
    getNomUrl(1) ?> variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?>variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight') ?>variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?>variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight') ?> getLibStatut(2, 0) ?> getLibStatut(2, 1) ?> - - + + +
    - - - - '; + print ''; } } llxFooter(); + +$db->close(); diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index b709f240551..7b0358fd176 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -130,6 +130,8 @@ if ($_POST) { } } + + /* * View */ @@ -140,37 +142,21 @@ if (! empty($id) || ! empty($ref)) { llxHeader("", "", $langs->trans("CardProduct".$object->type)); - if ($result) { - $head = product_prepare_head($object); - $titre = $langs->trans("CardProduct".$object->type); - $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); - + if ($result > 0) + { + $showbarcode=empty($conf->barcode->enabled)?0:1; + if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; + + $head=product_prepare_head($object); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'combinations', $titre, 0, $picto); - - print ''; - - // Reference - print ''; - print ''; - print ''; - - // Label - print ''; - - // Status (to sell) - print ''; - - // Status (to buy) - print ''; - - print '
    '.$langs->trans("Ref").''; - print $form->showrefnav($object, 'id', '', 0); - print '
    '.$langs->trans("Label").''.$object->label.'
    '.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $object->getLibStatut(2, 0); - print '
    '.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $object->getLibStatut(2, 1); - print '
    '; - + + $linkback = ''.$langs->trans("BackToList").''; + $object->next_prev_filter=" fk_product_type = ".$object->type; + + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1); + dol_fiche_end(); } diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 6fa65660df1..f69c7e4e4aa 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -35,7 +35,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks // Some value of modulepart can be used to get resources that are public so no login are required. -if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && ($_GET["modulepart"] == 'mycompany' || $_GET["modulepart"] == 'companylogo')) && ! defined("NOLOGIN")) define("NOLOGIN",'1'); if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'medias') && ! defined("NOLOGIN")) { define("NOLOGIN",'1'); @@ -179,7 +179,7 @@ else // Open and return file dol_syslog("viewimage.php return file $original_file content-type=$type"); // This test is to avoid error images when image is not available (for example thumbs). - if (! dol_is_file($original_file)) + if (! dol_is_file($original_file) && empty($_GET["noalt"])) { $original_file=DOL_DOCUMENT_ROOT.'/public/theme/common/nophoto.png'; /*$error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed'; diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 385c7dc3b95..cf926c6409e 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -872,7 +872,7 @@ function deleteProductOrService($authentication,$listofidstring) } else { - $result=$newobject->delete(); + $result=$newobject->delete($user); if ($result <= 0) { $error++; diff --git a/htdocs/websites/class/website.class.php b/htdocs/websites/class/website.class.php index 51a61d90112..a77079c94a6 100644 --- a/htdocs/websites/class/website.class.php +++ b/htdocs/websites/class/website.class.php @@ -73,10 +73,6 @@ class Website extends CommonObject * @var mixed */ public $date_creation; - /** - * @var mixed - */ - public $date_modification; /** * @var mixed */ @@ -123,7 +119,6 @@ class Website extends CommonObject $error = 0; // Clean parameters - if (isset($this->entity)) { $this->entity = trim($this->entity); } @@ -136,36 +131,30 @@ class Website extends CommonObject if (isset($this->status)) { $this->status = trim($this->status); } - - + if (empty($this->date_creation)) $this->date_creation = dol_now(); // Check parameters // Put here code to add control on parameters values // Insert request $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; - $sql.= 'entity,'; $sql.= 'ref,'; $sql.= 'description,'; $sql.= 'status,'; $sql.= 'fk_default_home,'; $sql.= 'virtualhost,'; - $sql.= 'date_creation,'; - $sql.= 'date_modification'; - + $sql.= 'fk_user_create'; + $sql.= 'date_creation'; $sql .= ') VALUES ('; - $sql .= ' '.(! isset($this->entity)?'NULL':$this->entity).','; $sql .= ' '.(! isset($this->ref)?'NULL':"'".$this->db->escape($this->ref)."'").','; $sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").','; $sql .= ' '.(! isset($this->status)?'NULL':$this->status).','; $sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).','; $sql .= ' '.(! isset($this->virtualhost)?'NULL':$this->virtualhost).','; - $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").','; - $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'"); - - + $sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).','; + $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'"); $sql .= ')'; $this->db->begin(); @@ -223,8 +212,9 @@ class Website extends CommonObject $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; - $sql .= " t.date_modification,"; $sql .= " t.tms"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; if (null !== $ref) { @@ -247,11 +237,10 @@ class Website extends CommonObject $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; $this->virtualhost = $obj->virtualhost; + $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_modif = $obj->fk_user_modif; $this->date_creation = $this->db->jdate($obj->date_creation); - $this->date_modification = $this->db->jdate($obj->date_modification); $this->tms = $this->db->jdate($obj->tms); - - } $this->db->free($resql); @@ -292,8 +281,9 @@ class Website extends CommonObject $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; - $sql .= " t.date_modification,"; $sql .= " t.tms"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; @@ -331,8 +321,9 @@ class Website extends CommonObject $line->status = $obj->status; $line->fk_default_home = $obj->fk_default_home; $line->virtualhost = $obj->virtualhost; + $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_modif = $obj->fk_user_modif; $line->date_creation = $this->db->jdate($obj->date_creation); - $line->date_modification = $this->db->jdate($obj->date_modification); $line->tms = $this->db->jdate($obj->tms); $this->records[$line->id] = $line; @@ -377,25 +368,20 @@ class Website extends CommonObject $this->status = trim($this->status); } - - // Check parameters // Put here code to add a control on parameters values // Update request $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; - $sql .= ' entity = '.(isset($this->entity)?$this->entity:"null").','; $sql .= ' ref = '.(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").','; $sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").','; $sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").','; + $sql .= ' fk_user_modif = '.(! isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; - $sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').','; $sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); - - $sql .= ' WHERE rowid=' . $this->id; $this->db->begin(); @@ -631,6 +617,8 @@ class Website extends CommonObject */ public function initAsSpecimen() { + global $user; + $this->id = 0; $this->entity = 1; @@ -639,8 +627,9 @@ class Website extends CommonObject $this->status = ''; $this->fk_default_home = null; $this->virtualhost = 'http://myvirtualhost'; + $this->fk_user_create = $user->id; + $this->fk_user_modif = $user->id; $this->date_creation = dol_now(); - $this->date_modification = dol_now(); $this->tms = dol_now(); diff --git a/htdocs/websites/class/websitepage.class.php b/htdocs/websites/class/websitepage.class.php index 883b6495c53..c80d20fe44b 100644 --- a/htdocs/websites/class/websitepage.class.php +++ b/htdocs/websites/class/websitepage.class.php @@ -181,7 +181,7 @@ class WebsitePage extends CommonObject /** * Load object in memory from the database * - * @param int $id Id object + * @param int $id Id object. If this is 0, the default page of website_id will be used, if not defined, the first one. found * @param string $website_id Web site id * @param string $page Page name * @@ -205,13 +205,16 @@ class WebsitePage extends CommonObject $sql .= " t.tms as date_modification"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + //$sql .= ' WHERE entity IN ('.getEntity('website', 1).')'; // entity is on website level + $sql .= ' WHERE 1 = 1'; if (null !== $website_id) { - $sql .= ' WHERE t.fk_website = ' . '\'' . $website_id . '\''; - $sql .= ' AND t.pageurl = ' . '\'' . $page . '\''; + $sql .= " AND t.fk_website = '" . $this->db->escape($website_id) . "'"; + if ($page) $sql .= " AND t.pageurl = '" . $this->db->escape($page) . "'"; } else { - $sql .= ' WHERE t.rowid = ' . $id; + $sql .= ' AND t.rowid = ' . $id; } - + $sql .= $this->db->plimit(1); + $resql = $this->db->query($sql); if ($resql) { $numrows = $this->db->num_rows($resql); diff --git a/htdocs/websites/index.php b/htdocs/websites/index.php index e6bfec0d84a..b78a172e01f 100644 --- a/htdocs/websites/index.php +++ b/htdocs/websites/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2017 Laurent Destailleur * * 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 @@ -143,6 +143,8 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain */ if (GETPOST('refreshsite')) $pageid=0; // If we change the site, we reset the pageid. +if (GETPOST('refreshpage')) $action='preview'; + // Add page if ($action == 'add') @@ -434,120 +436,151 @@ if ($action == 'updatemeta') } // Update page -if ($action == 'updatecontent') +if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview')) { - $db->begin(); $object->fetch(0, $website); + /*if (GETPOST('savevirtualhost') && $object->virtualhost != GETPOST('previewsite')) + { + $object->virtualhost = GETPOST('previewsite', 'alpha'); + $object->update($user); + }*/ + $objectpage->fk_website = $object->id; - $res = $objectpage->fetch($pageid, $object->fk_website); + if ($pageid > 0) + { + $res = $objectpage->fetch($pageid); + } + else + { + $res = $objectpage->fetch($object->fk_default_home); + if (! $res > 0) + { + $res = $objectpage->fetch(0, $object->fk_website); + } + } if ($res > 0) { - $objectpage->content = GETPOST('PAGE_CONTENT'); - - // Clean data. We remove all the head section. - $objectpage->content = preg_replace('//s', '', $objectpage->content); - /* $objectpage->content = preg_replace('//s', '', $objectpage->content); */ - - $res = $objectpage->update($user); - if ($res < 0) + if ($action == 'updatecontent') { - $error++; - setEventMessages($objectpage->error, $objectpage->errors, 'errors'); - } - - if (! $error) - { - $db->commit(); - - $filemaster=$pathofwebsite.'/master.inc.php'; - //$fileoldalias=$pathofwebsite.'/'.$objectpage->old_object->pageurl.'.php'; - $filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php'; - - dol_mkdir($pathofwebsite); - - - // Now generate the master.inc.php page - dol_syslog("We regenerate the master file"); - dol_delete_file($filemaster); - - $mastercontent = ''."\n"; - $result = file_put_contents($filemaster, $mastercontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); - - if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); - - - // Now generate the alias.php page - if (! empty($fileoldalias)) - { - dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias); - dol_delete_file($fileoldalias); - } + $db->begin(); - $aliascontent = 'id.".tpl.php';\n"; - $aliascontent.= '?>'."\n"; - $result = file_put_contents($filealias, $aliascontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filealias, octdec($conf->global->MAIN_UMASK)); - - if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); - - - // Now create the .tpl file with code to be able to make dynamic changes - dol_delete_file($filetpl); - - $tplcontent =''; - $tplcontent.= "\n"; - $tplcontent.= ''."\n"; - $tplcontent.= '
    '."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''."\n"; - $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n"; - $tplcontent.= '
    '."\n"; - - $tplcontent.= ''."\n"; - $tplcontent.= $objectpage->content."\n"; - $tplcontent.= ''."\n"; - - $tplcontent.= '"."\n"; - - //var_dump($filetpl);exit; - $result = file_put_contents($filetpl, $tplcontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); - - if ($result) - { - setEventMessages($langs->trans("Saved"), null, 'mesgs'); - header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); - exit; - } - else setEventMessages('Failed to write file '.$filetpl, null, 'errors'); - } - else - { - $db->rollback(); - } + $objectpage->content = GETPOST('PAGE_CONTENT'); + + // Clean data. We remove all the head section. + $objectpage->content = preg_replace('//s', '', $objectpage->content); + /* $objectpage->content = preg_replace('//s', '', $objectpage->content); */ + + $res = $objectpage->update($user); + if ($res < 0) + { + $error++; + setEventMessages($objectpage->error, $objectpage->errors, 'errors'); + } + + if (! $error) + { + $db->commit(); + + $filemaster=$pathofwebsite.'/master.inc.php'; + //$fileoldalias=$pathofwebsite.'/'.$objectpage->old_object->pageurl.'.php'; + $filealias=$pathofwebsite.'/'.$objectpage->pageurl.'.php'; + + dol_mkdir($pathofwebsite); + + + // Now generate the master.inc.php page + dol_syslog("We regenerate the master file"); + dol_delete_file($filemaster); + + $mastercontent = ''."\n"; + $result = file_put_contents($filemaster, $mastercontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filemaster, octdec($conf->global->MAIN_UMASK)); + + if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); + + + // Now generate the alias.php page + if (! empty($fileoldalias)) + { + dol_syslog("We regenerate alias page new name=".$filealias.", old name=".$fileoldalias); + dol_delete_file($fileoldalias); + } + + $aliascontent = 'id.".tpl.php';\n"; + $aliascontent.= '?>'."\n"; + $result = file_put_contents($filealias, $aliascontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filealias, octdec($conf->global->MAIN_UMASK)); + + if (! $result) setEventMessages('Failed to write file '.$filealias, null, 'errors'); + + + // Now create the .tpl file with code to be able to make dynamic changes + dol_delete_file($filetpl); + + $tplcontent =''; + $tplcontent.= "\n"; + $tplcontent.= ''."\n"; + $tplcontent.= '
    '."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''."\n"; + $tplcontent.= ''.dol_escape_htmltag($objectpage->title).''."\n"; + $tplcontent.= '
    '."\n"; + + $tplcontent.= ''."\n"; + $tplcontent.= $objectpage->content."\n"; + $tplcontent.= ''."\n"; + + $tplcontent.= '"."\n"; + + //var_dump($filetpl);exit; + $result = file_put_contents($filetpl, $tplcontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filetpl, octdec($conf->global->MAIN_UMASK)); + + if ($result) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + exit; + } + else + { + setEventMessages('Failed to write file '.$filetpl, null, 'errors'); + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + exit; + } + } + else + { + $db->rollback(); + } + } + else + { + header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website.'&pageid='.$pageid); + exit; + } } else { @@ -603,7 +636,7 @@ if ($action == 'edit') $style=''; if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5px;'; - +//var_dump($objectpage);exit; print '
    '; if (count($object->records) > 0) @@ -617,7 +650,7 @@ if (count($object->records) > 0) // List of websites print '
    '; $out=''; - $out.=''; if (empty($object->records)) $out.=''; // Loop on each sites $i=0; @@ -639,9 +672,9 @@ if (count($object->records) > 0) if ($website) { - $realurl=$urlwithroot.'/public/websites/index.php?website='.$website; + $virtualurl=''; $dataroot=DOL_DATA_ROOT.'/websites/'.$website; - if (! empty($object->virtualhost)) $realurl=$object->virtualhost; + if (! empty($object->virtualhost)) $virtualurl=$object->virtualhost; } if ($website && $action == 'preview') @@ -665,20 +698,23 @@ if (count($object->records) > 0) if ($action == 'preview') { print '
    '; - print ''; + print ''; //print ''; $htmltext=$langs->trans("SetHereVirtualHost", $dataroot); print $form->textwithpicto('', $htmltext); print '
    '; - $urlext=$realurl; - $urlint=DOL_URL_ROOT.'/public/websites/index.php?website='.$website; - print ''; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlext), 1, 'preview_ext'); - print ''; + $urlext=$virtualurl; + $urlint=$urlwithroot.'/public/websites/index.php?website='.$website; + //if (! empty($object->virtualhost)) + //{ + print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); + print ''; + //} - print ''; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlint), 1, 'preview'); + print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot), 1, 'preview'); print ''; } @@ -788,13 +824,22 @@ if (count($object->records) > 0) print $form->textwithpicto('', $htmltext); print '
    '; - $urlext=$realurl.'/'.$pagealias.'.php'; - print ''; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $urlext), 1, 'preview_ext'); - print ''; + if (! empty($object->virtualhost)) + { + $urlext=$virtualurl.'/'.$pagealias.'.php'; + print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); + print ''; + } + else + { + print ''; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $dataroot, $urlext?$urlext:$langs->trans("VirtualHostUrlNotDefined")), 1, 'preview_ext'); + print ''; + } - print ''; - print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage), 1, 'preview'); + print 'transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage)).'">'; + print $form->textwithpicto('', $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Page"), $langs->transnoentitiesnoconv("Page"), $realpage, $dataroot), 1, 'preview'); print ''; // View page in new Tab //print ''; diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 2116d51e65b..ad70190b689 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -262,7 +262,7 @@ if ($resql) $totalbefore = $total; $total = $total + $objp->amount; - $var=!$var; + // Date operation $dateop=$db->jdate($objp->do); diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index fb8612977a8..27cc22448e6 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -189,6 +189,7 @@ if ($resql) $substitutionisok=true; // Fabrication du mail + $trackid='emailing-'.$obj2->source_type.$obj2->source_id; $mail = new CMailFile( $newsubject, $sendto, @@ -201,7 +202,11 @@ if ($resql) '', 0, $msgishtml, - $errorsto + $errorsto, + '', + $trackid, + '', + 'emailing' ); if ($mail->error) diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 2dfdf4cb5c2..99f9faf260d 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -176,6 +176,9 @@ class AllTests $suite->addTestSuite('ChargeSocialesTest'); require_once dirname(__FILE__).'/HolidayTest.php'; $suite->addTestSuite('HolidayTest'); + require_once dirname(__FILE__).'/ExpenseReportTest.php'; + $suite->addTestSuite('ExpenseReportTest'); + require_once dirname(__FILE__).'/EntrepotTest.php'; $suite->addTestSuite('EntrepotTest'); require_once dirname(__FILE__).'/MouvementStockTest.php'; diff --git a/test/phpunit/CommandeFournisseurTest.php b/test/phpunit/CommandeFournisseurTest.php index 03880a56eca..2d615e0bd06 100644 --- a/test/phpunit/CommandeFournisseurTest.php +++ b/test/phpunit/CommandeFournisseurTest.php @@ -264,7 +264,7 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase * @param Object $localobject Supplier order * @return void * - * @depends testCommandeFournisseurValid + * @depends testCommandeFournisseurApprove * The depends says test is run only if previous is ok */ public function testCommandeFournisseurCancel($localobject) diff --git a/test/phpunit/ExpenseReportTest.php b/test/phpunit/ExpenseReportTest.php new file mode 100644 index 00000000000..b9af3dc1078 --- /dev/null +++ b/test/phpunit/ExpenseReportTest.php @@ -0,0 +1,316 @@ + + * + * 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 . + * or see http://www.gnu.org/ + */ + +/** + * \file test/phpunit/ExpenseReportTest.php + * \ingroup test + * \brief PHPUnit test + * \remarks To run this script as CLI: phpunit filename.php + */ + +global $conf,$user,$langs,$db; +//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver +//require_once 'PHPUnit/Autoload.php'; +require_once dirname(__FILE__).'/../../htdocs/master.inc.php'; +require_once dirname(__FILE__).'/../../htdocs/expensereport/class/expensereport.class.php'; + +if (empty($user->id)) { + print "Load permissions for admin user nb 1\n"; + $user->fetch(1); + $user->getrights(); +} +$conf->global->MAIN_DISABLE_ALL_MAILS=1; + + + +/** + * Class for PHPUnit tests + * + * @backupGlobals disabled + * @backupStaticAttributes enabled + * @remarks backupGlobals must be disabled to have db,conf,user and lang not erased. + */ +class ExpenseReportTest extends PHPUnit_Framework_TestCase +{ + protected $savconf; + protected $savuser; + protected $savlangs; + protected $savdb; + + /** + * Constructor + * We save global variables into local variables + * + * @return ExpenseReportTest + */ + function __construct() + { + //$this->sharedFixture + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + print __METHOD__." db->type=".$db->type." user->id=".$user->id; + //print " - db ".$db->db; + print "\n"; + } + + // Static methods + public static function setUpBeforeClass() + { + global $conf,$user,$langs,$db; + $db->begin(); // This is to have all actions inside a transaction even if test launched without suite. + + print __METHOD__."\n"; + } + + // tear down after class + public static function tearDownAfterClass() + { + global $conf,$user,$langs,$db; + $db->rollback(); + + print __METHOD__."\n"; + } + + /** + * Init phpunit tests + * + * @return void + */ + protected function setUp() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + print __METHOD__."\n"; + //print $db->getVersion()."\n"; + } + /** + * End phpunit tests + * + * @return void + */ + protected function tearDown() + { + print __METHOD__."\n"; + } + + /** + * testExpenseReportCreate + * + * @return void + */ + public function testExpenseReportCreate() + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + // Set supplier and product to use + $socid=1; + + // Create supplier order with a too low quantity + $localobject=new ExpenseReport($db); + $localobject->initAsSpecimen(); // Init a speciment with lines + $localobject->status = 0; + $localobject->fk_statut = 0; + $localobject->date_fin = null; // Force bad value + + $result=$localobject->create($user); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(-1, $result); // must be -1 because of missing mandatory fields + + $sql="DELETE FROM ".MAIN_DB_PREFIX."expensereport where ref=''"; + $db->query($sql); + + // Create supplier order + $localobject2=new ExpenseReport($db); + $localobject2->initAsSpecimen(); // Init a speciment with lines + $localobject2->status = 0; + $localobject2->fk_statut = 0; + + $result=$localobject2->create($user); + print __METHOD__." result=".$result."\n"; + $this->assertGreaterThanOrEqual(0, $result); + + return $result; + } + + + /** + * testExpenseReportFetch + * + * @param int $id Id of supplier order + * @return void + * + * @depends testExpenseReportCreate + * The depends says test is run only if previous is ok + */ + public function testExpenseReportFetch($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new ExpenseReport($this->savdb); + $result=$localobject->fetch($id); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testExpenseReportValid + * + * @param Object $localobject Supplier order + * @return void + * + * @depends testExpenseReportFetch + * The depends says test is run only if previous is ok + */ + public function testExpenseReportValid($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->setValidate($user); + + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testExpenseReportApprove + * + * @param Object $localobject Supplier order + * @return void + * + * @depends testExpenseReportValid + * The depends says test is run only if previous is ok + */ + public function testExpenseReportApprove($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->setApproved($user); + + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testExpenseReportCancel + * + * @param Object $localobject Supplier order + * @return void + * + * @depends testExpenseReportApprove + * The depends says test is run only if previous is ok + */ + public function testExpenseReportCancel($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $result=$localobject->set_cancel($user, 'Because...'); + + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $localobject; + } + + /** + * testExpenseReportOther + * + * @param Object $localobject Supplier order + * @return void + * + * @depends testExpenseReportCancel + * The depends says test is run only if previous is ok + */ + public function testExpenseReportOther($localobject) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + /*$result=$localobject->setstatus(0); + print __METHOD__." id=".$localobject->id." result=".$result."\n"; + $this->assertLessThan($result, 0); + */ + + /*$localobject->info($localobject->id); + print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n"; + $this->assertNotEquals($localobject->date_creation, ''); + */ + + return $localobject->id; + } + + /** + * testExpenseReportDelete + * + * @param int $id Id of order + * @return void + * + * @depends testExpenseReportOther + * The depends says test is run only if previous is ok + */ + public function testExpenseReportDelete($id) + { + global $conf,$user,$langs,$db; + $conf=$this->savconf; + $user=$this->savuser; + $langs=$this->savlangs; + $db=$this->savdb; + + $localobject=new ExpenseReport($this->savdb); + $result=$localobject->fetch($id); + $result=$localobject->delete($user); + + print __METHOD__." id=".$id." result=".$result."\n"; + $this->assertLessThan($result, 0); + return $result; + } + +} diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index 199d397f50d..7985e8f0931 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -1,5 +1,6 @@ + * Copyright (C) 2017 Juanjo Menent * * 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 @@ -259,7 +260,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase $localobject=new FactureFournisseur($this->savdb); $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index a53f971904c..28e55fd793b 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -712,15 +712,15 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $s=img_picto('title','/fullpath/img.png','',1); print __METHOD__." s=".$s."\n"; - $this->assertEquals('',$s,'testImgPicto3'); + $this->assertEquals('',$s,'testImgPicto3'); $s=img_picto('title','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; - $this->assertEquals('',$s,'testImgPicto4'); + $this->assertEquals('',$s,'testImgPicto4'); $s=img_picto('title:alt','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; - $this->assertEquals('alt',$s,'testImgPicto5'); + $this->assertEquals('alt',$s,'testImgPicto5'); } /** diff --git a/test/phpunit/ProductTest.php b/test/phpunit/ProductTest.php index 199aace802c..87f290593f0 100644 --- a/test/phpunit/ProductTest.php +++ b/test/phpunit/ProductTest.php @@ -232,7 +232,7 @@ class ProductTest extends PHPUnit_Framework_TestCase $localobject=new Product($this->savdb); $result=$localobject->fetch($id); - $result=$localobject->delete($id); + $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; $this->assertLessThan($result, 0);