diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 690b00211f7..02d21453a3a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -6,7 +6,7 @@ Bug reports and feature requests *Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). -Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues). +Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues). 1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem. 2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request. diff --git a/COPYRIGHT b/COPYRIGHT index f55772c0d9f..6f8a595897d 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -22,6 +22,7 @@ Mobiledetect 2.8.17 MIT License Yes NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package) PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency odtPHP 1.0.1 GPL-2+ b Yes Library to build/edit ODT files +ParseDown 1.6 MIT License Yes Markdown parser PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service diff --git a/ChangeLog b/ChangeLog index 85928619cc5..31ddbd56bdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,8 +9,34 @@ WARNING: Following changes may create regression for some external modules, but were necessary to make Dolibarr better: * The hook getNodeList has been replaced by a normalized 'addreplace' hook getDirList. * 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. @@ -163,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/README.md b/README.md index cf2de36b81d..eda6b8b642e 100644 --- a/README.md +++ b/README.md @@ -91,14 +91,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Standing orders management (European SEPA) - Bank accounts management - Shared calendar/agenda (with ical and vcal export for third party tools integration) -- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...) +- Opportunities and/or project management - Projects management - Contracts management - Stock management - Shipping management - Interventions management - Employee's leave requests management -- Expense report management +- Expense reports +- Timesheets - Electronic Document Management (EDM) - Foundations members management - Mass emailing 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/generate_filelist_xml.php b/build/generate_filelist_xml.php index ff580fad58c..c1a56beacd7 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -40,6 +40,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); * Main */ +$includecustom=0; $includeconstants=array(); if (empty($argv[1])) @@ -67,8 +68,6 @@ while ($i < $argc) if (empty($includecustom)) { - $includecustom=0; - if (DOL_VERSION != $release) { print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$release.')'."\n"; @@ -80,7 +79,7 @@ else { if (! preg_match('/'.preg_quote(DOL_VERSION,'/').'-/',$release)) { - print 'Error: When parameter "includecustom" is not set, version declared into ('.DOL_VERSION.') must be used with a suffix into "release" parmater (ex: '.DOL_VERSION.'-mydistrib).'."\n"; + print 'Error: When parameter "includecustom" is set, version declared into filefunc.inc.php ('.DOL_VERSION.') must be used with a suffix into "release" parmater (ex: '.DOL_VERSION.'-mydistrib).'."\n"; print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n"; exit -1; } @@ -124,16 +123,21 @@ foreach ($includeconstants as $countrycode => $tmp) fputs($fp, ''."\n"); -// TODO Replace RecursiveDirectoryIterator with dol_dir_list -$dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/'); +/*$dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/'); $iterator1 = new RecursiveIteratorIterator($dir_iterator1); // Need to ignore document custom etc. Note: this also ignore natively symbolic links. $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); +*/ +$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; +$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs +$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $dir=''; $needtoclose=0; -foreach ($files as $file) { - $newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); - if ($newdir!=$dir) { +foreach ($files as $filetmp) { + $file = $filetmp['fullname']; + //$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); + $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); + if ($newdir!=$dir) { if ($needtoclose) fputs($fp, ' '."\n"); fputs($fp, ' '."\n"); @@ -161,14 +165,21 @@ $checksumconcat=array(); fputs($fp, ''."\n"); // TODO Replace RecursiveDirectoryIterator with dol_dir_list -$dir_iterator2 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../scripts/'); +/*$dir_iterator2 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../scripts/'); $iterator2 = new RecursiveIteratorIterator($dir_iterator2); // Need to ignore document custom etc. Note: this also ignore natively symbolic links. $files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); +*/ +$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$'; +$regextoexclude='(custom|documents|conf|install)$'; // Exclude dirs +$files = dol_dir_list(dirname(__FILE__).'/../scripts/', 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $dir=''; $needtoclose=0; -foreach ($files as $file) { - $newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); +foreach ($files as $filetmp) { + $file = $filetmp['fullname']; + //$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); + $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); + $newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file)); if ($newdir!=$dir) { if ($needtoclose) fputs($fp, ' '."\n"); 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..d2b039a28e0 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -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 ''; print ""; - if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates') - { - print ''; - } - $colspan=count($fieldlist)+3; - if ($id == 4) $colspan++; if (! empty($alabelisused)) // If there is one label among fields, we show legend of * { @@ -833,7 +806,7 @@ if ($id) print ''; // Title line with search boxes - print ''; + print ''; $filterfound=0; foreach ($fieldlist as $field => $value) { @@ -858,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'; @@ -887,7 +860,9 @@ if ($id) // Show fields if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit'); - print ''; + print ''; + print ''; } elseif ($fieldlist[$field] == 'country_id') diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 1c49b65bac8..4b733bee5a6 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -39,6 +39,7 @@ $langs->load("bills"); $langs->load("admin"); $langs->load("accountancy"); $langs->load("salaries"); +$langs->load("loan"); // Security check if (! empty($user->rights->accountancy->chartofaccount)) @@ -134,9 +135,8 @@ print ''; 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 696475720ec..0580a9688ed 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -628,12 +628,6 @@ if ($id) if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } - if ($id == 2) // Special cas for state page - { - if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } - if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; } - } - if ($valuetoshow != '') { print ''; @@ -675,36 +669,15 @@ if ($id) if (empty($reshook)) { - if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit') - { - fieldList($fieldlist,$obj,$tabname[$id],'hide'); - } - else - { - fieldList($fieldlist,$obj,$tabname[$id],'add'); - } + fieldList($fieldlist,$obj,$tabname[$id],'add'); } print ''; - if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit') - { - print ''; - } + print ''; print '
* '.$langs->trans("AvailableVariables").": "; - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); - $tmp=$formmail->getAvailableSubstitKey('form'); - print implode(', ', $tmp); - print '
'; + print ''; if ($filterfound) { $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; } print '
'; + print ''; print ''; print ''; print ''; @@ -1175,7 +1150,7 @@ $db->close(); function fieldList($fieldlist, $obj='', $tabname='', $context='') { global $conf,$langs,$db; - global $form; + global $form, $mysoc; global $region_id; global $elementList,$sourceList,$localtax_typeList; global $bc; @@ -1197,7 +1172,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } // For state page, we do not show the country input (we link to region, not country) print ''; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); 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..f7bbbb97969 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -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 ''; print $objp->accounting; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8f023432727..3ea77a24b43 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -87,7 +87,8 @@ if ($action == 'update') { setEventMessages($langs->trans("Error"), null, 'errors'); } - foreach ($list as $constname) { + foreach ($list as $constname) + { $constvalue = GETPOST($constname, 'alpha'); if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { @@ -141,18 +142,17 @@ if ($action == 'setmanagezero') { } if ($action == 'setdisabledirectinput') { - $setdisabledirectinput = GETPOST('value', 'int'); - $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); - if (! $res > 0) - $error ++; - if (! $error) { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("Error"), null, 'mesgs'); - } + $setdisabledirectinput = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); + if (! $res > 0) + $error ++; + if (! $error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'mesgs'); + } } - /* * View */ @@ -214,8 +214,7 @@ print "\n"; if (! empty($user->admin)) { // TO DO Mutualize code for yes/no constants - $var = ! $var; - print ""; + print ''; print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_TODO") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO)) { print ''; @@ -228,8 +227,7 @@ if (! empty($user->admin)) } print ''; - $var = ! $var; - print ""; + print ''; print '' . $langs->trans("ACCOUNTING_LIST_SORT_VENTILATION_DONE") . ''; if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) { print ''; @@ -242,22 +240,20 @@ if (! empty($user->admin)) } print ''; - $var = ! $var; - print ""; - print '' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; - if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - print ''; - print img_picto($langs->trans("Activated"), 'switch_on'); - print ''; - } else { - print ''; - print img_picto($langs->trans("Disabled"), 'switch_off'); - print ''; - } - print ''; - - $var = ! $var; - print ""; + print ''; + print '' . $langs->trans("BANK_DISABLE_DIRECT_INPUT") . ''; + if (! empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); + print ''; + } else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); + print ''; + } + print ''; + + print ''; print '' . $langs->trans("ACCOUNTING_MANAGE_ZERO") . ''; if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) { print ''; @@ -275,16 +271,18 @@ if (! empty($user->admin)) // Param a user $user->rights->accountancy->chartofaccount can access foreach ($list as $key) { - $var = ! $var; + print ''; + + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; - print ''; // Param $label = $langs->trans($key); print ''.$label.''; // Value print ''; - print ''; + print ''; print ''; + print ''; } @@ -301,7 +299,7 @@ print '
transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")); +print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$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 '' . $langs->trans('Journaux') . ''; 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 '
' . $langs->trans("BackToModuleList") . ''; +print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); + +$head = admin_accounting_prepare_head(null); + +dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron'); + +$sql = "SELECT j.rowid, j.code, j.label, j.nature, j.active"; +$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_journal as j"; +// $sql .= " WHERE j.entity = " . $conf->entity; +$sql.=$db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); + +$result = $db->query($sql); +if ($result) { + $num = $db->num_rows($result); + + $i = 0; + + // $title = $langs->trans('AccountingJournals'); + // print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 1); + + // Load attribute_label + print ''; + print ''; + // print ''; + print ''; + print ''; + print ''; + print ''; + + if ($num) { + $accountingjournalstatic = new AccountingJournal($db); + + while ( $i < $num && $i < $max ) { + $obj = $db->fetch_object($result); + $accountingjournalstatic->id = $obj->rowid; + print ''; + print ''; + print ''; + print ''; + print ''; + $i ++; + } + } else { + print ''; + } + print '
' . $langs->trans("Ref") . '' . $langs->trans("Code") . '' . $langs->trans("Label") . '' . $langs->trans("Nature") . '
' . img_object($langs->trans("ShowJournal"), "technic") . ' ' . $obj->code . '' . $obj->label . '' . $accountingjournalstatic->LibType($obj->nature, 0) . '
' . $langs->trans("None") . '
'; +} else { + dol_print_error($db); +} + +dol_fiche_end(); + +// Buttons +print '
'; +if (! empty($user->rights->accounting->fiscalyear)) +{ + print '' . $langs->trans("NewAccountingJournal") . ''; +} +else +{ + print '' . $langs->trans("NewAccountingJournal") . ''; +} +print '
'; + +llxFooter(); +$db->close(); \ No newline at end of file diff --git a/htdocs/accountancy/admin/journals_card.php b/htdocs/accountancy/admin/journals_card.php new file mode 100644 index 00000000000..9e04d75ce9f --- /dev/null +++ b/htdocs/accountancy/admin/journals_card.php @@ -0,0 +1,294 @@ + + * + * 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/accountancy/admin/journals_card.php + * \ingroup Advanced accountancy + * \brief Page to show an accounting journal + */ +require '../../main.inc.php'; + +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; + +$langs->load("admin"); +$langs->load("compta"); +$langs->load("accountancy"); + +// Security check +if ($user->societe_id > 0) + accessforbidden(); +if (empty($user->rights->accounting->fiscalyear)) + accessforbidden(); + +$error = 0; + +$action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$id = GETPOST('id', 'int'); + +// List of status +static $tmptype2label = array ( + '0' => 'AccountingJournalTypeVariousOperation', + '1' => 'AccountingJournalTypeSale', + '2' => 'AccountingJournalTypePurchase', + '3' => 'AccountingJournalTypeBank', + '9' => 'AccountingJournalTypeHasNew' +); +$type2label = array ( + '' +); +foreach ( $tmptype2label as $key => $val ) + $type2label[$key] = $langs->trans($val); + +$object = new AccountingJournal($db); + +/* + * Actions + */ + +if ($action == 'confirm_delete' && $confirm == "yes") { + $result = $object->delete($id); + if ($result >= 0) { + header("Location: journals.php"); + exit(); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } +} + +else if ($action == 'add') { + if (! GETPOST('cancel', 'alpha')) { + $error = 0; + + $object->code = GETPOST('code', 'alpha'); + $object->label = GETPOST('label', 'alpha'); + $object->nature = GETPOST('nature', 'int'); + + if (empty($object->code)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Code")), null, 'errors'); + $error ++; + } + if (empty($object->label)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + $error ++; + } + + if (! $error) { + $db->begin(); + + $id = $object->create($user); + + if ($id > 0) { + $db->commit(); + + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit(); + } else { + $db->rollback(); + + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create'; + } + } else { + $action = 'create'; + } + } else { + header("Location: ./journals.php"); + exit(); + } +} + +// Update record +else if ($action == 'update') { + if (! GETPOST('cancel', 'alpha')) { + $result = $object->fetch($id); + + $object->code = GETPOST('code', 'alpha'); + $object->label = GETPOST('label', 'alpha'); + $object->nature = GETPOST('nature', 'int'); + + if (empty($object->code)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Code")), null, 'errors'); + $error ++; + } + if (empty($object->label)) { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + $error ++; + } + + $result = $object->update($user); + + if ($result > 0) { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit(); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); + exit(); + } +} + + + +/* + * View + */ + +$title = $langs->trans("Journal") . " - " . $langs->trans("Card"); +$helpurl = ""; +llxHeader("",$title,$helpurl); + +$form = new Form($db); + +if ($action == 'create') +{ + print load_fiche_titre($langs->trans("NewAccountingJournal")); + + print '
'; + print ''; + print ''; + + dol_fiche_head(); + + print ''; + + // Code + print ''; + + + // Label + print ''; + + // Nature + print ''; + print ''; + print ''; + + print '
' . $langs->trans("Code") . '
' . $langs->trans("Label") . '
' . $langs->trans("Type") . ''; + print $form->selectarray('nature', $type2label, GETPOST('nature')); + print '
'; + + dol_fiche_end(); + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; +} else if ($id) { + $result = $object->fetch($id); + if ($result > 0) { + $head = accounting_journal_prepare_head($object); + + if ($action == 'edit') { + dol_fiche_head($head, 'card', $langs->trans("AccountingJournal"), 0, 'cron'); + + print '
' . "\n"; + print ''; + print ''; + print ''; + + print ''; + + // Code + print ""; + print ''; + + // Label + print ''; + + // Nature + print ''; + + print '
' . $langs->trans("Code") . ''; + print ''; + print '
' . $langs->trans("Label") . ''; + print ''; + print '
' . $langs->trans("Type") . ''; + print $form->selectarray('nature', $type2label, $object->nature); + print '
'; + + print '
'; + print ''; + print '     '; + print ''; + print '
'; + + print '
'; + + dol_fiche_end(); + } else { + /* + * Confirm delete + */ + if ($action == 'delete') { + print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete"); + } + + dol_fiche_head($head, 'card', $langs->trans("AccountingJournal"), 0, 'cron'); + + print ''; + + $linkback = '' . $langs->trans("BackToList") . ''; + + // Ref + print ''; + + // Label + print '"; + + // Nature + print ''; + + print "
' . $langs->trans("Code") . ''; + print $object->code; + print ''; + print $linkback; + print '
'; + print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); + print ''; + print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); + print "
' . $langs->trans("Type") . '' . $object->getLibType(0) . '
"; + + dol_fiche_end(); + + if (! empty($user->rights->accounting->fiscalyear)) + { + /* + * Barre d'actions + */ + print '
'; + + print '' . $langs->trans('Modify') . ''; + + print '' . $langs->trans('Delete') . ''; + + print '
'; + } + } + } else { + dol_print_error($db); + } +} + +llxFooter(); +$db->close(); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index cae9295229b..dda7d545043 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -312,22 +312,8 @@ if ($result) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); print ''; - print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); - if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("OnSell"), $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("OnBuy"), $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder); - if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { - $fieldtosortaccount="p.accountancy_code_buy"; - } - else $fieldtosortaccount="p.accountancy_code_sell"; - print_liste_field_titre($langs->trans("CurrentDedicatedAccountingAccount"), $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AssignDedicatedAccountingAccount")); - print_liste_field_titre('', '', '', '', '', 'align="center"'); - print ''; - - print ''; + + print ''; print ''; print ''; if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print ''; @@ -342,12 +328,28 @@ if ($result) print ' '.$langs->trans("or").' '.$form->selectarray('search_current_account_valid', $listofvals, $search_current_account_valid, 1); print ''; print ''; - print ''; print ''; + print ''; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("OnSell"), $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("OnBuy"), $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder); + if ($accounting_product_mode == 'ACCOUNTANCY_BUY') { + $fieldtosortaccount="p.accountancy_code_buy"; + } + else $fieldtosortaccount="p.accountancy_code_sell"; + print_liste_field_titre($langs->trans("CurrentDedicatedAccountingAccount"), $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("AssignDedicatedAccountingAccount")); + $clickpitco=$form->showCheckAddButtons('checkforselect', 1); + print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"'); + print ''; + $product_static = new Product($db); $var = true; @@ -381,8 +383,7 @@ if ($result) $compta_prodbuy_id = $aarowid_servbuy; } - $var = ! $var; - print ''; + print ''; print ''; print ""; $i ++; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 8f6fab3ec3f..5f4801da32c 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -182,6 +182,22 @@ else { } print '
 '; - $searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1); + print ''; + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
'; print $product_static->getNomUrl(1); @@ -440,7 +441,7 @@ if ($result) } // Checkbox select - print ''; + print ''; print '
'; + + print ''; + print ''; + print ''; + + print ''; + print ''; print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder); @@ -191,28 +207,6 @@ else { print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; - print ''; - print ''; - - print ''; - print ''; - print ''; - - print ''; - - print ''; - - $var = True; - $total_debit = 0; $total_credit = 0; $sous_total_debit = 0; @@ -220,7 +214,6 @@ else { $displayed_account = ""; foreach ($object->lines as $line) { - $var = ! $var; $link = ''; $total_debit += $line->debit; $total_credit += $line->credit; @@ -229,7 +222,7 @@ else { if (empty($description)) { $link = '' . img_edit_add() . ''; } - print ''; + print ''; // Permet d'afficher le compte comptable if ($root_account_description != $displayed_account) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ae38233afac..9cd649ce4be 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -371,20 +371,8 @@ print ''; -print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); -print "\n"; -print ''; +print ''; print ''; print ''; print ''; print ''; print ''; print ''; -$var = True; +print ''; +print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_compte", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder); +$checkpicto=''; +if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); +print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); +print "\n"; + $total_debit = 0; $total_credit = 0; @@ -431,7 +433,7 @@ foreach ($object->lines as $line ) { $total_debit += $line->debit; $total_credit += $line->credit; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index aee7d7172c6..4174ee7809f 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -369,22 +369,23 @@ class AccountingAccount extends CommonObject */ function getNomUrl($withpicto = 0) { global $langs; - + $result = ''; - + $link = ''; $linkend = ''; - + $picto = 'billr'; - + $label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label; - + if ($withpicto) $result .= ($link . img_object($label, $picto) . $linkend); if ($withpicto && $withpicto != 2) $result .= ' '; if ($withpicto != 2) - $result .= $link . $this->account_number . $linkend; + require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; + $result .= $link . length_accountg($this->account_number) . ' - ' . $this->label . $linkend; return $result; } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php new file mode 100644 index 00000000000..d7cc61d6418 --- /dev/null +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -0,0 +1,414 @@ + + * + * 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/accountancy/class/accountingjournal.class.php + * \ingroup Advanced accountancy + * \brief File of class to manage accounting journals + */ + +/** + * Class to manage accounting accounts + */ +class AccountingJournal extends CommonObject +{ + public $element='accounting_journal'; + public $table_element='accounting_journal'; + public $fk_element = ''; + protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + + var $rowid; + + var $code; + var $label; + var $nature; // 0:various operations, 1:sale, 2:purchase, 3:bank, 9: has-new + var $active; + + /** + * Constructor + * + * @param DoliDB $db Database handle + */ + function __construct($db) { + $this->db = $db; + } + + /** + * Load an object from database + * + * @param int $id Id of record to load + * @return int <0 if KO, >0 if OK + */ + function fetch($id) + { + $sql = "SELECT rowid, code, label, nature, active"; + $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal"; + $sql.= " WHERE rowid = ".$id; + + dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + if ( $result ) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->rowid; + + $this->code = $obj->code; + $this->ref = $obj->code; + $this->label = $obj->label; + $this->nature = $obj->nature; + $this->active = $obj->active; + + return 1; + } + else + { + $this->error=$this->db->lasterror(); + return -1; + } + } + + /** + * Insert journal in database + * + * @param User $user Use making action + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK + */ + function create($user, $notrigger = 0) + { + global $conf; + $error = 0; + $now = dol_now(); + + // Clean parameters + if (isset($this->code)) + $this->code = trim($this->code); + if (isset($this->label)) + $this->label = trim($this->label); + + // Check parameters + if (empty($this->nature) || $this->nature == '-1') + { + $this->nature = '0'; + } + + // Insert request + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_journal("; + $sql .= "code"; + $sql .= ", label"; + $sql .= ", nature"; + $sql .= ", active"; + $sql .= ") VALUES ("; + $sql .= " " . (empty($this->code) ? 'NULL' : "'" . $this->db->escape($this->code) . "'"); + $sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'"); + $sql .= ", " . (empty($this->nature) ? '0' : "'" . $this->db->escape($this->nature) . "'"); + $sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active)); + $sql .= ")"; + + $this->db->begin(); + + dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if (! $resql) { + $error ++; + $this->errors[] = "Error " . $this->db->lasterror(); + } + + if (! $error) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_journal"); + + // if (! $notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + // // Call triggers + // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + // $interface=new Interfaces($this->db); + // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); + // if ($result < 0) { $error++; $this->errors=$interface->errors; } + // // End call triggers + // } + } + + // Commit or rollback + if ($error) { + foreach ( $this->errors as $errmsg ) { + dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + $this->db->rollback(); + return - 1 * $error; + } else { + $this->db->commit(); + return $this->id; + } + } + + /** + * Update record + * + * @param User $user Use making update + * @return int <0 if KO, >0 if OK + */ + function update($user) + { + // Check parameters + if (empty($this->nature) || $this->nature == '-1') + { + $this->nature = '0'; + } + + $this->db->begin(); + + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal "; + $sql .= " SET code = " . ($this->code ? "'" . $this->db->escape($this->code) . "'" : "null"); + $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null"); + $sql .= " , nature = " . ($this->nature ? "'" . $this->db->escape($this->nature) . "'" : "0"); + $sql .= " , active = '" . $this->active . "'"; + $sql .= " WHERE rowid = " . $this->id; + + dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return - 1; + } + } + + /** + * Check usage of accounting journal + * + * @return int <0 if KO, >0 if OK + */ + function checkUsage() { + global $langs; + + $sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet"; + $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; + $sql .= "UNION"; + $sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sql .= " WHERE fk_code_ventilation=" . $this->id . ")"; + + dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG); + $resql = $this->db->query($sql); + + if ($resql) { + $num = $this->db->num_rows($resql); + if ($num > 0) { + $this->error = $langs->trans('ErrorAccountingJournalIsAlreadyUse'); + return 0; + } else { + return 1; + } + } else { + $this->error = $this->db->lasterror(); + return - 1; + } + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param int $notrigger 0=triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + function delete($user, $notrigger = 0) { + $error = 0; + + $result = $this->checkUsage(); + + if ($result > 0) { + + $this->db->begin(); + + // if (! $error) { + // if (! $notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + // // Call triggers + // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + // $interface=new Interfaces($this->db); + // $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf); + // if ($result < 0) { $error++; $this->errors=$interface->errors; } + // // End call triggers + // } + // } + + if (! $error) { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_journal"; + $sql .= " WHERE rowid=" . $this->id; + + dol_syslog(get_class($this) . "::delete sql=" . $sql); + $resql = $this->db->query($sql); + if (! $resql) { + $error ++; + $this->errors[] = "Error " . $this->db->lasterror(); + } + } + + // Commit or rollback + if ($error) { + foreach ( $this->errors as $errmsg ) { + dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR); + $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); + } + $this->db->rollback(); + return - 1 * $error; + } else { + $this->db->commit(); + return 1; + } + } else { + return - 1; + } + } + + /** + * Return clicable name (with picto eventually) + * + * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto + * @return string Chaine avec URL + */ + function getNomUrl($withpicto = 0) { + global $langs; + + $result = ''; + + $link = ''; + $linkend = ''; + + $picto = 'billr'; + + $label = $langs->trans("Show") . ': ' . $this->code . ' - ' . $this->label; + + if ($withpicto) + $result .= ($link . img_object($label, $picto) . $linkend); + if ($withpicto && $withpicto != 2) + $result .= ' '; + if ($withpicto != 2) + $result .= $link . $this->code . ' - ' . $this->label . $linkend; + return $result; + } + + /** + * Deactivate journal + * + * @param int $id Id + * @return int <0 if KO, >0 if OK + */ + function journal_deactivate($id) { + $result = $this->checkUsage(); + + if ($result > 0) { + $this->db->begin(); + + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal "; + $sql .= "SET active = '0'"; + $sql .= " WHERE rowid = " . $this->db->escape($id); + + dol_syslog(get_class($this) . "::deactivate sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + + if ($result) { + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return - 1; + } + } else { + return - 1; + } + } + + /** + * Activate journal + * + * @param int $id Id + * @return int <0 if KO, >0 if OK + */ + function journal_activate($id) { + $this->db->begin(); + + $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal "; + $sql .= "SET active = '1'"; + $sql .= " WHERE rowid = " . $this->db->escape($id); + + dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG); + $result = $this->db->query($sql); + if ($result) { + $this->db->commit(); + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->db->rollback(); + return - 1; + } + } + + + /** + * Retourne le libelle du statut d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court + * @return string Label of type + */ + function getLibType($mode=0) + { + return $this->LibType($this->nature,$mode); + } + + /** + * Return type of an accounting journal + * + * @param int $nature Id type + * @param int $mode 0=libelle long, 1=libelle court + * @return string Label of type + */ + function LibType($nature,$mode=0) + { + global $langs; + + $langs->load("accountancy"); + + if ($mode == 0) + { + $prefix=''; + if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew'); + if ($nature == 3) return $langs->trans('AccountingJournalTypeBank'); + if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase'); + if ($nature == 1) return $langs->trans('AccountingJournalTypeSale'); + if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation'); + } + if ($mode == 1) + { + if ($nature == 9) return $langs->trans('AccountingJournalTypeHasNew'); + if ($nature == 3) return $langs->trans('AccountingJournalTypeBank'); + if ($nature == 2) return $langs->trans('AccountingJournalTypePurchase'); + if ($nature == 1) return $langs->trans('AccountingJournalTypeSale'); + if ($nature == 0) return $langs->trans('AccountingJournalTypeVariousOperation'); + } + } +} diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index ba6173d8ebf..baa70bf51e8 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -73,7 +73,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) { * View */ -llxHeader("", "", "FicheVentilation"); +llxHeader("", $langs->trans('FicheVentilation')); if ($cancel == $langs->trans("Cancel")) { $action = ''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index a759472304e..a015fa05929 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -256,22 +256,7 @@ if ($result) { print '
'; print '
'; + print $langs->trans('From'); + print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); + print ' '; + print $langs->trans('to'); + print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; + print '
'; - print $langs->trans('From'); - print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array(), 1, 1, ''); - print '
'; - print $langs->trans('to'); - print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); - print '
   '; - $searchpitco=$form->showFilterAndCheckAddButtons(0); - print $searchpitco; - print '
'; print $langs->trans('From') . ': '; @@ -415,12 +403,26 @@ print '  '; -$searchpitco=$form->showFilterAndCheckAddButtons(0); -print $searchpitco; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; print '
' . $line->piece_num . '' . dol_print_date($line->doc_date, 'day') . '
'."\n"; - print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.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"], "fd.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.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($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre('', '', '', '', '', 'align="center"'); - print "\n"; - - print ''; + print ''; print ''; print ''; print ''; @@ -284,16 +269,30 @@ if ($result) { print ''; print ''; print '\n"; + + print ''; + print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.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"], "fd.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.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($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); + $clickpicto=$form->showCheckAddButtons(); + print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"'); + print "\n"; $facture_static = new Facture($db); $product_static = new Product($db); - $var = True; while ( $objp = $db->fetch_object($result) ) { - $var = ! $var; $codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte; $facture_static->ref = $objp->facnumber; @@ -304,7 +303,7 @@ if ($result) { $product_static->type = $objp->product_type; $product_static->label = $objp->product_label; - print ''; + print ''; print ''; @@ -335,7 +334,7 @@ if ($result) { print ''; print ''; print ''; - print ''; + print ''; print ""; $i ++; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 09ad316a398..e8e10b4a0be 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -271,22 +271,9 @@ if ($result) { print '
'; print '
'; - $searchpitco=$form->showFilterAndCheckAddButtons(1); - print $searchpitco; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; print "
' . $objp->rowid . '' . $objp->country .'' . $objp->tva_intra . '
'."\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.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, 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"; // We add search filter - print ''; + print ''; print ''; print ''; print ''; @@ -298,11 +285,27 @@ 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.facnumber", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, 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($checkpitco, '', '', '', '', 'align="center"'); + print "\n"; + $facture_static = new Facture($db); $product_static = new Product($db); $form = new Form($db); diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 4819bd656ae..52440385e50 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -76,7 +76,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) { /* * View */ -llxHeader("", "FicheVentilation"); +llxHeader("", $langs->trans('FicheVentilation')); if ($cancel == $langs->trans("Cancel")) { $action = ''; @@ -89,7 +89,7 @@ $formventilation = new FormVentilation($db); if (! empty($id)) { $sql = "SELECT er.ref, er.rowid as facid, erd.fk_c_type_fees, erd.comments, erd.rowid, erd.fk_code_ventilation,"; - $sql .= " f.id as fees_id, f.label as fees_label,"; + $sql .= " f.id as type_fees_id, f.code as type_fees_code, f.label as type_fees_label,"; $sql .= " aa.account_number, aa.label"; $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees"; @@ -132,7 +132,7 @@ if (! empty($id)) { print ''; print ''; - print ''; + print ''; print '
'; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); - print $searchpitco; + $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpicto; print '
' . stripslashes(nl2br($objp->comments)) . '
' . $langs->trans("TypeFees") . '' . dol_trunc($objp->fees_label, 24) . '' . ($langs->trans($objp->type_fees_code) == $objp->type_fees_code ? $objp->type_fees_label : $langs->trans(($objp->type_fees_code))) . '
' . $langs->trans("Account") . ''; print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 40fd15d7307..20994d76a93 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -148,7 +148,7 @@ print ''."\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 22510aed411..020dbc58474 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2009-2017 Regis Houssin * Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Frederic France @@ -496,7 +496,7 @@ class Adherent extends CommonObject if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted) { $isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1; - + // If password to set differs from the one found into database $result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass); if (! $nbrowsaffected) $nbrowsaffected++; @@ -862,7 +862,7 @@ class Adherent extends CommonObject $this->pass=$password; $this->pass_indatabase=$password_indatabase; $this->pass_indatabase_crypted=$password_crypted; - + if ($this->user_id && ! $nosyncuser) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1122,7 +1122,7 @@ class Adherent extends CommonObject $this->pass = $obj->pass; $this->pass_indatabase = $obj->pass; $this->pass_indatabase_crypted = $obj->pass_crypted; - + $this->state_id = $obj->state_id; $this->state_code = $obj->state_id?$obj->state_code:''; $this->state = $obj->state_id?$obj->state:''; @@ -1160,7 +1160,7 @@ class Adherent extends CommonObject $this->user_id = $obj->user_id; $this->user_login = $obj->user_login; - + $this->model_pdf = $obj->model_pdf; // Retreive all extrafield for thirdparty @@ -1456,7 +1456,7 @@ class Adherent extends CommonObject if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled)) { $result=$mailmanspip->add_to_mailman($this); - + if ($result < 0) { if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error; @@ -1570,40 +1570,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; } @@ -1775,7 +1820,7 @@ class Adherent extends CommonObject $response->warning_delay=$conf->adherent->subscription->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; - $response->img=img_object($langs->trans("Members"),"user"); + $response->img=img_object('',"user"); $adherentstatic = new Adherent($this->db); @@ -1815,10 +1860,10 @@ class Adherent extends CommonObject public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { global $conf,$langs; - + $langs->load("orders"); - - if (! dol_strlen($modele)) { + + if (! dol_strlen($modele)) { $modele = 'standard'; @@ -1830,11 +1875,11 @@ class Adherent extends CommonObject } $modelpath = "core/modules/member/doc/"; - + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } - - + + /** * Initialise an instance with random values. * Used to build previews or test instances. @@ -1924,27 +1969,28 @@ class Adherent extends CommonObject $this->fullname=$this->getFullName($langs); // Member - if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; - if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname; - if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; - if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; - if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; - if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; - if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; - if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; - if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; - if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; - if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; - if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; - if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; - if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; - if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; - if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; - if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; - if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); - if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; - if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); + if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname; + if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname; + if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname; + if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login; + if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption + if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste; + if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address; + if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip; + if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town; + if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code; + if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email; + if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype; + if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone; + if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso; + if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile; + if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax; + if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private; + if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public; + if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap'); + if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut; + if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap'); // Subscriptions if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap'); @@ -2078,7 +2124,7 @@ class Adherent extends CommonObject /** * Return if a member is late (subscription late) or not - * + * * @return boolean True if late, False if not late */ public function hasDelay() 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 ef20c2e96c0..6440fb72cb8 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -163,7 +163,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele if ($conf->use_javascript_ajax) { print ''; - print ''; + print ''; print '
'.$langs->trans("Statistics").'
'.$langs->trans("Statistics").'
'; $SommeA=0; @@ -201,8 +201,70 @@ if ($conf->use_javascript_ajax) print '
'; } +print '
'; + +// List of subscription by year +$Total=array(); +$Number=array(); +$tot=0; +$numb=0; + +$sql = "SELECT c.subscription, c.dateadh as dateh"; +$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; +$sql.= " WHERE d.entity IN (".getEntity().")"; +$sql.= " AND d.rowid = c.fk_adherent"; +if(isset($date_select) && $date_select != '') +{ + $sql .= " AND c.dateadh LIKE '".$date_select."%'"; +} +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object($result); + $year=dol_print_date($db->jdate($objp->dateh),"%Y"); + $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->subscription; + $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1; + $tot+=$objp->subscription; + $numb+=1; + $i++; + } +} + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print "\n"; + +$var=true; +krsort($Total); +foreach ($Total as $key=>$value) +{ + + print ''; + print ""; + print ""; + print ""; + print ""; + print "\n"; +} + +// Total +print ''; +print ''; +print ""; +print '"; +print ""; +print "\n"; +print "
'.$langs->trans("Subscriptions").''.$langs->trans("Number").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
$key".$Number[$key]."".price($value)."".price(price2num($value/$Number[$key],'MT'))."
'.$langs->trans("Total").'".$numb."'.price($tot)."".price(price2num($numb>0?($tot/$numb):0,'MT'))."

\n"; + -//print '
'; print '
'; @@ -227,7 +289,7 @@ if ($resql) { print ''; print ''; - print ''; + print ''; $num = $db->num_rows($resql); if ($num) @@ -236,9 +298,9 @@ if ($resql) $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; @@ -290,7 +352,7 @@ if ($resql) { print '
'.$langs->trans("LastMembersModified",$max).'
'.$langs->trans("LastMembersModified",$max).'
'; print ''; - print ''; + print ''; $num = $db->num_rows($resql); if ($num) @@ -299,9 +361,9 @@ if ($resql) $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; @@ -336,17 +398,17 @@ else // Summary of members by type print '
'.$langs->trans("LastSubscriptionsModified",$max).'
'.$langs->trans("LastSubscriptionsModified",$max).'
'; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print "\n"; foreach ($AdherentType as $key => $adhtype) { - $var=!$var; - print ""; + + print ''; print ''; print ''; print ''; @@ -363,71 +425,8 @@ print ''; print "
'.$langs->trans("MembersTypes").''.$langs->trans("MembersStatusToValid").''.$langs->trans("MenuMembersNotUpToDate").''.$langs->trans("MenuMembersUpToDate").''.$langs->trans("MembersStatusResiliated").''.$langs->trans("MembersTypes").''.$langs->trans("MembersStatusToValid").''.$langs->trans("MenuMembersNotUpToDate").''.$langs->trans("MenuMembersUpToDate").''.$langs->trans("MembersStatusResiliated").'
'.$adhtype->getNomUrl(1, dol_size(32)).''.(isset($MemberToValidate[$key]) && $MemberToValidate[$key] > 0?$MemberToValidate[$key]:'').' '.$staticmember->LibStatut(-1,$adhtype->subscription,0,3).''.(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).''.$SommeD.' '.$staticmember->LibSta print '
\n"; -print "
\n"; -// List of subscription by year -$Total=array(); -$Number=array(); -$tot=0; -$numb=0; - -$sql = "SELECT c.subscription, c.dateadh as dateh"; -$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; -$sql.= " WHERE d.entity IN (".getEntity().")"; -$sql.= " AND d.rowid = c.fk_adherent"; -if(isset($date_select) && $date_select != '') -{ - $sql .= " AND c.dateadh LIKE '".$date_select."%'"; -} -$result = $db->query($sql); -if ($result) -{ - $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object($result); - $year=dol_print_date($db->jdate($objp->dateh),"%Y"); - $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->subscription; - $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1; - $tot+=$objp->subscription; - $numb+=1; - $i++; - } -} - -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; - -$var=true; -krsort($Total); -foreach ($Total as $key=>$value) -{ - $var=!$var; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; -} - -// Total -print ''; -print ''; -print ""; -print '"; -print ""; -print "\n"; -print "
'.$langs->trans("Subscriptions").''.$langs->trans("Number").''.$langs->trans("AmountTotal").''.$langs->trans("AmountAverage").'
$key".$Number[$key]."".price($value)."".price(price2num($value/$Number[$key],'MT'))."
'.$langs->trans("Total").'".$numb."'.price($tot)."".price(price2num($numb>0?($tot/$numb):0,'MT'))."

\n"; - -//print '
'; print '
'; 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..bd731e771f3 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -131,8 +131,8 @@ $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..d2254b4afd6 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -295,8 +295,8 @@ if ($mode) 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..d1a8e707e43 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 '
'; @@ -183,7 +183,7 @@ foreach ($data as $val) while ($oldyear > $year+1) { // If we have empty year $oldyear--; - $var=!$var; + print ''; print ''; print ''; @@ -195,7 +195,7 @@ foreach ($data as $val) print '0'; print ''; } - $var=!$var; + print ''; print ''; //print ''; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ba33c1c73b6..85374f6785e 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -825,8 +825,8 @@ if ($rowid > 0) 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/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 3ad6120be02..164c921d766 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -199,19 +199,19 @@ if (! $rowid && $action != 'create' && $action != 'edit') 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"); ?>
'."\n"; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print "\n"; $var=True; while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; print ''; print ''; print ''; @@ -530,8 +530,8 @@ 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..3b205f49cd2 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 ''; //Use draft Watermark -$var=!$var; + print ""; print ''; print ""; -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 +697,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 '
'.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("SubscriptionRequired").''.$langs->trans("VoteAllowed").' '.$langs->trans("Ref").''.$langs->trans("Label").''.$langs->trans("SubscriptionRequired").''.$langs->trans("VoteAllowed").' 
'.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,7 +257,7 @@ $var=true; $var=! $var; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnChequeReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; $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..a6ca7871ae4 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -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); @@ -569,7 +569,7 @@ $var=! $var; print ''; print ''; print ''; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnOrders").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='ORDER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -588,11 +588,11 @@ print "
'; +print '
'; print $langs->trans("WatermarkOnDraftOrders").''; print ''; print ''; @@ -603,8 +603,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 "
'.$langs->trans("ShippableOrderIconInList").' '; @@ -623,8 +623,8 @@ print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { @@ -645,16 +645,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 +675,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/confexped.php b/htdocs/admin/confexped.php index 859534d53fd..0059f337752 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -94,28 +94,23 @@ print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'general', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'general', $langs->trans("Sendings"), -1, 'sending'); -/* - * Formulaire parametres divers - */ - -$var=true; +// Miscellaneous parameters print '
'; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print ''."\n"; // expedition activation/desactivation -$var=!$var; -print ""; +print ""; print ''; -print ''; -print '"; print ''; // Bon de livraison activation/desactivation -$var=!$var; -print ''; +print ''; print ''; -print ''; -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 '\n"; $var=true; $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..0bc620c41bf --- /dev/null +++ b/htdocs/admin/defaultvalues.php @@ -0,0 +1,309 @@ + + * + * 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 '
'.$langs->trans("Feature").' '.$langs->trans("Status").' '.$langs->trans("Status").'
'.$langs->trans("SendingsAbility").''; +print ''; print ''; +print ''; print $langs->trans("Required"); /*if (empty($conf->global->MAIN_SUBMODULE_EXPEDITION)) { @@ -129,15 +124,14 @@ print "
'; print $langs->trans("DeliveriesOrderAbility"); print '
'.info_admin($langs->trans("NoNeedForDeliveryReceipts"), 0, 1); print '
'; +print ''; print ''; +print ''; if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { 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 "
'; 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..bc3ea402704 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); @@ -503,7 +503,7 @@ print "
'; +print '
'; print $langs->trans("FreeLegalTextOnContracts").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='CONTRACT_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -519,8 +519,8 @@ else print '
'; + +print '
'; print $langs->trans("WatermarkOnDraftContractCards").''; 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"],'defaulturl','',$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"],'defaultkey','',$param,'',$sortfield,$sortorder); +if ($mode != 'sortorder') +{ + $texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'
'; + // See list into GETPOST + $texthelp.='__USERID__
'; + $texthelp.='__MYCOUNTRYID__
'; + $texthelp.='__DAY__
'; + $texthelp.='__MONTH__
'; + $texthelp.='__YEAR__
'; + if (! empty($conf->multicompany->enabled)) $texthelp.='__ENTITYID__
'; + $textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp); +} +else +{ + $texthelp='ASC or DESC'; + $textvalue=$form->textwithpicto($langs->trans("SortOrder"), $texthelp); +} +print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'defaultvalue', '', $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 59225f2dc89..95692672523 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 @@ -803,7 +805,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 +825,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 +845,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 +865,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 +917,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 +929,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 +960,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,46 +977,48 @@ 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"); } + if ($fieldlist[$field]=='width' || $fieldlist[$field]=='nx') { $valuetoshow=$langs->trans("Width"); } + if ($fieldlist[$field]=='height' || $fieldlist[$field]=='ny') { $valuetoshow=$langs->trans("Height"); } if ($fieldlist[$field]=='unit' || $fieldlist[$field]=='metric') { $valuetoshow=$langs->trans("MeasuringUnit"); } if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } + if ($fieldlist[$field]=='accountancy_code') { $valuetoshow=$langs->trans("AccountancyCode"); } + if ($fieldlist[$field]=='accountancy_code_sell') { $valuetoshow=$langs->trans("AccountancyCodeSell"); } + if ($fieldlist[$field]=='accountancy_code_buy') { $valuetoshow=$langs->trans("AccountancyCodeBuy"); } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); } if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } @@ -1039,7 +1039,7 @@ if ($id) if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } - if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } @@ -1051,7 +1051,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 +1087,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 +1106,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 +1069,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 +1129,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 +1141,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 +1225,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"); } @@ -1211,7 +1265,7 @@ if ($id) if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); } if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); } if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); } - if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); } + if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); } if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); } if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); } @@ -1229,51 +1283,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 +1312,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 +1321,6 @@ if ($id) { foreach ($fieldlist as $field => $value) { - $showfield=1; $align="left"; $valuetoshow=$obj->{$fieldlist[$field]}; @@ -1472,7 +1488,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 +1508,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 +1557,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 +1573,6 @@ else * Show list of dictionary to show */ - $var=true; $lastlineisempty=false; print ''; print ''; @@ -1570,14 +1590,14 @@ else { if ($showemptyline) { - $var=!$var; - print ''; + + print ''; $showemptyline=0; } - $var=!$var; + $value=$tabname[$i]; - print ''; } @@ -1725,13 +1745,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 6092a95d0b9..161b1aac45d 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -86,7 +86,7 @@ print ''; $head=security_prepare_head(); -dol_fiche_head($head, 'audit', $langs->trans("Security")); +dol_fiche_head($head, 'audit', $langs->trans("Security"), -1); $var=true; @@ -99,8 +99,8 @@ foreach ($eventstolog as $key => $arr) { if ($arr['id']) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; print ''; print ''; -print ''; -print ''; +print ''; +print ''; print "\n"; clearstatcache(); @@ -250,8 +250,6 @@ foreach ($dirmodels as $reldir) $handle = opendir($dir); if (is_resource($handle)) { - $var=true; - while (($file = readdir($handle))!==false) { if (substr($file, 0, 15) == 'mod_expedition_' && substr($file, dol_strlen($file)-3, 3) == 'php') @@ -268,8 +266,7 @@ 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 '\n"; + print '\n"; print ''; @@ -374,7 +371,6 @@ print "\n"; clearstatcache(); -$var=true; foreach ($dirmodels as $reldir) { foreach (array('','/doc') as $valdir) @@ -412,8 +408,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - $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 '\n"; $var=true; $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..7f81a5d0fef 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -266,20 +266,20 @@ if ($resql) print ''; print ""; - $var=!$var; - print ""; + + print ''; print ""; print ""; print ""; - $var=!$var; - print ""; + + print ''; print ""; print ""; print ""; - $var=!$var; - print ""; + + print ''; print ""; print ""; + + print ''; print ""; print ''; print ''; print "\n"; -$var=!$var; -print ''; + +print ''; print ""; print ""; -$var=!$var; -print ''; + +print ''; print ""; print "\n"; print ''; -$var=!$var; + print ''; print ''; print ''; -print ''; print ''; print ''; print "\n"; -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 ''; print ''; 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 '\n"; print ''; //Use draft Watermark -$var=!$var; + print ""; print ''; print ""; -print ''; print ''; print "\n"; -$var=!$var; -print ''; + +print ''; print ''; print "\n"; // Synchro utilisateurs/groupes active -$var=!$var; -print ''; // Synchro contact active if (! empty($conf->societe->enabled)) { - $var=!$var; - print ''; print "\n"; // Type -$var=!$var; -print ''; // Version -$var=!$var; -print ''; // Serveur primaire -$var=!$var; -print ''; // Serveur secondaire -$var=!$var; -print ''; // Port -$var=!$var; -print ''; // DNserver -$var=!$var; -print ''; // Utiliser TLS -$var=!$var; -print ''; print "\n"; // DNAdmin -$var=!$var; -print ''; // Pass -$var=!$var; -print '\n"; // DN Pour les contacts -$var=!$var; -print ''; print ''; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''; print ''; @@ -152,112 +152,112 @@ print ''; print "\n"; // Common name -$var=!$var; -print ''; print '"; print ''; // Name -$var=!$var; -print ''; print '"; print ''; // Firstname -$var=!$var; -print ''; print '"; print ''; // Company -$var=!$var; -print ''; print '"; print ''; // Mail -$var=!$var; -print ''; print '"; print ''; // Phone pro -$var=!$var; -print ''; print '"; print ''; // Phone home -$var=!$var; -print ''; print '"; print ''; // Mobile -$var=!$var; -print ''; print '"; print ''; // Skype -$var=!$var; -print ''; print '"; print ''; // Fax -$var=!$var; -print ''; print '"; print ''; // Address -$var=!$var; -print ''; print '"; print ''; // ZIP -$var=!$var; -print ''; print '"; print ''; // TOWN -$var=!$var; -print ''; print '"; print ''; // COUNTRY -$var=!$var; -print ''; print '"; 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 ''; print "\n"; // DN pour les groupes -$var=!$var; -print ''; print ''; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''; print ''; @@ -145,16 +145,16 @@ print "\n"; // Filtre // Common name -$var=!$var; -print ''; print '"; print ''; // Name -/*$var=!$var; -print ''; print '"; @@ -162,16 +162,16 @@ print ''; */ // Description -$var=!$var; -print ''; print '"; print ''; // User group -$var=!$var; -print ''; print '"; 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 ''; print "\n"; // DN Pour les adherents -$var=!$var; -print ''; print ''; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''; print ''; print ''; // Filter, used to filter search -$var=!$var; -print ''; print ''; @@ -179,208 +179,208 @@ print "\n"; // Filtre // Common name -$var=!$var; -print ''; print '"; print ''; // Name -$var=!$var; -print ''; print '"; print ''; // Firstname -$var=!$var; -print ''; print ''; print ''; // Login unix -$var=!$var; -print ''; print '"; print ''; // Login samba -$var=!$var; -print ''; print '"; print ''; // Password not crypted -$var=!$var; -print ''; print ''; print ''; // Password crypted -$var=!$var; -print ''; print ''; print ''; // Mail -$var=!$var; -print ''; print '"; print ''; // Phone pro -$var=!$var; -print ''; print ''; print ''; // Phone perso -$var=!$var; -print ''; print ''; print ''; // Mobile -$var=!$var; -print ''; print ''; print ''; // Skype -$var=!$var; -print ''; print ''; print ''; // Fax -$var=!$var; -print ''; print ''; print ''; // Address -$var=!$var; -print ''; print ''; print ''; // ZIP -$var=!$var; -print ''; print ''; print ''; // TOWN -$var=!$var; -print ''; print ''; print ''; // COUNTRY -$var=!$var; -print ''; print ''; print ''; // Description -$var=!$var; -print ''; print ''; print ''; // Public Note -$var=!$var; -print ''; print ''; print ''; // Birthday -$var=!$var; -print ''; print ''; print ''; // Status -$var=!$var; -print ''; print ''; print ''; // First subscription date -$var=!$var; -print ''; print ''; print ''; // First subscription amount -$var=!$var; -print ''; print ''; print ''; // Last subscription date -$var=!$var; -print ''; print ''; print ''; // Last subscription amount -$var=!$var; -print ''; print ''; print ''; // End last subscriptions -$var=!$var; -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 ''; print "\n"; // DN Pour les utilisateurs -$var=!$var; -print ''; print ''; print ''; // List of object class used to define attributes in structure -$var=!$var; -print ''; print ''; print ''; // Filter, used to filter search -$var=!$var; -print ''; print ''; @@ -164,120 +164,120 @@ print ''; print "\n"; // Common name -$var=!$var; -print ''; print '"; print ''; // Name -$var=!$var; -print ''; print '"; print ''; // Firstname -$var=!$var; -print ''; print '"; print ''; // Login unix -$var=!$var; -print ''; print '"; print ''; // Login samba -$var=!$var; -print ''; print '"; print ''; // Password not crypted -$var=!$var; -print ''; print '"; print ''; // Password crypted -$var=!$var; -print ''; print '"; print ''; // Mail -$var=!$var; -print ''; print '"; print ''; // Phone -$var=!$var; -print ''; print '"; print ''; // Mobile -$var=!$var; -print ''; print '"; print ''; // Skype -$var=!$var; -print ''; print '"; print ''; // Fax -$var=!$var; -print ''; print '"; print ''; // Title -$var=!$var; -print ''; print '"; print ''; // Note -$var=!$var; -print ''; print '"; print ''; // Sid -$var=!$var; -print ''; print '"; 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 '
'; if (! empty($tabcond[$i])) { print ''.$langs->trans($tablib[$i]).''; @@ -1657,7 +1677,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,14 +1805,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 34a561121b2..ef8b10c411f 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -72,26 +72,28 @@ if ($action == 'updateMask') } } -else if ($action == 'set_SHIPPING_FREE_TEXT') +else if ($action == 'set_param') { $freetext=GETPOST('SHIPPING_FREE_TEXT'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); - - if ($res > 0) - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - else + if ($res <= 0) + { + $error++; setEventMessages($langs->trans("Error"), null, 'errors'); -} - -else if ($action == 'set_SHIPPING_DRAFT_WATERMARK') -{ + } + $draft=GETPOST('SHIPPING_DRAFT_WATERMARK','alpha'); $res = dolibarr_set_const($db, "SHIPPING_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); - - if ($res > 0) - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - else + if ($res <= 0) + { + $error++; setEventMessages($langs->trans("Error"), null, 'errors'); + } + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } } else if ($action == 'specimen') @@ -222,11 +224,9 @@ print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'shipment', $langs->trans("Sendings"), -1, 'sending'); -/* - * Expedition numbering model - */ +// Shipment numbering model print load_fiche_titre($langs->trans("SendingsNumberingModules")); @@ -235,8 +235,8 @@ print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'.$module->nom."
'.$module->nom."'; print $module->info(); print '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -498,19 +493,16 @@ print '
'; */ print load_fiche_titre($langs->trans("OtherOptions")); -$var=true; +print '
'; +print ''; +print ''; + print ""; print ""; print "\n"; -print '\n"; -print "\n"; print ""; -$var=! $var; -print ''; -print ''; -print ''; -print '\n"; -print ''; -$var=!$var; -print ''; -print ''; -print ''; -print '\n"; -print ''; print '
".$langs->trans("Parameter")."'.$langs->trans("Value")." 
'; +print '
'; print $langs->trans("FreeLegalTextOnShippings").' ('.$langs->trans("AddCRIfTooLong").')
'; $variablename='SHIPPING_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -523,25 +515,18 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_details'); print $doleditor->Create(); } -print '
'; -print ''; print "
'; +print '
'; print $langs->trans("WatermarkOnDraft").'
'; print ''; -print '
'; -print ''; print "
'; +print '
'; + +print ''; llxFooter(); $db->close(); diff --git a/htdocs/admin/expedition_extrafields.php b/htdocs/admin/expedition_extrafields.php index d682f73ce6d..8c24c49cb23 100644 --- a/htdocs/admin/expedition_extrafields.php +++ b/htdocs/admin/expedition_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'attributes_shipment', $langs->trans("Sendings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/expeditiondet_extrafields.php b/htdocs/admin/expeditiondet_extrafields.php index c4d45f08ded..283eeab452a 100644 --- a/htdocs/admin/expeditiondet_extrafields.php +++ b/htdocs/admin/expeditiondet_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), 0, 'sending'); +dol_fiche_head($head, 'attributeslines_shipment', $langs->trans("Sendings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index a26a21fbede..eda3c6bd6ae 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 '
'.$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); @@ -506,7 +506,7 @@ print "
'; +print '
'; print $langs->trans("FreeLegalTextOnExpenseReports").' ('.$langs->trans("AddCRIfTooLong").')
'; $variablename='EXPENSEREPORT_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -522,8 +522,8 @@ else print '
'; + +print '
'; print $langs->trans("WatermarkOnDraftOrders").'
'; print ''; print '
".$langs->trans("Title")."
".$langs->trans("URL")."
".$langs->trans("Status").""; if ($result > 0 && empty($rss->error)) @@ -299,8 +299,8 @@ if ($resql) // Logo if ($result > 0 && empty($rss->error)) { - $var=!$var; - print "
".$langs->trans("Logo")."'; $imageurl=$rssparser->getImageUrl(); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 42000e7176d..4e9b007ee14 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -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").'
".$langs->trans("SuggestPaymentByRIBOnAccount").""; 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 "
".$langs->trans("SuggestPaymentByChequeToAddress").""; print ''; print ''; -print '
'; +print '
'; print $langs->trans("ForceInvoiceDate"); print ''; print $form->selectyesno("forcedate",$conf->global->FAC_FORCE_DATE_VALIDATION,1); @@ -737,7 +737,7 @@ $var=! $var; print '
'; print ''; print ''; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnInvoices").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='INVOICE_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -755,11 +755,11 @@ print '
'; +print '
'; print $langs->trans("WatermarkOnDraftBill").''; print ''; @@ -800,7 +800,7 @@ print ' 
'; +print '
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; print '
'; print "
'.img_object("",$picto[$const]).''.$langs->trans($desc).''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 8d31db0d3af..6c73afcf8f5 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 '
'; + print '
'; print (empty($module->name)?$name:$module->name); print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -538,7 +538,7 @@ $var=! $var; print ''; print ''; print ''; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnInterventions").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='FICHINTER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -557,11 +557,11 @@ print "
'; +print '
'; print $langs->trans("WatermarkOnDraftInterventionCards").''; print ''; print ''; @@ -573,7 +573,7 @@ $var=! $var; print ''; print ''; print ''; -print '
'; +print '
'; print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')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").'
'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'
'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").''; 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 eefa6a1fc24..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,30 +243,27 @@ if ($action == 'edit') // Edit //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - print ''; + print ''; print ''; print ''; clearstatcache(); - $var=true; - + print '
'; print ''; - print ''; + print ''; print ''; print ''; // Default language - $var=!$var; - print ''; print ''; print ''; // Multilingual GUI - $var=!$var; - print ''; print ''; @@ -191,12 +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 ''; - $var=True; + print ''; foreach ($searchform as $key => $value) { - $var=!$var; - print ''; } @@ -206,76 +292,59 @@ 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 ''; - - // Show logo - $var=!$var; - print ''; + print ''; print ''; print ''; // Max size of lists - $var=!$var; - print ''; + print ''; print ''; print ''; // Max size of short lists on customer card - $var=!$var; - print ''; + print ''; print ''; print ''; - // Disable javascript and ajax - $var=!$var; - print ''; + print ''; + print ''; + */ + + // Disable javascript and ajax + print ''; print ''; print ''; - // Activate preview tab on element card - if (class_exists("Imagick")) - { - $var=!$var; - print ''; - print ''; - print ''; - } - // First day for weeks - $var=!$var; - print ''; print ''; print ''; // DefaultWorkingDays - $var=!$var; - print ''; print ''; print ''; // DefaultWorkingHours - $var=!$var; - print ''; print ''; print ''; // Firstname/Name - $var=!$var; - print ''; @@ -283,49 +352,52 @@ if ($action == 'edit') // Edit print ''; // Hide unauthorized button - $var=!$var; - print ''; print ''; print ''; - // Hide helpcenter link on login page - $var=!$var; - print ''; + // Show logo + print ''; print ''; print ''; - - // Hide wiki link on login page - $var=!$var; - print ''; + + // Hide version link + /* + + print ''; print ''; print ''; - + */ + // Show bugtrack link - $var=!$var; - print ''; print ''; print ''; - // Message on login page - $var=!$var; - print ''."\n"; + // Hide wiki link on login page + print ''; + print ''; + print ''; + // Hide helpcenter link on login page + print ''; + print ''; + print ''; + // Message of the day on home page - $var=!$var; - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("EnableShowLogo").''; - print $form->selectyesno('MAIN_SHOW_LOGO',$conf->global->MAIN_SHOW_LOGO,1); - print '
'.$langs->trans("Parameters").''.$langs->trans("Value").' 
'.$langs->trans("DefaultMaxSizeList").'
'.$langs->trans("DefaultMaxSizeList").' 
'.$langs->trans("DefaultMaxSizeShortList").'
'.$langs->trans("DefaultMaxSizeShortList").' 
'.$langs->trans("DisableJavascript").''; + // show input border + /* + print '
'.$langs->trans("showInputBorder").''; + print $form->selectyesno('main_showInputBorder',isset($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)?$conf->global->THEME_ELDY_SHOW_BORDER_INPUT:0,1); + print ' 
'.$langs->trans("DisableJavascript").''; print $form->selectyesno('main_disable_javascript',isset($conf->global->MAIN_DISABLE_JAVASCRIPT)?$conf->global->MAIN_DISABLE_JAVASCRIPT:0,1); print ' 
'.$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("DisableLinkToHelpCenter").''; - print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK',isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0,1); - print '
'.$langs->trans("EnableShowLogo").''; + print $form->selectyesno('MAIN_SHOW_LOGO',$conf->global->MAIN_SHOW_LOGO,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("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("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("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 $form->selectyesno('MAIN_HELPCENTER_DISABLELINK',isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0,1); + 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(); @@ -334,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 ''; @@ -345,14 +450,11 @@ if ($action == 'edit') // Edit } else // Show { - $var=true; - // Language print ''; - print ''; + print ''; - $var=!$var; - print ''; print ""; - - $var=!$var; - print ''; + + print ''; print ''; print ""; @@ -379,12 +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)); @@ -361,9 +463,8 @@ else // Show if ($user->admin && $conf->global->MAIN_LANG_DEFAULT!='auto') print info_admin($langs->trans("SubmitTranslation".($conf->global->MAIN_LANG_DEFAULT=='en_US'?'ENUS':''),$conf->global->MAIN_LANG_DEFAULT),1); print '
'.$langs->trans("EnableMultilangInterface").'' . yn($conf->global->MAIN_MULTILANGS) . '
'.$langs->trans("EnableMultilangInterface").'' . yn($conf->global->MAIN_MULTILANGS) . ' 
'; - print ''; - $var=true; + print ''; foreach ($searchform as $key => $value) { - $var=!$var; - print ''; + + print ''; print ''; @@ -394,69 +494,53 @@ else // Show } // Other - $var=true; 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 ''; - $var=!$var; - print ''; - print ''; - print ""; - - $var=!$var; - print ''; + print ''; print ''; print ""; - $var=!$var; - print ''; + print ''; print ''; print ""; + /* + print '"; + print ''; + print ""; + */ + // Disable javascript/ajax - $var=!$var; - print '"; - print ''; - print ""; - - // Activate preview tab on element card - if (class_exists("Imagick")) - { - $var=!$var; - print '"; - print ''; - print ""; - } + print ''; + print ""; // First day for weeks - $var=!$var; - print ''; print ''; print ''; // DefaultWorkingDays - $var=!$var; - print ''; print ''; print ''; // DefaultWorkingHours - $var=!$var; - print ''; print ''; print ''; // Firstname / Name position - $var=!$var; - print ''; @@ -464,46 +548,78 @@ else // Show print ''; // Hide unauthorized button - $var=!$var; - print ''; - // Link to help center - $var=!$var; - print ''; + // Show logo + print ''; + print ''; + print ""; - // Link to wiki help - $var=!$var; - print ''; - - // Show bugtrack link - $var=!$var; - print ''; + print ''; + print ''; + */ + + // Show bugtrack link + print '"; print ''; print ""; - // Message login - $var=!$var; - print ''."\n"; + // Link to wiki help + print ''; + + // Link to help center + print ''; // Message of the day - $var=!$var; - print ''."\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ' 
'.$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("showInputBorder").''; + print yn($conf->global->THEME_ELDY_SHOW_BORDER_INPUT)." 
'.$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("DisableLinkToHelpCenter").''; - print yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0),1); - print '
'.$langs->trans("EnableShowLogo").'' . yn($conf->global->MAIN_SHOW_LOGO) . ' 
'.$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("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; + // Hide version link + /* + print '
'.$langs->trans("HideVersionLink").''; + print yn($conf->global->MAIN_HIDE_VERSION); + print ' 
'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).''; print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)." 
'.$langs->trans("MessageLogin").''; - if (isset($conf->global->MAIN_HOME)) print dol_htmlcleanlastbr($conf->global->MAIN_HOME); - else print ' '; - 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 yn((isset($conf->global->MAIN_HELPCENTER_DISABLELINK)?$conf->global->MAIN_HELPCENTER_DISABLELINK:0),1); + 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 '
'; print ''.$langs->trans("Modify").''; print '
'; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 6778f618265..e9d38ad3776 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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/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").'
'.$langs->trans("LDAPDnSynchroActive").''; + +print '
'.$langs->trans("LDAPDnSynchroActive").''; $arraylist=array(); $arraylist['0']=$langs->trans("No"); $arraylist['ldap2dolibarr']=$langs->trans("LDAPToDolibarr"); @@ -127,8 +127,8 @@ 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").'
'.$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 ' 
'.$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").'
'; + +print '
'; print $langs->trans("LDAPPrimaryServer").''; print ''; print ''.$langs->trans("LDAPServerExample").'
'; + +print '
'; print $langs->trans("LDAPSecondaryServer").''; print ''; print ''.$langs->trans("LDAPServerExample").'
'.$langs->trans("LDAPServerPort").''; + +print '
'.$langs->trans("LDAPServerPort").''; if (! empty($conf->global->LDAP_SERVER_PORT)) { print ''; @@ -202,14 +202,14 @@ else print ''.$langs->trans("LDAPServerPortExample").'
'.$langs->trans("LDAPServerDn").''; + +print '
'.$langs->trans("LDAPServerDn").''; print ''; print ''.$langs->trans("LDAPServerDnExample").'
'.$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").'
'.$langs->trans("LDAPAdminDn").''; + +print '
'.$langs->trans("LDAPAdminDn").''; print ''; print ''.$langs->trans("LDAPAdminDnExample").'
'.$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 "
'.$langs->trans("LDAPContactDn").''; + +print '
'.$langs->trans("LDAPContactDn").''; print ''; print ''.$langs->trans("LDAPContactDnExample").' 
'.$langs->trans("LDAPContactObjectClassList").''; + +print '
'.$langs->trans("LDAPContactObjectClassList").''; print ''; print ''.$langs->trans("LDAPContactObjectClassListExample").' '.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldFullname").''; + +print '
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FULLNAME?' checked':'').">
'.$langs->trans("LDAPFieldName").''; + +print '
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_NAME?' checked':'').">
'.$langs->trans("LDAPFieldFirstName").''; + +print '
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME?' checked':'').">
'.$langs->trans("LDAPFieldCompany").''; + +print '
'.$langs->trans("LDAPFieldCompany").''; print ''; print ''.$langs->trans("LDAPFieldCompanyExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COMPANY?' checked':'').">
'.$langs->trans("LDAPFieldMail").''; + +print '
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MAIL?' checked':'').">
'.$langs->trans("LDAPFieldPhone").''; + +print '
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_PHONE?' checked':'').">
'.$langs->trans("LDAPFieldHomePhone").''; + +print '
'.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE?' checked':'').">
'.$langs->trans("LDAPFieldMobile").''; + +print '
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MOBILE?' checked':'').">
'.$langs->trans("LDAPFieldSkype").''; + +print '
'.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_SKYPE?' checked':'').">
'.$langs->trans("LDAPFieldFax").''; + +print '
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FAX?' checked':'').">
'.$langs->trans("LDAPFieldAddress").''; + +print '
'.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ADDRESS?' checked':'').">
'.$langs->trans("LDAPFieldZip").''; + +print '
'.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ZIP?' checked':'').">
'.$langs->trans("LDAPFieldTown").''; + +print '
'.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_TOWN?' checked':'').">
'.$langs->trans("LDAPFieldCountry").''; + +print '
'.$langs->trans("LDAPFieldCountry").''; print ''; print ' global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked':'').">'.$langs->trans("LDAPSynchronizeGroups").'
'.$langs->trans("LDAPGroupDn").''; + +print '
'.$langs->trans("LDAPGroupDn").''; print ''; print ''.$langs->trans("LDAPGroupDnExample").' 
'.$langs->trans("LDAPGroupObjectClassList").''; + +print '
'.$langs->trans("LDAPGroupObjectClassList").''; print ''; print ''.$langs->trans("LDAPGroupObjectClassListExample").' 
'.$langs->trans("LDAPFieldName").''; + +print '
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldCommonNameExample").'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldName").''; +/* +print '
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_NAME?' checked':'').">
'.$langs->trans("LDAPFieldDescription").''; + +print '
'.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_DESCRIPTION)?' checked':'').">
'.$langs->trans("LDAPFieldGroupMembers").''; + +print '
'.$langs->trans("LDAPFieldGroupMembers").''; print ''; print ''.$langs->trans("LDAPFieldGroupMembersExample").'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked':'').">'.$langs->trans("LDAPSynchronizeMembers").'
'.$langs->trans("LDAPMemberDn").''; + +print '
'.$langs->trans("LDAPMemberDn").''; print ''; print ''.$langs->trans("LDAPMemberDnExample").' 
'.$langs->trans("LDAPMemberObjectClassList").''; + +print '
'.$langs->trans("LDAPMemberObjectClassList").''; print ''; print ''.$langs->trans("LDAPMemberObjectClassListExample").' 
'.$langs->trans("LDAPFilterConnection").''; + +print '
'.$langs->trans("LDAPFilterConnection").''; print ''; print ''.$langs->trans("LDAPFilterConnectionExample").'
'.$langs->trans("LDAPFieldFullname").''; + +print '
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldName").''; + +print '
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_NAME)?' checked':'').">
'.$langs->trans("LDAPFieldFirstName").''; + +print '
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").' 
'.$langs->trans("LDAPFieldLoginUnix").''; + +print '
'.$langs->trans("LDAPFieldLoginUnix").''; print ''; print ''.$langs->trans("LDAPFieldLoginExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN)?' checked':'').">
'.$langs->trans("LDAPFieldLoginSamba").''; + +print '
'.$langs->trans("LDAPFieldLoginSamba").''; print ''; print ''.$langs->trans("LDAPFieldLoginSambaExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA)?' checked':'').">
'.$langs->trans("LDAPFieldPasswordNotCrypted").''; + +print '
'.$langs->trans("LDAPFieldPasswordNotCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").' 
'.$langs->trans("LDAPFieldPasswordCrypted").''; + +print '
'.$langs->trans("LDAPFieldPasswordCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").' 
'.$langs->trans("LDAPFieldMail").''; + +print '
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_MAIL)?' checked':'').">
'.$langs->trans("LDAPFieldPhone").''; + +print '
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").' 
'.$langs->trans("LDAPFieldHomePhone").''; + +print '
'.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").' 
'.$langs->trans("LDAPFieldMobile").''; + +print '
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").' 
'.$langs->trans("LDAPFieldSkype").''; + +print '
'.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").' 
'.$langs->trans("LDAPFieldFax").''; + +print '
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").' 
'.$langs->trans("LDAPFieldAddress").''; + +print '
'.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").' 
'.$langs->trans("LDAPFieldZip").''; + +print '
'.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").' 
'.$langs->trans("LDAPFieldTown").''; + +print '
'.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").' 
'.$langs->trans("LDAPFieldCountry").''; + +print '
'.$langs->trans("LDAPFieldCountry").''; print ''; print '  
'.$langs->trans("LDAPFieldDescription").''; + +print '
'.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").' 
'.$langs->trans("LDAPFieldNotePublic").''; + +print '
'.$langs->trans("LDAPFieldNotePublic").''; print ''; print ''.$langs->trans("LDAPFieldNotePublicExample").' 
'.$langs->trans("LDAPFieldBirthdate").''; + +print '
'.$langs->trans("LDAPFieldBirthdate").''; print ''; print '  
'.$langs->trans("LDAPFieldStatus").''; + +print '
'.$langs->trans("LDAPFieldStatus").''; print ''; print '  
'.$langs->trans("LDAPFieldFirstSubscriptionDate").''; + +print '
'.$langs->trans("LDAPFieldFirstSubscriptionDate").''; print ''; print '  
'.$langs->trans("LDAPFieldFirstSubscriptionAmount").''; + +print '
'.$langs->trans("LDAPFieldFirstSubscriptionAmount").''; print ''; print '  
'.$langs->trans("LDAPFieldLastSubscriptionDate").''; + +print '
'.$langs->trans("LDAPFieldLastSubscriptionDate").''; print ''; print '  
'.$langs->trans("LDAPFieldLastSubscriptionAmount").''; + +print '
'.$langs->trans("LDAPFieldLastSubscriptionAmount").''; print ''; print '  
'.$langs->trans("LDAPFieldEndLastSubscription").''; + +print '
'.$langs->trans("LDAPFieldEndLastSubscription").''; print ''; print '  '.$langs->trans("LDAPSynchronizeUsers").'
'.$langs->trans("LDAPUserDn").''; + +print '
'.$langs->trans("LDAPUserDn").''; print ''; print ''.$langs->trans("LDAPUserDnExample").' 
'.$langs->trans("LDAPUserObjectClassList").''; + +print '
'.$langs->trans("LDAPUserObjectClassList").''; print ''; print ''.$langs->trans("LDAPUserObjectClassListExample").' 
'.$langs->trans("LDAPFilterConnection").''; + +print '
'.$langs->trans("LDAPFilterConnection").''; print ''; print ''.$langs->trans("LDAPFilterConnectionExample").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldFullname").''; + +print '
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldName").''; + +print '
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_NAME)?' checked':'').">
'.$langs->trans("LDAPFieldFirstName").''; + +print '
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FIRSTNAME)?' checked':'').">
'.$langs->trans("LDAPFieldLoginUnix").''; + +print '
'.$langs->trans("LDAPFieldLoginUnix").''; print ''; print ''.$langs->trans("LDAPFieldLoginExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN)?' checked':'').">
'.$langs->trans("LDAPFieldLoginSamba").''; + +print '
'.$langs->trans("LDAPFieldLoginSamba").''; print ''; print ''.$langs->trans("LDAPFieldLoginSambaExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN_SAMBA)?' checked':'').">
'.$langs->trans("LDAPFieldPasswordNotCrypted").''; + +print '
'.$langs->trans("LDAPFieldPasswordNotCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD)?' checked':'').">
'.$langs->trans("LDAPFieldPasswordCrypted").''; + +print '
'.$langs->trans("LDAPFieldPasswordCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PASSWORD_CRYPTED)?' checked':'').">
'.$langs->trans("LDAPFieldMail").''; + +print '
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MAIL)?' checked':'').">
'.$langs->trans("LDAPFieldPhone").''; + +print '
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PHONE)?' checked':'').">
'.$langs->trans("LDAPFieldMobile").''; + +print '
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MOBILE)?' checked':'').">
'.$langs->trans("LDAPFieldSkype").''; + +print '
'.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SKYPE)?' checked':'').">
'.$langs->trans("LDAPFieldFax").''; + +print '
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'').">
'.$langs->trans("LDAPFieldTitle").''; + +print '
'.$langs->trans("LDAPFieldTitle").''; print ''; print ''.$langs->trans("LDAPFieldTitleExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_TITLE)?' checked':'').">
'.$langs->trans("Note").''; + +print '
'.$langs->trans("Note").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_DESCRIPTION)?' checked':'').">
'.$langs->trans("LDAPFieldSid").''; + +print '
'.$langs->trans("LDAPFieldSid").''; print ''; print ''.$langs->trans("LDAPFieldSidExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked':'').">
'; 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 42d7fa69ac8..281f1934296 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -214,12 +214,10 @@ print load_fiche_titre($langs->trans("SendingsSetup"),$linkback,'title_setup'); print '
'; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), 0, 'sending'); +dol_fiche_head($head, 'receivings', $langs->trans("Receivings"), -1, 'sending'); -/* - * Livraison numbering model - */ +// Delivery numbering model print load_fiche_titre($langs->trans("DeliveryOrderNumberingModules"),'',''); @@ -260,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 ''; @@ -387,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); @@ -401,7 +399,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { - 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 ''; @@ -453,7 +453,7 @@ if ($action == 'edit') } else { - dol_fiche_head($head, 'common', ''); + dol_fiche_head($head, 'common', '', -1); print $langs->trans("EMailsDesc")."
\n"; print "
\n"; @@ -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 ''; // Hide unauthorized menu -$var=!$var; -print ""; + +print ''; print ''; print '\n"; - print ''."\n"; - print "\n"; - $atleastoneforfamily=0; + print_fiche_titre($familytext, '', ''); + + print '
'; + print '
'.$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); @@ -485,7 +483,7 @@ $var=! $var; print ''; print ''; print ''; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnDeliveryReceipts").' ('.$langs->trans("AddCRIfTooLong").')
'; $variablename='DELIVERY_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) diff --git a/htdocs/admin/livraison_extrafields.php b/htdocs/admin/livraison_extrafields.php index 71a34039084..84037ae9b80 100644 --- a/htdocs/admin/livraison_extrafields.php +++ b/htdocs/admin/livraison_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), 0, 'sending'); +dol_fiche_head($head, 'attributes_receivings', $langs->trans("Receivings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/admin/livraisondet_extrafields.php b/htdocs/admin/livraisondet_extrafields.php index 4679123352a..22a7e89d724 100644 --- a/htdocs/admin/livraisondet_extrafields.php +++ b/htdocs/admin/livraisondet_extrafields.php @@ -78,7 +78,7 @@ print "
\n"; $head = expedition_admin_prepare_head(); -dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), 0, 'sending'); +dol_fiche_head($head, 'attributeslines_receivings', $langs->trans("Receivings"), -1, 'sending'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; 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 e0e23f75d18..219cd85c2fe 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -228,7 +228,7 @@ if ($action == 'edit') print ''; print ''; - dol_fiche_head($head, 'common', ''); + dol_fiche_head($head, 'common', '', -1); print $langs->trans("EMailsDesc")."
\n"; print "
\n"; @@ -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 150f288e45d..90949c7980d 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -405,7 +405,7 @@ $head[$h][2] = 'templates'; $h++; -dol_fiche_head($head, 'templates', ''); +dol_fiche_head($head, 'templates', '', -1); // Confirmation de la suppression de la ligne if ($action == 'delete') 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..82457a27bdf 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -77,7 +77,7 @@ $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 @@ -90,8 +90,8 @@ 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 9ff7a4478ff..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 @@ -239,7 +232,7 @@ $head[$h][2] = 'desc'; $h++; $head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature'; -$head[$h][1] = $langs->trans("Features"); +$head[$h][1] = $langs->trans("TechnicalServicesProvided"); $head[$h][2] = 'feature'; $h++; @@ -251,45 +244,38 @@ foreach($orders as $tmpkey => $tmpvalue) if ($objMod->numero == $id) { $key = $i; + $modName = $filename[$tmpkey]; + $dirofmodule = $dirmod[$tmpkey]; break; } $i++; } $value = $orders[$key]; +$special = $objMod->special; +$tab=explode('_',$value); +$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; + +// Check filters +$modulename=$objMod->getName(); +$moduledesc=$objMod->getDesc(); +$moduleauthor=$objMod->getPublisher(); + print '
'; - -print load_fiche_titre($objMod->getDesc(),$moreinfo,'object_'.$objMod->picto); +print load_fiche_titre(($modulename?$modulename:$moduledesc), $moreinfo, 'object_'.$objMod->picto); print '
'; -dol_fiche_head($head, $mode, $title); +dol_fiche_head($head, $mode, $title, -1); - - -$tab=explode('_',$value); -$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; - -$modName = $filename[$key]; -$objMod = $modules[$key]; -$dirofmodule = $dirmod[$key]; - -$special = $objMod->special; - -if (! $objMod->getName()) +if (! $modulename) { dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING); } $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod))); -// Check filters -$modulename=$objMod->getName(); -$moduledesc=$objMod->getDesc(); -$moduledesclong=$objMod->getDescLong(); -$moduleauthor=$objMod->getPublisher(); - // Load all lang files of module if (isset($objMod->langfiles) && is_array($objMod->langfiles)) { @@ -299,7 +285,7 @@ if (isset($objMod->langfiles) && is_array($objMod->langfiles)) } } -$var=!$var; + // Version (with picto warning or not) @@ -322,6 +308,8 @@ $text=''; if ($mode == 'desc') { + if ($moduledesc) $text.=$moduledesc.'

'; + $text.=''.$langs->trans("Version").': '.$version; $textexternal=''; @@ -329,7 +317,7 @@ if ($mode == 'desc') { $textexternal.='
'.$langs->trans("Origin").': '.$langs->trans("ExternalModule",$dirofmodule); if ($objMod->editor_name != 'dolibarr') $textexternal.='
'.$langs->trans("Publisher").': '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name); - if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='
'.$langs->trans("Url").': '.$objMod->editor_url; + if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='
'.$langs->trans("Url").': '.$objMod->editor_url.''; $text.=$textexternal; $text.='
'; } @@ -342,11 +330,21 @@ if ($mode == 'desc') else $text.=$langs->trans("Disabled"); $text.='
'; - if ($objMod->getDescLong()) $text.=$objMod->getDesc().'
'; + $moduledesclong=$objMod->getDescLong(); + if ($moduledesclong) $text.='

'.$moduledesclong.'
'; } 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)) { @@ -360,6 +358,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddDictionaries").': '; if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib'])) { @@ -372,6 +372,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddBoxes").': '; if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes)) { @@ -384,6 +386,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddModels").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models']) { @@ -391,6 +395,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddSubstitutions").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions']) { @@ -398,6 +404,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddSheduledJobs").': '; if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs)) { @@ -410,6 +418,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddTriggers").': '; if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) { @@ -417,6 +427,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddHooks").': '; if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks'])) { @@ -429,6 +441,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddPermissions").': '; if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights)) { @@ -441,6 +455,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddMenus").': '; if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1 { @@ -448,6 +464,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddExportProfiles").': '; if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label)) { @@ -460,6 +478,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddImportProfiles").': '; if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label)) { @@ -472,6 +492,8 @@ if ($mode == 'feature') } else $text.=$langs->trans("No"); + $text.='
'; + $text.='
'.$langs->trans("AddOtherPagesOrServices").': '; $text.=$langs->trans("DetectionNotPossible"); } diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 596aefa803e..4eb82e6183c 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -235,6 +235,8 @@ $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones' llxHeader('',$langs->trans("Setup"),$help_url); $arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers")); +$arrayofwarnings=array(); // Array of warning each module want to show when activated +$arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module // Search modules dirs $modulesdir = dolGetModulesDirs(); @@ -266,7 +268,7 @@ foreach ($modulesdir as $dir) if ($modName) { - if (! empty($modNameLoaded[$modName])) + if (! empty($modNameLoaded[$modName])) // In cache of already loaded modules ? { $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.
"; setEventMessages($mesg, null, 'warnings'); @@ -276,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); @@ -297,7 +298,7 @@ foreach ($modulesdir as $dir) if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0; if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0; - // We discard modules according to property disabled + // We discard modules according to property ->hidden if (! empty($objMod->hidden)) $modulequalified=0; if ($modulequalified > 0) @@ -321,8 +322,8 @@ foreach ($modulesdir as $dir) // Define array $categ with categ with at least one qualified module if ($modulequalified > 0) { - $modules[$i] = $objMod; $filename[$i]= $modName; + $modules[$modName] = $objMod; $special = $objMod->special; @@ -342,6 +343,16 @@ foreach ($modulesdir as $dir) if ($special == 1) $familykey='interface'; + // Add list of warnings to show into arrayofwarnings and arrayofwarningsext + if (! empty($objMod->warnings_activation)) + { + $arrayofwarnings[$modName]=$objMod->warnings_activation; + } + if (! empty($objMod->warnings_activation_ext)) + { + $arrayofwarningsext[$modName]=$objMod->warnings_activation_ext; + } + $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number $dirmod[$i] = $dir; //print $i.'-'.$dirmod[$i].'
'; @@ -428,7 +439,7 @@ if ($mode == 'common') print ''; print ''; - dol_fiche_head($head, $mode, ''); + dol_fiche_head($head, $mode, '', -1); $moreforfilter = ''; $moreforfilter.='
'; @@ -459,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 '
'; } @@ -473,8 +482,6 @@ if ($mode == 'common') $moreforfilter=''; // Show list of modules - print '
'; - print ''."\n"; $oldfamily=''; @@ -484,7 +491,7 @@ if ($mode == 'common') $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; $modName = $filename[$key]; - $objMod = $modules[$key]; + $objMod = $modules[$modName]; $dirofmodule = $dirmod[$key]; $special = $objMod->special; @@ -504,6 +511,7 @@ if ($mode == 'common') // Check filters $modulename=$objMod->getName(); + $moduletechnicalname=$objMod->name; $moduledesc=$objMod->getDesc(); $moduledesclong=$objMod->getDescLong(); $moduleauthor=$objMod->getPublisher(); @@ -513,6 +521,7 @@ if ($mode == 'common') { $qualified=0; if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) + || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) @@ -556,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++; @@ -574,7 +584,7 @@ if ($mode == 'common') $oldfamily=$familykey; } - $var=!$var; + // Version (with picto warning or not) @@ -592,53 +602,52 @@ if ($mode == 'common') $imginfo="info_black"; } - print '\n"; + print ''."\n"; - // Picto - print ' '; - - // Name - print '\n"; // Desc - print '\n"; // Help - print ''; // Version - print '\n"; // Activate/Disable and Setup (2 columns) - if (! empty($conf->global->$const_name)) // If module is activated + if (! empty($conf->global->$const_name)) // If module is already activated { $disableSetup = 0; - print ''; + print ''; } else { - print ''; + print ''; } } else { - print ''; + print ''; } } - else // Module not activated + 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"); } @@ -660,7 +669,7 @@ if ($mode == 'common') { if (is_array($objMod->config_page_url)) { - print ''; + print ''; $i=0; foreach ($objMod->config_page_url as $page) { @@ -686,25 +695,25 @@ 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)) { - // Ne devrait pas arriver. + // Should never happened } else if (! empty($objMod->disabled)) { @@ -712,18 +721,48 @@ if ($mode == 'common') } else { - // Module non actif - print ''; + // Module qualified for activation + $warningmessage=''; + if (! empty($arrayofwarnings[$modName])) + { + print ''."\n"; + foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) + { + $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code); + } + } + if ($objMod->isCoreOrExternalModule() == 'external' && ! empty($arrayofwarningsext)) + { + print ''."\n"; + foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) + { + if (! empty($modules[$keymodule]->const_name)) // If module that request warning is on + { + foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) + { + if ($keycountry == 'always' || $keycountry == $mysoc->country_code) + { + $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName()); + } + } + } + } + } + print ''."\n"; + 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 '
'; @@ -732,7 +771,7 @@ if ($mode == 'common') if ($mode == 'marketplace') { - dol_fiche_head($head, $mode, ''); + dol_fiche_head($head, $mode, '', -1); // Marketplace print "\n"; @@ -742,7 +781,7 @@ if ($mode == 'marketplace') print ''; print ''; - $var=!$var; + print "\n"; $url='https://www.dolistore.com'; print ''; @@ -750,7 +789,7 @@ if ($mode == 'marketplace') print ''; print ''; - $var=!$var; + print "\n"; $url='https://partners.dolibarr.org'; print ''; @@ -768,7 +807,7 @@ if ($mode == 'marketplace') if ($mode == 'deploy') { - dol_fiche_head($head, $mode, ''); + dol_fiche_head($head, $mode, '', -1); $allowonlineinstall=true; 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/payment.php b/htdocs/admin/payment.php index 93f7c301519..a5166ec69f2 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -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..bff56b4f776 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -310,8 +310,8 @@ foreach ($dirmodels as $reldir) if ($module->isEnabled()) { - $var=!$var; - print ''; @@ -450,7 +450,7 @@ foreach ($dirmodels as $reldir) if ($modulequalified) { $var = !$var; - print '\n"; print "\n"; print ""; -$var=!$var; + print ""; print ''; print ""; -print ""; +print ''; print ''; print '"; print ''; @@ -562,7 +562,7 @@ $var=! $var; print ''; print ''; print ''; -print '\n"; print ''; -$var=!$var; + print ""; print ''; print ""; -print ''; } */ @@ -668,7 +668,7 @@ print ''; print ''; print "\n"; -print '\n"; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 1f6e45223b4..224fac14ce7 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -96,7 +96,7 @@ print ''; $head=security_prepare_head(); -dol_fiche_head($head, 'proxy', $langs->trans("Security")); +dol_fiche_head($head, 'proxy', $langs->trans("Security"), -1); if ($conf->use_javascript_ajax) @@ -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 97cae20377c..4d0415dbd01 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -198,7 +198,7 @@ print "
\n"; $head=security_prepare_head(); -dol_fiche_head($head, 'passwords', $langs->trans("Security")); +dol_fiche_head($head, 'passwords', $langs->trans("Security"), -1); $var=false; @@ -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 ac0a1e883eb..e5c66d9e24b 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -103,7 +103,7 @@ print ''; $head=security_prepare_head(); -dol_fiche_head($head, 'misc', $langs->trans("Security")); +dol_fiche_head($head, 'misc', $langs->trans("Security"), -1); // Other Options @@ -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..d54f0e367aa 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 "\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 ''; -$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 ''; @@ -238,9 +238,9 @@ if ($resql) 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..1e70cbab6cc 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -108,8 +108,8 @@ else while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; print ''; print ''; @@ -163,8 +163,8 @@ else while ($i < $num) { $row = $db->fetch_row($resql); - $var=!$var; - print ""; + + print ''; print ''; print ''; print ''; @@ -205,7 +205,7 @@ else $count = '?'; } - print ""; + print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index c50e6ca9e4c..39511e8a814 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -103,8 +103,8 @@ else $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..624edc2f38e 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -111,8 +111,8 @@ else while ($i < $num) { $row = $db->fetch_row($resql); - $var=!$var; - print ""; + + print ''; print ""; print ""; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 6a5384da69a..c96a085456a 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -72,8 +72,8 @@ $var=true; print '
'; 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 4302222630c..daafab71053 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -118,7 +118,7 @@ $db->commit(); $head=security_prepare_head(); -dol_fiche_head($head, 'default', $langs->trans("Security")); +dol_fiche_head($head, 'default', $langs->trans("Security"), -1); // Show warning about external users @@ -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); @@ -546,11 +546,11 @@ print ''.$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); @@ -576,7 +576,7 @@ $var=! $var; print ''; print ''; print ''; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnProposal").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='PROPOSAL_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -594,11 +594,11 @@ print '' print "
'; +print '
'; print $langs->trans("WatermarkOnDraftProposal").''; print ''; print ''; @@ -609,8 +609,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 '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { @@ -631,8 +631,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 f7a776c7249..8c1b1fa5b07 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -124,7 +124,7 @@ print ''; $head=security_prepare_head(); -dol_fiche_head($head, 'file', $langs->trans("Security")); +dol_fiche_head($head, 'file', $langs->trans("Security"), -1); // Upload options @@ -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..2619951e1b5 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,7 +471,7 @@ print ''.$langs->trans("Value").' 
'; +print '
'; print $langs->trans("FreeLegalTextOnInvoices").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='SUPPLIER_INVOICE_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -505,7 +505,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); @@ -493,7 +493,7 @@ print "
'; + print '
'; print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; print $langs->trans("IfSetToYesDontForgetPermission"); print '
'; @@ -501,15 +501,15 @@ $var=false; print ''; print ''; print "
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '; if (! empty($conf->use_javascript_ajax)) { @@ -530,13 +530,13 @@ if ($conf->banque->enabled) } else { - $var=!$var; - print '
'; + + print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '.$langs->trans('NotAvailable').'
'; +print '
'; print $langs->trans("FreeLegalTextOnOrders").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='SUPPLIER_ORDER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -571,7 +571,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..703fbc482e9 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); @@ -527,7 +527,7 @@ $var=! $var; print '
'; print ''; print ''; -print '
'; +print '
'; print $langs->trans("FreeLegalTextOnSupplierProposal").' '.img_info($langs->trans("AddCRIfTooLong")).'
'; $variablename='SUPPLIER_PROPOSAL_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) @@ -545,11 +545,11 @@ print '' print "
'; +print '
'; print $langs->trans("WatermarkOnDraftSupplierProposal").''; print ''; print ''; @@ -559,8 +559,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 +581,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..9590260f005 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -170,8 +170,8 @@ foreach($configfileparameters as $key) continue; } - $var=!$var; - print "
 
'.$obj->name.''.$obj->value.''.$obj->entity.'
'.$obj->Name.''.$obj->Engine.'
'.$row[0].''.$row[1].''.$row[2].'
'.$row[0].''.$count.'
'; print $param; print '
$row[0]$row[1]
'; 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,10 +123,10 @@ 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 '
'; @@ -136,29 +136,29 @@ $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 ''; print ''; print ''; print ''."\n"; @@ -206,40 +206,40 @@ $var=true; print '
'; 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) { @@ -188,8 +188,8 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S foreach($shmoparray as $key => $val) { - $var=!$var; - 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"; if (($thousand != ',' && $thousand != '.') || ($thousand != ' ')) { - $var=!$var; + 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"; -$var=!$var; +print ''."\n"; + + $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(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')."
  => 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 +251,19 @@ $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 +274,9 @@ 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 +284,19 @@ 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 +384,8 @@ foreach($configfileparameters as $key => $value) } if (strpos($newkey, 'separator') !== false && $lastkeyshown == 'separator') continue; - $var=!$var; - print ""; + + print ''; if (strpos($newkey, 'separator') !== false) { print ' '; @@ -468,9 +468,9 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; + - print ''; + print ''; print ''.$obj->name.''."\n"; print ''.$obj->value.''."\n"; if (empty($conf->multicompany->enabled) || !$user->entity) print ''.$obj->entity.''."\n"; // If superadmin or multicompany disabled diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 498e1ec54f0..c64379a96f1 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -50,11 +50,11 @@ $var = true; print ''; print ''."\n"; $var = ! $var; -print ''."\n"; +print ''."\n"; $var = ! $var; -print ''."\n"; +print ''."\n"; $var = ! $var; -print ''; + + print ''; print ''; $valtoshow=$keyvalue; if ($keyparam == 'X-ChromePhp-Data') $valtoshow=dol_trunc($keyvalue,80); @@ -97,8 +97,8 @@ foreach($phparray as $key => $value) } else { - $var=!$var; - print ''; + + print ''; print ''; $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 ''; print ''; print ''; @@ -207,7 +207,7 @@ function create_key_table($list) foreach($list as $key) { $var = !$var; - print ''; + print ''; print ''; print ''; print ''; @@ -239,37 +239,37 @@ 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 ''; $var = ! $var; -print ''; +print ''; print ''; print ''; print ''; $var = ! $var; -print ''; +print ''; print ''; print ''; print ''; @@ -289,12 +289,12 @@ if (is_array($resCached) || is_array($resRemoved)) { if (is_array($resCached)) { $var = ! $var; - print ""; + print ''; print ""; print ''; print ""; $var = ! $var; - print ""; + print ''; print ""; print ''; print ""; @@ -302,17 +302,17 @@ if (is_array($resCached) || is_array($resRemoved)) { if (is_array($resRemoved)) { $var = ! $var; - print ""; + print ''; print ""; print ''; print ""; $var = ! $var; - print ""; + print ''; print ""; print ''; print ""; $var = ! $var; - print ""; + print ''; print ""; print ''; print "
'.$langs->trans("Version").''.$langs->trans("Value").'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionLastUpgrade").''.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'.$langs->trans("VersionProgram").''.DOL_VERSION; +print '
'.$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) @@ -95,13 +95,13 @@ print ''."\n"; if (dol_is_file($xmlfile)) { print ' '.$langs->trans("LocalSignature").' = '; - print ''; + print ''; print '
'; } else { print ' '.$langs->trans("LocalSignature").' = '; - print ''; + print ''; print ' ('.$langs->trans("AvailableOnlyOnPackagedVersions").')'; print '
'; } @@ -109,7 +109,7 @@ print ''."\n"; if ($enableremotecheck) { print ' '.$langs->trans("RemoteSignature").' = '; - print '
'; + print '
'; } else { diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 706e0215059..68a01340303 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -118,7 +118,7 @@ $rights_ids = array(); foreach($sortorder as $numero=>$name) { $idperms=""; - $var=!$var; + // Module print "
'; $alt=$name.' - '.$modules_files[$numero]; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 3e9ccbc895f..6bb431bfdfb 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -82,8 +82,8 @@ foreach($phparray as $key => $value) { if (! is_array($keyvalue)) { - $var=!$var; - print '
'.$keyparam.'
'.$keyparam.'
'.dol_trunc($script['file'],80,'left').''.dol_print_date($script['mtime'],'dayhour').''.number_format($script['size'] / 1024, 2).'KB
'.dol_trunc($key['name'],80,'left').''.dol_print_date($key['created'],'dayhour').''.number_format($key['size']/1024, 3).'KB
Information
Caching enabled'.($info['cache']?'yes':'no').'
Optimizer enabled'.$info['optimizer']?'yes':'no'.'
Memory usage'.number_format(100 * $info['memoryAllocated']/$info['memorySize'], 2).'%('.number_format($info['memoryAllocated'] / (1024*1024), 2).'MB / '.number_format($info['memorySize']/(1024*1024), 2).'MB)
Free memory in reserved cache'.number_format($info['memoryAvailable']/(1024*1024), 2).'MB
Cached scripts'.$info['cachedScripts'].'
Removed scripts'.$info['removedScripts'].'
Cached keys'.(isset($info['cachedKeys'])?$info['cachedKeys']:'').'
Caching
Optimizer
Clear cache
Clean cache
Purge cache
"; 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 7d07f7ead94..6d3ee6ced8e 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 */ @@ -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,22 @@ 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(); + setEventMessages($db->lasterror(), null, 'errors'); $action=''; } } @@ -181,7 +180,7 @@ print ''; $head=translation_prepare_head(); -dol_fiche_head($head, $mode, '', 0, ''); +dol_fiche_head($head, $mode, '', -1, ''); if ($mode == 'overwrite') { @@ -210,10 +209,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 +238,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 +250,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 +324,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 +364,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,14 +399,12 @@ 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]) @@ -429,7 +414,7 @@ if ($mode == 'searchkey') } /*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 f76762c8334..42feea8f8ec 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -35,16 +35,83 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $langs->load("admin"); $langs->load("members"); $langs->load("users"); - if (! $user->admin) accessforbidden(); $extrafields = new ExtraFields($db); +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$type='user'; /* * Action */ -if (preg_match('/set_(.*)/',$action,$reg)) + +// Activate a model + +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} +elseif ($action == 'set_default') +{ + $ret = addDocumentModel($value, $type, $label, $scandir); + $res = true; +} + +elseif ($action == 'del_default') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->USER_ADDON_PDF_ODT == "$value") dolibarr_del_const($db, 'USER_ADDON_PDF_ODT',$conf->entity); + } + $res = true; +} + +// Set default model +elseif ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "USER_ADDON_PDF_ODT",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->USER_ADDON_PDF_ODT = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } + $res = true; +} +elseif (preg_match('/set_(.*)/',$action,$reg)) { $code=$reg[1]; if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) @@ -58,7 +125,7 @@ if (preg_match('/set_(.*)/',$action,$reg)) } } -if (preg_match('/del_(.*)/',$action,$reg)) +elseif (preg_match('/del_(.*)/',$action,$reg)) { $code=$reg[1]; if (dolibarr_del_const($db, $code, $conf->entity) > 0) @@ -72,7 +139,7 @@ if (preg_match('/del_(.*)/',$action,$reg)) } } //Set hide closed customer into combox or select -if ($action == 'sethideinactiveuser') +elseif ($action == 'sethideinactiveuser') { $status = GETPOST('status','alpha'); @@ -113,8 +180,8 @@ $var=true; $form = new Form($db); // Mail required for members -$var=!$var; -print ''; + +print ''; print ''; print ''; @@ -138,6 +205,164 @@ print ''; print '
'.$trigger['picto'].''.$trigger['file'].''.$trigger['status'].'
'.$langs->trans("UserMailRequired").' 
'; + + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +$form=new Form($db); + +// Defini tableau def des modeles +$def = array(); +$sql = "SELECT nom"; +$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql.= " WHERE type = '".$type."'"; +$sql.= " AND entity = ".$conf->entity; +$resql=$db->query($sql); +if ($resql) +{ + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} +else +{ + dol_print_error($db); +} + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var=true; +foreach ($dirmodels as $reldir) +{ + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/user".$valdir); + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Defaut + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->USER_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'contract').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
'; +print "
"; + dol_fiche_end(); llxFooter(); diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php new file mode 100644 index 00000000000..db5ef3cbf59 --- /dev/null +++ b/htdocs/admin/usergroup.php @@ -0,0 +1,316 @@ + + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2015 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 + * 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/usergroup.php + * \ingroup core + * \brief Page to setup usergroup module + */ + +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/class/extrafields.class.php'; + +$langs->load("admin"); +$langs->load("members"); +$langs->load("users"); +if (! $user->admin) accessforbidden(); + +$extrafields = new ExtraFields($db); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$type='group'; + +/* + * Action + */ + +// Activate a model + +// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...) +if ($action == 'setModuleOptions') +{ + $post_size=count($_POST); + + $db->begin(); + + for($i=0;$i < $post_size;$i++) + { + if (array_key_exists('param'.$i,$_POST)) + { + $param=GETPOST("param".$i,'alpha'); + $value=GETPOST("value".$i,'alpha'); + if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; + } + } + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + $db->rollback(); + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} +elseif ($action == 'set_default') +{ + $ret = addDocumentModel($value, $type, $label, $scandir); + $res = true; +} + +elseif ($action == 'del_default') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->USERGROUP_ADDON_PDF_ODT == "$value") dolibarr_del_const($db, 'USERGROUP_ADDON_PDF_ODT',$conf->entity); + } + $res = true; +} + +// Set default model +elseif ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "USERGROUP_ADDON_PDF_ODT",$value,'chaine',0,'',$conf->entity)) + { + // La constante qui a ete lue en avant du nouveau set + // on passe donc par une variable pour avoir un affichage coherent + $conf->global->USERGROUP_ADDON_PDF_ODT = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } + $res = true; +} +elseif (preg_match('/set_(.*)/',$action,$reg)) +{ + $code=$reg[1]; + if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + +elseif (preg_match('/del_(.*)/',$action,$reg)) +{ + $code=$reg[1]; + if (dolibarr_del_const($db, $code, $conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} +/* + * View + */ + +$help_url='EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios'; +llxHeader('',$langs->trans("UsersSetup"),$help_url); + +$linkback='
'.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("UsersSetup"),$linkback,'title_setup'); + + +$head=user_admin_prepare_head(); + +dol_fiche_head($head,'usergroupcard', $langs->trans("MenuUsersAndGroups"), 0, 'user'); + + +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + +$form=new Form($db); + +// Defini tableau def des modeles +$def = array(); +$sql = "SELECT nom"; +$sql.= " FROM ".MAIN_DB_PREFIX."document_model"; +$sql.= " WHERE type = '".$type."'"; +$sql.= " AND entity = ".$conf->entity; +$resql=$db->query($sql); +if ($resql) +{ + $i = 0; + $num_rows=$db->num_rows($resql); + while ($i < $num_rows) + { + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; + } +} +else +{ + dol_print_error($db); +} + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var=true; +foreach ($dirmodels as $reldir) +{ + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/usergroup".$valdir); + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Defaut + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

'.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->USERGROUP_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'contract').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
'; +print "
"; + +dol_fiche_end(); + +llxFooter(); +$db->close(); 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 818a38c28df..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 ''; @@ -219,9 +223,11 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); - print '
'; + print '
'; + + print '
'; 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 ' 
'; print '
'; @@ -297,6 +303,8 @@ if ($id > 0 && ! preg_match('/^add/i',$action)) print '
'; + print '
'; + dol_fiche_end(); if ($action == 'edit') 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 ''; @@ -126,8 +131,8 @@ if ($resql) print ''; $linkintern=0; - $title=dol_trunc($obj->title,24); - $link=dol_trunc($obj->url,24); + $title=$obj->title; + $link=$obj->url; // Title print ""; @@ -152,7 +157,7 @@ if ($resql) print "\n"; // Url - 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/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 1f37623544b..a08abdfc545 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -248,6 +248,7 @@ class Categories extends DolibarrApi if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); } + return $obj_ret; } @@ -351,9 +352,47 @@ class Categories extends DolibarrApi $object = parent::_cleanObjectDatas($object); - // Remove the subscriptions because they are handled as a subresource. - //unset($object->subscriptions); - + // Remove fields not relevent to categories + unset($object->country); + unset($object->country_id); + unset($object->country_code); + unset($object->total_ht); + unset($object->total_ht); + unset($object->total_localtax1); + unset($object->total_localtax2); + unset($object->total_ttc); + unset($object->total_tva); + unset($object->lines); + unset($object->fk_incoterms); + unset($object->libelle_incoterms); + unset($object->location_incoterms); + unset($object->civility_id); + unset($object->name); + unset($object->lastname); + unset($object->firstname); + unset($object->shipping_method_id); + unset($object->fk_delivery_address); + unset($object->cond_reglement); + unset($object->cond_reglement_id); + unset($object->mode_reglement_id); + unset($object->barcode_type_coder); + unset($object->barcode_type_label); + unset($object->barcode_type_code); + unset($object->barcode_type); + unset($object->canvas); + unset($object->cats); + unset($object->motherof); + unset($object->context); + unset($object->socid); + unset($object->thirdparty); + unset($object->contact); + unset($object->contact_id); + unset($object->user); + unset($object->fk_account); + unset($object->fk_project); + unset($object->note); + unset($object->statut); + return $object; } diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 6f2f16bb222..271f2900502 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -291,7 +291,7 @@ class CategoryApi extends DolibarrApi * @url GET /customer/{cusid}/categories */ function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { - return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid); + return $this->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $cusid); } /** 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/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php index 8f24e2069aa..a6e2fe2a3f3 100644 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ b/htdocs/cashdesk/tpl/validation2.tpl.php @@ -41,7 +41,7 @@ $langs->load("bills"); -

trans("ShowInvoice"); ?>

+

trans("ShowInvoice"); ?>


trans("PrintTicket"); ?>

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 ''; + 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/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 7140bb09a1e..fc0bbebb901 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -936,7 +936,7 @@ class ActionComm extends CommonObject $response->label = $langs->trans("ActionsToDo"); $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1'; - $response->img = img_object($langs->trans("Actions"),"action"); + $response->img = img_object('',"action"); // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) 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 f8b50fb588a..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,20 +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 $event->getNomUrl(0); - $event->libelle=$savlabel; - } - else - { - print $daterange; - } - //print ' '; - print "
    \n"; } else { @@ -1432,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 @@ -1477,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++; } @@ -1524,10 +1559,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ''."\n"; } - print '
'; - print '
'."\n"; + print ''; // table + print "\n"; } @@ -1535,14 +1570,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa * Change color with a delta * * @param string $color Color - * @param int $minus Delta + * @param int $minus Delta (1 = 16 unit) + * @param int $minusunit Minus unit * @return string New color */ -function dol_color_minus($color, $minus) +function dol_color_minus($color, $minus, $minusunit = 16) { $newcolor=$color; - $newcolor[0]=((hexdec($newcolor[0])-$minus)<0)?0:dechex((hexdec($newcolor[0])-$minus)); - $newcolor[2]=((hexdec($newcolor[2])-$minus)<0)?0:dechex((hexdec($newcolor[2])-$minus)); - $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus)); + if ($minusunit == 16) + { + $newcolor[0]=dechex(max(min(hexdec($newcolor[0])-$minus, 15), 0)); + $newcolor[2]=dechex(max(min(hexdec($newcolor[2])-$minus, 15), 0)); + $newcolor[4]=dechex(max(min(hexdec($newcolor[4])-$minus, 15), 0)); + } + else + { + // Not yet implemented + } return $newcolor; } 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/card.php b/htdocs/comm/card.php index 126c3fe0f62..31def3d1b29 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"; @@ -519,7 +519,7 @@ if ($id > 0) // Lien recap $boxstat.='
'; - $boxstat.='
'; + 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.'
'; + $boxstat.='
'; $boxstat.='"; + + print ''; print '"; + + print ''; print '"; + + print ''; print ''; print '
'; if ($conf->propal->enabled) @@ -639,8 +639,8 @@ if ($id > 0) while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); - $var=!$var; - print "
'; $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; @@ -1094,7 +1094,7 @@ if ($id > 0) else print ''; } - if ($object->client != 0) print ''; + if ($object->client != 0) 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 c967f303648..4bd999b1d5a 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -158,17 +158,17 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) print ''; print ''; - print ''; + print ''; + $var=true; if ($num > 0) { $i = 0; - $var=true; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print '"; } } else { - $var=!$var; - print ''; + + print ''; } print "
'.$langs->trans("ProposalsDraft").($num?' '.$num.'':'').'
'.$langs->trans("ProposalsDraft").($num?' '.$num.'':'').'
'; + + 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)."
'.$langs->trans("NoProposal").'
'.$langs->trans("NoProposal").'

"; @@ -239,17 +239,17 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos print ''; print ''; - print ''; + print ''; + $var=true; if ($num > 0) { $i = 0; - $var=true; while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print '"; } } else { - $var=!$var; - print ''; + + print ''; } print "
'.$langs->trans("SupplierProposalsDraft").($num?' '.$num.'':'').'
'.$langs->trans("SupplierProposalsDraft").($num?' '.$num.'':'').'
'; + + 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)."
'.$langs->trans("NoProposal").'
'.$langs->trans("NoProposal").'

"; @@ -318,17 +318,17 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; print ''; - print ''; + print ''; - if ($num) + $var = true; + if ($num > 0) { $i = 0; - $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print '"; } } else { - $var=!$var; - print ''; + + print ''; } print "
'.$langs->trans("DraftOrders").($num?' '.$num.'':'').'
'.$langs->trans("DraftOrders").($num?' '.$num.'':'').'
'; + 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)."
'.$langs->trans("NoOrder").'
'.$langs->trans("NoOrder").'

"; @@ -399,17 +399,17 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande print ''; print ''; - print ''; + print ''; - if ($num) + $var = true; + if ($num > 0) { $i = 0; - $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print '"; } } else { - $var=!$var; - print ''; + + print ''; } print "
'.$langs->trans("DraftSuppliersOrders").($num?' '.$num.'':'').'
'.$langs->trans("DraftSuppliersOrders").($num?' '.$num.'':'').'
'; + 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)."
'.$langs->trans("NoSupplierOrder").'
'.$langs->trans("NoSupplierOrder").'

"; @@ -485,12 +485,12 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) print ''; print ''; - print ''; + print ''; + print ''; print ''; if ($num) { @@ -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 ''; print '"; print ''; $i++; - $var=!$var; + } @@ -519,7 +519,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) } else { - print ''; + print ''; } print "
'; + print ''; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max); else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); else print $langs->trans("BoxTitleLastModifiedCustomers",$max); - print ''; - print ''.$langs->trans("DateModificationShort").''.$langs->trans("DateModificationShort").'
'.$companystatic->getNomUrl(1,'customer',48).''; 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')."
'.$langs->trans("None").'
'.$langs->trans("None").'

"; } @@ -549,8 +549,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $i = 0; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($num) { @@ -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 ''; print ''; print ''; - $var=!$var; + $i++; } } else { - print ''; + print ''; } print '
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("DateModificationShort").'
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("DateModificationShort").'
'.$companystatic->getNomUrl(1,'supplier',44).''.dol_print_date($db->jdate($objp->dm),'day').'
'.$langs->trans("None").'
'.$langs->trans("None").'

'; } @@ -628,7 +628,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO if ($num > 0) { print ''; - print ''; + print ''; $i = 0; $staticcontrat=new Contrat($db); @@ -647,7 +647,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO print $companystatic->getNomUrl(1,'customer',44); print ''."\n"; print "\n"; - $var=!$var; + $i++; } print "
'.$langs->trans("LastContracts",5).'
'.$langs->trans("LastContracts",5).'
".$staticcontrat->LibStatut($obj->statut,3)."

"; @@ -689,14 +689,14 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $var=true; print ''; - print ''; + print ''; $nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; // Ref print ''; print ''; print ''; } // Public note print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; @@ -263,8 +263,8 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; - print '"; - print '
'.$langs->trans("ProposalsOpened").' '.$num.'
'.$langs->trans("ProposalsOpened").' '.$num.'
'; @@ -788,14 +788,14 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $var=true; print ''; - print ''; + print ''; $nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; // Ref 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 ''; print ''; print ''; 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 '
'.$langs->trans("OrdersOpened").' '.$num.'
'.$langs->trans("OrdersOpened").' '.$num.'
'; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index ea4b21d78be..13ea930dc5e 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -259,8 +259,8 @@ 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) { @@ -433,7 +433,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) @@ -846,11 +847,6 @@ else print ''; -/* print ''; - print ''; -*/ // Description print ''; - - // Status - /* - print ''; - */ // Nb of distinct emails print ''; @@ -1191,7 +1180,7 @@ else $htmltext.=''; // Print mail content - print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); dol_fiche_head(); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 470ee2a4ec1..16f3f4db561 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -229,7 +229,7 @@ if ($object->fetch($id) >= 0) print ""; - $var=!$var; + $allowaddtarget=($object->statut == 0); @@ -311,7 +311,7 @@ if ($object->fetch($id) >= 0) if ($qualified) { $var = !$var; - //print ''; + //print ''; // print '
'; if ($allowaddtarget) @@ -523,9 +523,9 @@ if ($object->fetch($id) >= 0) { $obj = $db->fetch_object($resql); - $var=!$var; + - print "
"; + print ''; print ''; print ''; 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 '
'.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); @@ -865,13 +861,6 @@ else print '
'.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); print '
'.$langs->trans("Status").''.$object->getLibStatut(4); - if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; - print'
'; @@ -1062,7 +1051,7 @@ else $htmltext.=''; // Print mail content - print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); dol_fiche_head(''); @@ -1085,7 +1074,7 @@ else } else { - print $langs->trans("NoAttachedFiles").'
'; + print ''.$langs->trans("NoAttachedFiles").'
'; } print '
'.$obj->email.''.$obj->lastname.''.$obj->firstname.'
'; 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 '
'.img_object($langs->trans("ShowEMail"),"email").' '.$obj->rowid.''.dol_trunc($obj->titre,38).''.dol_print_date($db->jdate($obj->date_creat),'day').'
'."\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/apercu.php b/htdocs/comm/propal/apercu.php deleted file mode 100644 index cdeacefafe1..00000000000 --- a/htdocs/comm/propal/apercu.php +++ /dev/null @@ -1,224 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2007 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2014 Frederic France - * - * 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/comm/propal/apercu.php - * \ingroup propal - * \brief Preview tab of propal - */ - -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - -$langs->load('propal'); -$langs->load("bills"); -$langs->load('compta'); - -// Security check -$socid=0; -$id = GETPOST('id','int'); -$ref = GETPOST("ref"); -if ($user->societe_id) $socid=$user->societe_id; -$result = restrictedArea($user, 'propal', $id); - - -/* - * View Mode - */ - -$form = new Form($db); - -llxHeader(); - -if ($id > 0 || ! empty($ref)) -{ - $object = new Propal($db); - - if ($object->fetch($id,$ref) > 0) - { - $soc = new Societe($db); - $soc->fetch($object->socid); - - $head = propal_prepare_head($object); - dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal'); - - - /* - * Propal - */ - print '
'; print ''; print '
'; print img_object($langs->trans("ShowEMail"),"email").' '.stripslashes($obj->rowid).''.$obj->titre.'
'; - - $linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Ref client - print ''; - print ''; - print ''; - - - // Thirdparty - print ''; - print ''; - print ''; - - // Status - print ''; - print ''; - print ''; - - // Discount - print ''; - print ''; - - // Date - print ''; - print ''; - - // Right part with $rowspan lines - $rowspan=4; - print ''; - print ''; - - // Total HT - left part - print ''; - print ''; - print ''; - - // Total VAT - left part - print ''; - print ''; - print ''; - - // Total TTC - left part - print ''; - print ''; - print ''; - - print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''; - if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$soc->getAvailableDiscounts(); - print '. '; - if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); - else print $langs->trans("CompanyHasNoAbsoluteDiscount"); - print '.
'.$langs->trans('Date').''.dol_print_date($object->date,'daytext').''; - - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->propal->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; - $relativepath = $objectref.'/'.$objectref.'.pdf'; - $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; - - // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page - $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page - $relativepathimage = $relativepath.'_preview.png'; - - $var=true; - - // Si fichier PDF existe - if (file_exists($file)) - { - $encfile = urlencode($file); - print ''; - print ''; - - print ''; - - print ''; - - print ''; - print ''; - print ''; - - print "
'.$langs->trans("Documents").'
'.$langs->trans("Proposal").' PDF'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file),'dayhour').'
\n"; - - // Conversion du PDF en image png si fichier png non existant - if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - } - - print '
'.$langs->trans('AmountHT').'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; - - dol_fiche_end(); - } - else - { - // Propal non trouvee - print $langs->trans("ErrorPropalNotFound",$_GET["id"]); - } -} - -print ''; -print ''; -print '
'; -print '
'; -// Si fichier png PDF d'1 page trouve -if (file_exists($fileimage)) -{ - print ''; -} -// Si fichier png PDF de plus d'1 page trouve -elseif (file_exists($fileimagebis)) -{ - $multiple = preg_replace('/\.png/','',$relativepath) . "-"; - - for ($i = 0; $i < 20; $i++) - { - $preview = $multiple.$i.'.png'; - - if (file_exists($dir_output.$preview)) - { - print '

'; - } - } -} -print '

'; -print '
'; - - -llxFooter(); - -$db->close(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b1a37c67b31..444669a6f49 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1321,8 +1321,18 @@ if ($action == 'create') // Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; + + if (!empty($conf->multicurrency->enabled)) + { + if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + } } } + else + { + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; + } $object = new Propal($db); @@ -1500,14 +1510,13 @@ if ($action == 'create') print '
'.fieldLabel('Currency','multicurrency_code').''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print '
' . $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%'); @@ -1517,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%'); @@ -1666,7 +1675,7 @@ if ($action == 'create') $soc->fetch($object->socid); $head = propal_prepare_head($object); - dol_fiche_head($head, 'comm', $langs->trans('Proposal'), 0, 'propal'); + dol_fiche_head($head, 'comm', $langs->trans('Proposal'), -1, 'propal'); $formconfirm = ''; @@ -1795,42 +1804,7 @@ if ($action == 'create') print ''; - // Ref - /* - print ''; - */ - - // Ref customer - /* - print ''; - print ''; - */ - - // Company - /* - print ''; - print '';*/ - - // Lin for thirdparty discounts + // Link for thirdparty discounts 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 "
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'; - print ''; - if ($action != 'refclient' && ! empty($object->brouillon)) - print ''; - print '
'; - print $langs->trans('RefCustomer') . '' . img_edit($langs->trans('Modify')) . '
'; - print '
'; - if ($user->rights->propal->creer && $action == 'refclient') { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } else { - print $object->ref_client; - } - print '
' . $langs->trans('Company') . '' . $soc->getNomUrl(1) . '
' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount", $soc->remise_percent); @@ -2038,7 +2012,7 @@ if ($action == 'create') print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + 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 '
'; @@ -2049,7 +2023,7 @@ if ($action == 'create') $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 != $conf->currency) { + if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; @@ -2383,7 +2357,7 @@ if ($action == 'create') { if (! empty($conf->facture->enabled) && $user->rights->facture->creer) { - print ''; + print ''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); @@ -2414,7 +2388,6 @@ if ($action == 'create') print ''; } - print "
\n"; //Select mail models is same action as presend if (GETPOST('modelselected')) $action = 'presend'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 765179c3d63..3489860e1dd 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3027,7 +3027,7 @@ class Propal extends CommonObject $response->label = $label; $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; - $response->img = img_object($langs->trans("Propals"),"propal"); + $response->img = img_object('',"propal"); // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 8588bfc5749..3c3aa6aef88 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -151,7 +151,7 @@ $formother = new FormOther($db); if ($object->id > 0) { $head = propal_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal'); + dol_fiche_head($head, 'contact', $langs->trans("Proposal"), -1, 'propal'); // Proposal card diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 9b875e434f7..82244886763 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -89,10 +89,10 @@ if ($object->id > 0) $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $head = propal_prepare_head($object); - dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); + 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/info.php b/htdocs/comm/propal/info.php index 14a4911b80f..d8af8fb87a8 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -59,7 +59,7 @@ llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_c $object->fetch_thirdparty(); $head = propal_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal'); +dol_fiche_head($head, 'info', $langs->trans('Proposal'), -1, 'propal'); $object->info($object->id); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index aa6df1afb2b..ce6d6e2bc72 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -556,49 +556,12 @@ 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"; - - // Fields title - print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$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['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$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['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 ''."\n"; - - print ''; + + print ''; if (! empty($arrayfields['p.ref']['checked'])) { print ''; print "\n"; + + // Fields title + print ''; + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$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['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$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['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="center"',$sortfield,$sortorder,'maxwidthsearch '); + print ''."\n"; + $now = dol_now(); $i=0; - $var=true; $totalarray=array(); 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']++; @@ -977,7 +978,12 @@ if ($resql) } // Show total line - if (isset($totalarray['totalhtfield'])) + if (isset($totalarray['totalhtfield']) + || isset($totalarray['totalvatfield']) + || isset($totalarray['totalttcfield']) + || isset($totalarray['totalamfield']) + || isset($totalarray['totalrtpfield']) + ) { print ''; $i=0; diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 57181b83f6b..ec1dac31c24 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -74,7 +74,7 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch_thirdparty() > 0) { $head = propal_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal'); + dol_fiche_head($head, 'note', $langs->trans('Proposal'), -1, 'propal'); $cssclass='titlefield'; //if ($action == 'editnote_public') $cssclass='titlefieldcreate'; 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 '
'; @@ -733,25 +696,63 @@ if ($resql) } // Action column 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.'
'; + + 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 82269434638..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,20 +119,21 @@ if ($socid > 0) // Discount print '
'; print $langs->trans("CustomerRelativeDiscount").''.price2num($object->remise_percent)."%
'; print '
'; print load_fiche_titre($langs->trans("NewRelativeDiscount"),'',''); + print '
'; + print ''; // New value - print ''; // Motif/Note - print ''; print "
'; + print '
'; print $langs->trans("NewValue").'%
'; + print '
'; print $langs->trans("NoteReason").'
"; @@ -177,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 9e781139723..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/apercu.php b/htdocs/commande/apercu.php deleted file mode 100644 index 1ec3a0533cc..00000000000 --- a/htdocs/commande/apercu.php +++ /dev/null @@ -1,223 +0,0 @@ - - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent - * Copyright (C) 2014 Frederic France - * - * 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/commande/apercu.php - * \ingroup commande - * \brief Preview tab of order - */ - -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; - -$langs->load('orders'); -$langs->load("bills"); -$langs->load('compta'); - -// Security check -$socid=0; -$id = GETPOST('id','int'); -$ref = GETPOST("ref"); -if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'commande',$id,''); - - -/* - * View Mode - */ - -$form = new Form($db); - -llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); - -if ($id > 0 || ! empty($ref)) -{ - $object = new Commande($db); - - if ($object->fetch($id,$ref) > 0) - { - $soc = new Societe($db); - $soc->fetch($object->socid); - - - $head = commande_prepare_head($object); - dol_fiche_head($head, 'preview', $langs->trans("CustomerOrder"), 0, 'order'); - - print ''; - - //$linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Ref cde client - print ''; - print ''; - print ''; - - // Client - print ''; - print ''; - print ''; - - // Statut - print ''; - print ''; - print ''; - - // Discount - left part - print ''; - print ''; - print ''; - - // Date - left part - print ''; - print ''; - - // Right part with $rowspan lines - $rowspan=4; - print ''; - - // Total HT - left part - print ''; - print ''; - print ''; - - // Total VAT - left part - print ''; - print ''; - print ''; - - // Total TTC - left part - print ''; - print ''; - print ''; - - print '
' . $langs->trans('Ref') . ''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans('RefCustomer').''.$object->ref_client.'
'.$langs->trans("Customer").''.$soc->getNomUrl(1).'
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'.$langs->trans('Discounts').''.$object->remise_percent.'%
'.$langs->trans("Date").''.dol_print_date($object->date,"daytext").''; - - /* - * Documents - */ - $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->commande->dir_output . "/"; - $filepath = $dir_output . $objectref . "/"; - $file = $filepath . $objectref . ".pdf"; - $filedetail = $filepath . $objectref . "-detail.pdf"; - $relativepath = $objectref.'/'.$objectref.'.pdf'; - $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; - - // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") - $fileimage = $file.'_preview.png'; // If PDF has 1 page - $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page - $relativepathimage = $relativepath.'_preview.png'; - - $var=true; - - // if PDF file exist - if (file_exists($file)) - { - $encfile = urlencode($file); - print ''; - print ''; - - print ""; - - print ''; - print ''; - print ''; - print ''; - - // Si fichier detail PDF existe - // TODO deprecated ? - if (file_exists($filedetail)) - { - print ""; - - print ''; - print ''; - print ''; - print ''; - } - print "
'.$langs->trans("Documents").'
".$langs->trans("Order")." PDF'.$object->ref.'.pdf'.dol_print_size(dol_filesize($file)).''.dol_print_date(dol_filemtime($file),'dayhour').'
Commande detaillee'.$object->ref.'-detail.pdf'.dol_print_size(dol_filesize($filedetail)).''.dol_print_date(dol_filemtime($filedetail),'dayhour').'
\n"; - - // Conversion du PDF en image png si fichier png non existant - if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file))) - { - if (class_exists("Imagick")) - { - $ret = dol_convert_file($file,'png',$fileimage); - if ($ret < 0) $error++; - } - else - { - $langs->load("errors"); - print ''.$langs->trans("ErrorNoImagickReadimage").''; - } - } - } - - print '
'.$langs->trans('AmountHT').'' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountVAT').'' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').'' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '
'; - - dol_fiche_end(); - } - else - { - // Object not found - print $langs->trans("ErrorOrderNotFound",$id); - } -} - -print ''; -print ''; -print '
'; -print '
'; -// Si fichier png PDF d'1 page trouve -if (file_exists($fileimage)) -{ - print ''; -} -// Si fichier png PDF de plus d'1 page trouve -elseif (file_exists($fileimagebis)) -{ - $multiple = preg_replace('/\.png/','',$relativepath) . "-"; - - for ($i = 0; $i < 20; $i++) - { - $preview = $multiple.$i.'.png'; - - if (file_exists($dir_output.$preview)) - { - print '

'; - } - } -} -print '

'; -print '
'; - - -llxFooter(); - -$db->close(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index e5c78c75f04..e369a1a7217 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -64,6 +64,7 @@ $langs->load('propal'); $langs->load('deliveries'); $langs->load('sendings'); $langs->load('products'); +$langs->load('other'); if (!empty($conf->incoterm->enabled)) $langs->load('incoterm'); if (! empty($conf->margin->enabled)) $langs->load('margins'); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); @@ -1254,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'; @@ -1768,7 +1765,7 @@ if ($action == 'create' && $user->rights->commande->creer) $res = $object->fetch_optionals($object->id, $extralabels); $head = commande_prepare_head($object); - dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), 0, 'order'); + dol_fiche_head($head, 'order', $langs->trans("CustomerOrder"), -1, 'order'); $formconfirm = ''; @@ -2008,7 +2005,7 @@ if ($action == 'create' && $user->rights->commande->creer) $addrelativediscount = '' . $langs->trans("EditRelativeDiscounts") . ''; $addabsolutediscount = '' . $langs->trans("EditGlobalDiscounts") . ''; - $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; + $addcreditnote = '' . $langs->trans("AddCreditNote") . ''; print '' . $langs->trans('Discounts') . ''; if ($soc->remise_percent) @@ -2054,7 +2051,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; } else { - print $object->date ? dol_print_date($object->date, 'daytext') : ' '; + print $object->date ? dol_print_date($object->date, 'day') : ' '; if ($object->hasDelay() && empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } @@ -2187,7 +2184,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + 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 ''; @@ -2198,7 +2195,7 @@ if ($action == 'create' && $user->rights->commande->creer) $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 != $conf->currency) { + if($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) { print '
        '; print ''.$langs->trans("ActualizeCurrency").''; print '
'; @@ -2540,7 +2537,7 @@ if ($action == 'create' && $user->rights->commande->creer) // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" if ($object->statut > Commande::STATUS_DRAFT && ! $object->billed) { if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) { - print ''; + print ''; } if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { print ''; @@ -2588,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; @@ -2650,6 +2646,7 @@ if ($action == 'create' && $user->rights->commande->creer) $file = $fileparams['fullname']; } + print '
'; print '
'; print '
'; print load_fiche_titre($langs->trans('SendOrderByMail')); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7bad08b2f84..e87923beb8c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3102,6 +3102,8 @@ class Commande extends CommonOrder $error = 0; + dol_syslog(get_class($this) . "::delete ".$this->id, LOG_DEBUG); + $this->db->begin(); if (! $error && ! $notrigger) @@ -3117,7 +3119,6 @@ class Commande extends CommonOrder { // Delete order details $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE fk_commande = ".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { $error++; @@ -3126,7 +3127,6 @@ class Commande extends CommonOrder // Delete order $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande WHERE rowid = ".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { $error++; @@ -3184,7 +3184,6 @@ class Commande extends CommonOrder if (! $error) { - dol_syslog(get_class($this)."::delete $this->id by $user->id", LOG_DEBUG); $this->db->commit(); return 1; } @@ -3192,7 +3191,6 @@ class Commande extends CommonOrder { foreach($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); $this->error.=($this->error?', '.$errmsg:$errmsg); } $this->db->rollback(); @@ -3233,7 +3231,7 @@ class Commande extends CommonOrder $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; - $response->img=img_object($langs->trans("Orders"),"order"); + $response->img=img_object('',"order"); $generic_commande = new Commande($this->db); diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index f693d09da52..bc257f3ac05 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -143,7 +143,7 @@ if ($id > 0 || ! empty($ref)) $object->fetch_thirdparty(); $head = commande_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order'); + dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), -1, 'order'); // Order card 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 5ce456fe8e0..ef4f220f3e4 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -92,10 +92,10 @@ if ($id > 0 || ! empty($ref)) $upload_dir = $conf->commande->dir_output.'/'.dol_sanitizeFileName($object->ref); $head = commande_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order'); + 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 24e07b5ab07..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"; } @@ -119,7 +119,7 @@ if ($resql) } $db->free($resql); print ''; - print ''."\n"; + print ''."\n"; $listofstatus=array(0,1,2,3,3,-1); $bool=false; foreach ($listofstatus as $status) @@ -141,8 +141,8 @@ if ($resql) { if (! $conf->use_javascript_ajax) { - $var=!$var; - print ""; + + print ''; print ''; print ''; // Landing page - $var=!$var; - print ''; + + print ''; print ''; @@ -253,8 +259,8 @@ if ($action == 'edit') print ''; // Langue par defaut - $var=!$var; - print ''; + + print ''; print ''; // Taille max des listes - $var=!$var; - print ''; + + print ''; print ''; print ''; // Landing page - $var=!$var; - print ''; + + print ''; print ''; @@ -323,8 +329,8 @@ else print ''; // Language - $var=!$var; - print ''; + + print ''; print ''; - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index cb38d1c9e49..f7acc3609c7 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -214,11 +214,11 @@ $rowspan=2; $urllogo=DOL_URL_ROOT.'/theme/login_logo.png'; if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('thumbs/'.$mysoc->logo_small); } elseif (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($mysoc->logo); $width=128; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 95c3eb6c87f..e84cfe09ca8 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -125,7 +125,7 @@ $form=new Form($db); $head = user_prepare_head($object); $title = $langs->trans("User"); -dol_fiche_head($head, 'rights', $title, 0, 'user'); +dol_fiche_head($head, 'rights', $title, -1, 'user'); $db->begin(); @@ -257,7 +257,11 @@ else * Ecran ajout/suppression permission */ -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''; + +if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; +} dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index ae921114d6b..a611767cf2f 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -1,5 +1,4 @@ * * This program is free software; you can redistribute it and/or modify @@ -28,10 +27,10 @@ $ref = GETPOST('ref'); $confirm = GETPOST('confirm'); $cancel = GETPOST('cancel'); -$prodattr = new ProductAttribute($db); -$prodattrval = new ProductAttributeValue($db); +$object = new ProductAttribute($db); +$objectval = new ProductAttributeValue($db); -if ($prodattr->fetch($id) < 1) { +if ($object->fetch($id) < 1) { dol_print_error($db, $langs->trans('ErrorRecordNotFound')); exit(); } @@ -47,10 +46,10 @@ if ($_POST) { if ($action == 'edit') { - $prodattr->label = $label; - $prodattr->ref = $ref; + $object->label = $label; + $object->ref = $ref; - if ($prodattr->update() < 1) { + if ($object->update() < 1) { setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); } else { setEventMessage($langs->trans('RecordSaved')); @@ -59,19 +58,19 @@ if ($_POST) { } } elseif ($action == 'edit_value') { - if ($prodattrval->fetch($valueid) > 0) { + if ($objectval->fetch($valueid) > 0) { - $prodattrval->ref = $ref; - $prodattrval->value = GETPOST('value'); + $objectval->ref = $ref; + $objectval->value = GETPOST('value'); - if ($prodattrval->update() > 0) { + if ($objectval->update() > 0) { setEventMessage($langs->trans('RecordSaved')); } else { setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); } } - header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2)); + header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); exit(); } @@ -82,12 +81,12 @@ if ($confirm == 'yes') { $db->begin(); - $res = $prodattrval->deleteByFkAttribute($prodattr->id); + $res = $objectval->deleteByFkAttribute($object->id); - if ($res < 1 || ($prodattr->delete() < 1)) { + if ($res < 1 || ($object->delete() < 1)) { $db->rollback(); setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); - header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2)); + header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); } else { $db->commit(); setEventMessage($langs->trans('RecordSaved')); @@ -97,15 +96,15 @@ if ($confirm == 'yes') { exit(); } elseif ($action == 'confirm_deletevalue') { - if ($prodattrval->fetch($valueid) > 0) { + if ($objectval->fetch($valueid) > 0) { - if ($prodattrval->delete() < 1) { + if ($objectval->delete() < 1) { setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); } else { setEventMessage($langs->trans('RecordSaved')); } - header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2)); + header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); exit(); } } @@ -118,38 +117,50 @@ if ($confirm == 'yes') { $langs->load('products'); -$title = $langs->trans('ProductAttributeName', dol_htmlentities($prodattr->label)); +$title = $langs->trans('ProductAttributeName', dol_htmlentities($object->label)); $var = false; llxHeader('', $title); -print_fiche_titre($title); +//print_fiche_titre($title); -dol_fiche_head(); +$h=0; +$head[$h][0] = DOL_URL_ROOT.'/variants/card.php?id='.$object->id; +$head[$h][1] = $langs->trans("Card"); +$head[$h][2] = 'variant'; +$h++; + +dol_fiche_head($head, 'variant', $langs->trans('ProductAttributeName'), -1, 'generic'); if ($action == 'edit') { - print ''; + print ''; } + +if ($action != 'edit') +{ + print '
'; + print '
'; +} ?>
'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'
'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'
'.$commandestatic->LibStatut($status,$bool,0).''.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' '; print $commandestatic->LibStatut($status,$bool,3); @@ -187,7 +187,7 @@ if (! empty($conf->commande->enabled)) { print ''; print ''; - print ''; + print ''; $langs->load("orders"); $num = $db->num_rows($resql); if ($num) @@ -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 '"; @@ -220,8 +220,8 @@ if (! empty($conf->commande->enabled)) } else { - $var=!$var; - print ''; + + print ''; } print "
'.$langs->trans("DraftOrders").'
'.$langs->trans("DraftOrders").'
'; print $commandestatic->getNomUrl(1); print "
'.$langs->trans("NoOrder").'
'.$langs->trans("NoOrder").'

"; } @@ -259,7 +259,7 @@ if ($resql) { print ''; print ''; - print ''; + print ''; $num = $db->num_rows($resql); if ($num) @@ -268,10 +268,10 @@ if ($resql) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; } @@ -297,7 +307,7 @@ if ($result > 0) $userstatic->id=$obj->userid; $userstatic->lastname=$obj->lastname; $userstatic->firstname=$obj->firstname; - print ''; print ''; }*/ - if ($user->admin) + /*if ($user->admin) { $var = ! $var; - print ''; - } + }*/ print '
'.$langs->trans("LastModifiedOrders",$max).'
'.$langs->trans("LastModifiedOrders",$max).'
'; $commandestatic->id=$obj->rowid; @@ -341,7 +341,7 @@ if (! empty($conf->commande->enabled)) print ''; print ''; - print ''; + print ''; if ($num) { @@ -349,9 +349,9 @@ if (! empty($conf->commande->enabled)) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; - print_liste_field_titre(''); print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); @@ -703,21 +727,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') { print ''; - // Photo - print ''; - - // Name - Position + // Photo - Name print ''; - // Address / Phone + // Position print ''; - // Email + // Address - Phone - Email print ''; // Status @@ -744,7 +763,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') while ($i < $num) { $obj = $db->fetch_object($result); - $var = !$var; $contactstatic->id = $obj->rowid; $contactstatic->ref = $obj->ref; @@ -770,16 +788,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic->setGenderFromCivility(); - print ""; + print ""; - // Photo - print ''; - - // Name + // Photo - Name print ''; // Job position @@ -787,7 +801,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if ($obj->poste) print $obj->poste; print ''; - // Address and phone + // Address - Phone - Email print ''; @@ -879,7 +893,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') { $var = !$var; - print ""; + print ''; print '"; + //print ''; //print ''; //print "\n"; } @@ -958,7 +972,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac * @param Contact $objcon Object contact * @param int $noprint Return string but does not output it * @param string $actioncode Filter on actioncode - * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter. + * @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all). * @param array $filters Filter on other fields * @param string $sortfield Sort field * @param string $sortorder Sort order @@ -990,7 +1004,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_user_author, a.fk_contact,"; $sql.= " c.code as acode, c.libelle as alabel, c.picto as apicto,"; - $sql.= " u.login, u.rowid as user_id"; + $sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; if (get_class($filterobj) == 'Societe') $sql.= ", sp.lastname, sp.firstname"; if (get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname"; if (get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref"; @@ -1063,9 +1077,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= 'dateend'=>$db->jdate($obj->dp2), 'note'=>$obj->label, 'percent'=>$obj->percent, + 'userid'=>$obj->user_id, - 'login'=>$obj->login, - 'contact_id'=>$obj->fk_contact, + 'login'=>$obj->user_login, + 'userfirstname'=>$obj->user_firstname, + 'userlastname'=>$obj->user_lastname, + 'userphoto'=>$obj->user_photo, + + 'contact_id'=>$obj->fk_contact, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'fk_element'=>$obj->fk_element, @@ -1094,7 +1113,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $sql = "SELECT m.rowid as id, mc.date_envoi as da, m.titre as note, '100' as percentage,"; $sql.= " 'AC_EMAILING' as acode,"; - $sql.= " u.rowid as user_id, u.login"; // User that valid action + $sql.= " u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE mc.email = '".$db->escape($objcon->email)."'"; // Search is done on email. $sql.= " AND mc.statut = 1"; @@ -1121,8 +1140,12 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= 'note'=>$obj->note, 'percent'=>$obj->percentage, 'acode'=>$obj->acode, - 'userid'=>$obj->user_id, - 'login'=>$obj->login + + 'userid'=>$obj->user_id, + 'login'=>$obj->user_login, + 'userfirstname'=>$obj->user_firstname, + 'userlastname'=>$obj->user_lastname, + 'userphoto'=>$obj->user_photo ); $numaction++; $i++; @@ -1174,54 +1197,55 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.='
'; $out.='
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("OrdersToProcess").' '.$num.'
'; $commandestatic->id=$obj->rowid; @@ -423,7 +423,7 @@ if (! empty($conf->commande->enabled)) print ''; print ''; - print ''; + print ''; if ($num) { @@ -431,9 +431,9 @@ if (! empty($conf->commande->enabled)) $var = true; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index ace00b77caa..f4902e4912e 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -66,6 +66,7 @@ class FormContract //if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")"; if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; + $sql.= " ORDER BY c.ref "; dol_syslog(get_class($this)."::select_contract", LOG_DEBUG); $resql=$db->query($sql); @@ -129,6 +130,14 @@ class FormContract } print ''; $db->free($resql); + + if (!empty($conf->use_javascript_ajax)) + { + // Make select dynamic + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + print ajax_combobox($htmlname); + } + return $num; } else diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index e80ff8008df..8d90892cfb6 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -89,6 +89,11 @@ class FormFile } else { + //If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed + if (!$perm && !empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { + return 1; + } + $maxlength=$size; $out = "\n\n\n"; @@ -229,7 +234,7 @@ class FormFile * @param integer $allowgenifempty Show warning if no model activated * @param integer $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param int $iconPDF Show only PDF icon with link (1/0) - * @param int $maxfilenamelength Max length for filename shown + * @param int $notused Not used * @param integer $noform Do not output html form tags * @param string $param More param on http links * @param string $title Title to show on top of form @@ -238,10 +243,10 @@ class FormFile * @return int <0 if KO, number of shown files if OK * @deprecated Use print xxx->showdocuments() instead. */ - function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') + function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') { $this->numoffiles=0; - print $this->showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang); + print $this->showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$notused,$noform,$param,$title,$buttonlabel,$codelang); return $this->numoffiles; } @@ -259,7 +264,7 @@ class FormFile * @param integer $allowgenifempty Allow generation even if list of template ($genallowed) is empty (show however a warning) * @param integer $forcenomultilang Do not show language option (even if MAIN_MULTILANGS defined) * @param int $iconPDF Deprecated, see getDocumentsLink - * @param int $maxfilenamelength Max length for filename shown + * @param int $notused Not used * @param integer $noform Do not output html form tags * @param string $param More param on http links * @param string $title Title to show on top of form @@ -269,7 +274,7 @@ class FormFile * @param Object $object Object when method is called from an object card. * @return string Output string with HTML array of documents (might be empty string) */ - function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null) + function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null) { // Deprecation warning if (0 !== $iconPDF) { @@ -297,7 +302,6 @@ class FormFile $hookmanager->initHooks(array('formfile')); $forname='builddoc'; $out=''; - $var=true; $headershown=0; $showempty=0; @@ -308,7 +312,7 @@ class FormFile if (preg_match('/massfilesarea_/', $modulepart)) { - $out.='
'; + $out.='

'; $title=$langs->trans("MassFilesArea").' ('.$langs->trans("Hide").')'; $title.=''; + if ($addlink) $out.=' '.$langs->trans("Link").''; + return $out; +} + /** * Convert a html select field into an ajax combobox. * Use ajax_combobox() only for small combo list! If not, use instead ajax_autocompleter(). @@ -377,12 +396,12 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ $(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({ dir: \'ltr\', width: \''.$widthTypeOfAutocomplete.'\', /* off or resolve */ - minimumInputLength: '.$minLengthToAutocomplete.' + minimumInputLength: '.$minLengthToAutocomplete.' })'; if ($forcefocus) $msg.= '.select2(\'focus\')'; $msg.= ';'."\n"; - if (count($events)) + if (count($events)) // If an array of js events to do were provided. { $msg.= ' jQuery("#'.$htmlname.'").change(function () { @@ -395,6 +414,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ }); function runJsCodeForEvent'.$htmlname.'(obj) { + console.log("Run runJsCodeForEvent'.$htmlname.'"); var id = $("#'.$htmlname.'").val(); var method = obj.method; var url = obj.url; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 47d3539e3ba..c88a0b7afed 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -77,7 +77,7 @@ function bank_prepare_head(Account $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT . "/compta/bank/document.php?account=" . $object->id; $head[$h][1] = $langs->trans("Documents"); @@ -91,6 +91,11 @@ function bank_prepare_head(Account $object) // $this->tabs = array('entity:-tabname); to remove a tab complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank'); + /*$head[$h][0] = DOL_URL_ROOT . "/compta/bank/info.php?id=" . $object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++;*/ + complete_head_from_modules($conf, $langs, $object, $head, $h, 'bank', 'remove'); return $head; @@ -134,6 +139,51 @@ function bank_admin_prepare_head($object) return $head; } +/** + * Prepare array with list of tabs + * + * @param Object $object Object related to tabs + * @return array Array of tabs to shoc + */ +function various_payment_prepare_head($object) { + + global $db, $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$object->id; + $head[$h][1] = $langs->trans("Card"); + $head[$h][2] = 'card'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment'); + + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; + $upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); + $nbLinks=Link::count($db, $object->element, $object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id; + $head[$h][1] = $langs->trans('Documents'); + if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; + $head[$h][2] = 'documents'; + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/info.php?id='.$object->id; + $head[$h][1] = $langs->trans("Info"); + $head[$h][2] = 'info'; + $h++; + + complete_head_from_modules($conf,$langs,$object,$head,$h,'various_payment', 'remove'); + + return $head; +} + /** * Check SWIFT informations for a bank account * diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 2e809fa6c3b..809a045bacf 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -43,7 +43,7 @@ function societe_prepare_head(Societe $object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/societe/soc.php?socid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/societe/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'card'; $h++; @@ -215,7 +215,7 @@ function societe_prepare_head(Societe $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id ; - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/societe/document.php?socid='.$object->id; @@ -259,7 +259,7 @@ function societe_prepare_head2($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/societe/soc.php?socid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/societe/card.php?socid='.$object->id; $head[$h][1] = $langs->trans("Card"); $head[$h][2] = 'company'; $h++; @@ -531,10 +531,13 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin print "\n"; print load_fiche_titre($langs->trans("ProjectsDedicatedToThisThirdParty"),$buttoncreate,''); + print '
'; print "\n".'
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("OnProcessOrders").' '.$num.'
'; $commandestatic->id=$obj->rowid; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 58b445c8ce7..02b631c4c8a 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -53,13 +53,15 @@ if (! $object->fetch($id, $ref) > 0) * View */ +$form = new Form($db); + llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); $object->fetch_thirdparty(); $object->info($object->id); $head = commande_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); +dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), -1, 'order'); // Order card diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f92836599de..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,49 +837,12 @@ 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"; - // Fields title - print ''; - if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$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['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'],$_SERVER["PHP_SELF"],'c.tva','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$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['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - 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 ''."\n"; - - print ''; + print ''; // Ref if (! empty($arrayfields['c.ref']['checked'])) { @@ -1030,12 +989,50 @@ if ($resql) } // Action column print ''; print "\n"; + // Fields title + print ''; + if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'],$_SERVER["PHP_SELF"],'c.ref','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['c.ref_client']['checked'])) print_liste_field_titre($arrayfields['c.ref_client']['label'],$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$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['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'],$_SERVER["PHP_SELF"],'c.tva','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$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['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + 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="center"',$sortfield,$sortorder,'maxwidthsearch '); + print ''."\n"; + $total=0; $subtotal=0; $productstat_cache=array(); @@ -1044,13 +1041,12 @@ if ($resql) $generic_product = new Product($db); $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $var=!$var; - print ''; + + print ''; $notshippable=0; $warning = 0; @@ -1223,7 +1219,7 @@ if ($resql) // Third party if (! empty($arrayfields['s.nom']['checked'])) { - print ''; $i=0; @@ -1424,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) { /* @@ -1436,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,''); } @@ -1451,6 +1450,5 @@ else dol_print_error($db); } -// End of page llxFooter(); $db->close(); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 4d53d8e8d50..79475c75917 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -75,7 +75,7 @@ if ($id > 0 || ! empty($ref)) $head = commande_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), 0, 'order'); + dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), -1, 'order'); // Order card diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index d7c5682e0a9..c6b93cb8f0f 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Andreu Bisquerra Gaya * Copyright (C) 2012 David Rodriguez Martinez - * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2012-2017 Juanjo Menent * Copyright (C) 2015 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -122,7 +122,7 @@ if (($action == 'create' || $action == 'add') && !$error) } if (isset($_POST['orders_to_invoice'])) { - $orders_id = GETPOST('orders_to_invoice','',1); + $orders_id = GETPOST('orders_to_invoice','',2); $nn = count($orders_id); $ii = 0; @@ -350,7 +350,7 @@ if (($action == 'create' || $action == 'add') && !$error) if ($id > 0 && ! $error) { $db->commit(); - header('Location: '.DOL_URL_ROOT.'/compta/facture.php?facid='.$id); + header('Location: '.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$id); exit; } else @@ -653,8 +653,8 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) while ($i < $num) { $objp = $db->fetch_object($resql); - $var=!$var; - 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 ad3817f28cd..bddf1292214 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -4,8 +4,9 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2012 Vinícius Nogueira * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2017 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 @@ -91,6 +92,7 @@ $search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPO $search_thirdparty=GETPOST("thirdparty",'alpha'); $search_req_nb=GETPOST("req_nb",'alpha'); $search_num_releve=GETPOST("search_num_releve",'alpha'); +$search_conciliated=GETPOST("search_conciliated",'int'); $num_releve=GETPOST("num_releve"); $cat=GETPOST("cat"); @@ -150,6 +152,7 @@ $arrayfields=array( 'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605), 'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000), 'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010), + 'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -175,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=''; @@ -190,6 +193,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $search_req_nb=''; $search_thirdparty=''; $search_num_releve=''; + $search_conciliated=''; $thirdparty=''; $account=""; @@ -294,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'); @@ -393,40 +397,37 @@ if ($id > 0 || ! empty($ref)) foreach ($bankcateg->fetchAll() as $bankcategory) { $options[$bankcategory->id] = $bankcategory->label; } - + // Bank card - $head=bank_prepare_head($object); dol_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0,'account'); - + $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - + dol_fiche_end(); - - /* * Buttons actions */ - if ($action != 'addline' && $action != 'reconcile') + if ($action != 'reconcile') { print '
'; - - if ($action != 'addline') - { - if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) - { - if ($user->rights->banque->modifier) { - print ''.$langs->trans("AddBankRecord").''; - } else { - print ''.$langs->trans("AddBankRecord").''; - } - } else { - print ''.$langs->trans("AddBankRecord").''; - } - } + + if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) + { + if ($user->rights->banque->modifier) { + print ''.$langs->trans("AddBankRecord").''; + } else { + print ''.$langs->trans("AddBankRecord").''; + } + } + else + { + print ''.$langs->trans("AddBankRecord").''; + } + if ($object->canBeConciliated() > 0) { // If not cash account and can be reconciliate if ($user->rights->banque->consolidate) { @@ -444,7 +445,7 @@ else llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } -$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; +$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,"; $sql.= " b.fk_account, b.fk_type,"; $sql.= " ba.rowid as bankid, ba.ref as bankref,"; $sql.= " bu.url_id,"; @@ -474,6 +475,7 @@ if (dol_strlen($search_dv_end)>0) $sql .= " AND b.datev <= '" . $db->idate($sear if ($search_ref) $sql.=natural_search("b.rowid", $search_ref); if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb); if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve); +if ($search_conciliated != '' && $search_conciliated != '-1') $sql.= " AND b.rappro = ".$search_conciliated; if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty); if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid; @@ -636,49 +638,6 @@ if ($resql) // 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 @@ -1393,7 +1389,12 @@ if ($resql) } // Show total line - if (isset($totalarray['totalhtfield'])) + if (isset($totalarray['totalhtfield']) + || isset($totalarray['totalvatfield']) + || isset($totalarray['totalttcfield']) + || isset($totalarray['totalamfield']) + || isset($totalarray['totalrtpfield']) + ) { 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")."
'; } - // Form to add a transaction with no invoice - if ($user->rights->banque->modifier && $action == 'addline') - { - print load_fiche_titre($langs->trans("AddBankRecordLong"),'',''); - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'.$langs->trans("Date").' '.$langs->trans("Type").''.$langs->trans("Numero").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").' 
'; - $form->select_date(empty($dateop)?-1:$dateop,'op',0,0,0,'transaction'); - print ''; - $form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1); - print ''; - print ''; - print ''; - if ($options) { - print '
'.$langs->trans("Rubrique").': '; - print Form::selectarray('cat1', $options, GETPOST('cat1'), 1); - } - print '
'; - print '
'; - print ''; - print '
'; - print '
'; - } - - /// ajax to adjust value date with plus and less picto print ' '; + + return $out; + } + /** * Return HTML to show the search and clear seach button * @@ -6163,31 +6262,10 @@ class Form */ function showFilterAndCheckAddButtons($addcheckuncheckall=0, $cssclass='checkforaction', $calljsfunction=0) { - global $conf, $langs; - - $out='
'; - $out.=''; - $out.=''; - $out.='
'; + $out.=$this->showFilterButtons(); if ($addcheckuncheckall) { - if (! empty($conf->use_javascript_ajax)) $out.=''; - $out.=''; + $out.=$this->showCheckAddButtons($cssclass, $calljsfunction); } return $out; } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index b44f854087c..b799e0e2359 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -120,7 +120,7 @@ class FormActions { //var_dump($selected); if ($selected == 'done') $selected='100'; - print ''; if ($showempty) print ''; foreach($listofstatus as $key => $val) { @@ -207,8 +207,8 @@ class FormActions $ref=$action->getNomUrl(1,-1); $label=$action->getNomUrl(0,38); - $var=!$var; - print '
'.$ref.''.$label.''.$action->type.'
'; - $sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status"; + $sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; + $sql .= ", cls.code as opp_status_code"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER BY p.dateo DESC"; @@ -544,8 +547,14 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin $num = $db->num_rows($result); print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; if ($num > 0) @@ -567,16 +576,31 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin if ($user->rights->projet->lire && $userAccess > 0) { $var = !$var; - print ""; + print ''; // Ref print ''; // Label print ''; // Date start - print ''; + print ''; // Date end - print ''; + print ''; + // Opp amount + print ''; + // Opp status + print ''; + // Opp percent + print ''; // Status print ''; @@ -588,7 +612,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin else { $var = false; - print ''; + print ''; } $db->free($result); } @@ -597,7 +621,8 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin dol_print_error($db); } print "
'.$langs->trans("Ref").''.$langs->trans("Name").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("Status").''.$langs->trans("Ref").''.$langs->trans("Name").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityStatusShort").''.$langs->trans("OpportunityProbabilityShort").''.$langs->trans("Status").'
'.img_object($langs->trans("ShowProject"),($obj->public?'projectpub':'project'))." ".$obj->ref.''.$obj->title.''.dol_print_date($db->jdate($obj->do),"day").''.dol_print_date($db->jdate($obj->do),"day").''.dol_print_date($db->jdate($obj->de),"day").''.dol_print_date($db->jdate($obj->de),"day").''; + if ($obj->opp_status_code) + { + print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + } + print ''; + if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); + print ''; + if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; + print ''.$projecttmp->getLibStatut(5).'
'.$langs->trans("None").'
'.$langs->trans("None").'
"; - + print ''; + print "
\n"; } @@ -668,7 +693,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $colspan=9; print '
'; - print ''; print ''; print ''; - //print ''; print ' 
'; - print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder','small',1,0,1); - print ''; - print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage)); + print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1); + print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage)); print ''; print $contactstatic->getBannerAddress('contact', $object); print '
'; $addressstatic->id = $address->id; @@ -915,7 +929,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') } else { - //print "
'.$langs->trans("NoAddressYetDefined").'
'; + + $out.=''; + if ($donetodo) + { + $out.=''; + } + $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; + $out.=''; + // Action column + $out.=''; + $out.=''; + $out.=''; if ($donetodo) { - $out.=''; + $tmp=''; + if (get_class($filterobj) == 'Societe') $tmp.=''; + $tmp.=($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : ''); + $tmp.=($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : ''); + $tmp.=($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : ''); + //$out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort"); + if (get_class($filterobj) == 'Societe') $tmp.=''; + $out.=getTitleFieldOfList($tmp); } - $out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder); - $out.=''; - $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, '', $sortfield, $sortorder); - $out.=''; - $out.=''; - $out.=''; - $out.=''; + $out.=getTitleFieldOfList($langs->trans("Ref"), 0, $_SERVER["PHP_SELF"], 'a.id', '', $param, '', $sortfield, $sortorder); + $out.=getTitleFieldOfList($langs->trans("Owner")); + $out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + $out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder); + $out.=getTitleFieldOfList($langs->trans("Type")); + $out.=getTitleFieldOfList(''); + $out.=getTitleFieldOfList(''); $out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder); - $out.=''; - $out.=''; - - - $out.=''; - if ($donetodo) - { - $out.=''; - } - $out.=''; - $out.=''; - $out.=''; - $out.=''; - $out.=''; - $out.=''; - $out.=''; - $out.=''; - // Action column - $out.=''; + $out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch '); $out.=''; foreach ($histo as $key=>$value) { - $var=!$var; + $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo $out.=""; @@ -1238,6 +1262,15 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=$actionstatic->getNomUrl(1, -1); $out.=''; + // Author of event + $out.=''; + // Title $out.=''; - + // Date - $out.=''; } - // Auteur - $out.=''; - - // Statut + // Status $out.=''; // Actions @@ -1430,7 +1454,7 @@ function show_subsidiaries($conf,$langs,$db,$object) $obj = $db->fetch_object($result); $var = !$var; - print ""; + print ''; print ''; print ''; diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index c507e2e66ee..f951439f0c5 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -76,7 +76,7 @@ function contact_prepare_head(Contact $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->societe->dir_output . "/contact/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$tab][0] = DOL_URL_ROOT.'/contact/document.php?id='.$object->id; $head[$tab][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/contract.lib.php b/htdocs/core/lib/contract.lib.php index 2d328ea7097..9d986e983bc 100644 --- a/htdocs/core/lib/contract.lib.php +++ b/htdocs/core/lib/contract.lib.php @@ -71,7 +71,7 @@ function contract_prepare_head(Contrat $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/doleditor.lib.php b/htdocs/core/lib/doleditor.lib.php index 5ba8570ab57..1981ae63d09 100644 --- a/htdocs/core/lib/doleditor.lib.php +++ b/htdocs/core/lib/doleditor.lib.php @@ -71,7 +71,7 @@ function show_skin($fuser,$edit=0) print '';*/ print ''; - print ''; + print ''; print ''; print ''; print ''; - //$var=!$var; - print '"; + print ''; // Supplier print ''; diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 84991a76db2..34da4f857b9 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -127,29 +127,29 @@ while ($objp = $db->fetch_object($result)) } print '
'; + $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1); + $out.=''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + $out.=$searchpitco; + $out.='
'; - if (get_class($filterobj) == 'Societe') $out.=''; - $out.=$langs->trans("ActionsToDoShort").' / '.$langs->trans("ActionsDoneShort"); - if (get_class($filterobj) == 'Societe') $out.=''; - $out.=''.$langs->trans("Label").''.$langs->trans("Type").''.$langs->trans("Owner").''; - //TODO Add selection of fields - $out.='
'; - $out.=$formactions->select_type_actions($actioncode, "actioncode", '', empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:-1, 0, 0, 1); - $out.=''; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); - $out.=$searchpitco; - $out.='
'; + //$userstatic->id=$histo[$key]['userid']; + //$userstatic->login=$histo[$key]['login']; + //$out.=$userstatic->getLoginUrl(1); + $userstatic->fetch($histo[$key]['userid']); + $out.=$userstatic->getNomUrl(-1); + $out.=''; if (isset($histo[$key]['type']) && $histo[$key]['type']=='action') @@ -1258,9 +1291,9 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=dol_trunc($libelle,120); } $out.=''; + $out.=''; $out.=dol_print_date($histo[$key]['datestart'],'dayhour'); if ($histo[$key]['dateend'] && $histo[$key]['dateend'] != $histo[$key]['datestart']) { @@ -1356,16 +1389,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= $out.=' '; - //$userstatic->id=$histo[$key]['userid']; - //$userstatic->login=$histo[$key]['login']; - //$out.=$userstatic->getLoginUrl(1); - $userstatic->fetch($histo[$key]['userid']); - $out.=$userstatic->getNomUrl(1); - $out.=''.$actionstatic->LibStatut($histo[$key]['percent'],3,1,$histo[$key]['datestart']).'
'; $socstatic->id = $obj->rowid; @@ -1445,7 +1469,7 @@ function show_subsidiaries($conf,$langs,$db,$object) print ''.$obj->code_client.''; - print ''; + print ''; print img_edit(); print '
'.$langs->trans("ThemeDir").''; foreach($dirskins as $dirskin) @@ -81,8 +81,8 @@ function show_skin($fuser,$edit=0) print '
'; + // + print '
'; print ', 2=To use with
* @param string $file Url used when we click on sort picto * @param string $field Field to use for new sorting. Empty if this field is not sortable. * @param string $begin ("" by defaut) * @param string $moreparam Add more parameters on sort url links ("" by default) - * @param string $moreattrib Add more attributes on th ("" by defaut) + * @param string $moreattrib Add more attributes on th ("" by defaut). To add more css class, use param $prefix. * @param string $sortfield Current field used to sort * @param string $sortorder Current sort order * @param string $prefix Prefix for css. Use space after prefix to add your own CSS tag. @@ -3037,7 +3141,7 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar */ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="") { - global $conf; + global $conf, $langs; //print "$name, $file, $field, $begin, $options, $moreattrib, $sortfield, $sortorder
\n"; $sortorder=strtoupper($sortorder); @@ -3071,7 +3175,7 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m } } - $out.=$name; + $out.=$langs->trans($name); if (empty($thead) && $field) // If this is a sort field { @@ -3263,20 +3367,20 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($cpt>=1) { - $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page=0'.$options.'">1'; - if ($cpt > 2) $pagelist.='dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="inactive"':'data-role="button"').'>...'; - else if ($cpt == 2) $pagelist.='dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page=1'.$options.'">2'; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>1'; + if ($cpt > 2) $pagelist.='dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="inactive"':'').'>...'; + else if ($cpt == 2) $pagelist.='dol_use_jmobile != 4)?' class="pagination"':'').'>2'; } do { if ($cpt==$page) { - $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="active"':'data-role="button"').'>'.($page+1).''; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="active"':'').'>'.($page+1).''; } else { - $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page='.$cpt.$options.'">'.($cpt+1).''; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>'.($cpt+1).''; } $cpt++; } @@ -3284,14 +3388,14 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so if ($cpt<$nbpages) { - if ($cpt<$nbpages-2) $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="inactive"':'data-role="button"').'>...'; - else if ($cpt == $nbpages-2) $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-2).$options.'">'.($nbpages - 1).''; - $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-1).$options.'">'.$nbpages.''; + if ($cpt<$nbpages-2) $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="inactive"':'').'>...'; + else if ($cpt == $nbpages-2) $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>'.($nbpages - 1).''; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>'.$nbpages.''; } } else { - $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="active"':'data-role="button"').'>'.($page+1).""; + $pagelist.= 'dol_use_jmobile != 4)?' class="pagination"':'').'>dol_use_jmobile != 4)?'class="active"':'').'>'.($page+1).""; } } print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtml, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist @@ -3370,8 +3474,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee } if ($page > 0) { - if (($conf->dol_use_jmobile != 4)) print ''; - else print '
  • '.$langs->trans("Previous").'
  • '; + print ''; } if ($betweenarrows) { @@ -3379,8 +3482,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee } if ($nextpage > 0) { - if (($conf->dol_use_jmobile != 4)) print ''; - else print '
  • '.$langs->trans("Next").'
  • '; + print ''; } if ($afterarrows) { @@ -3767,7 +3869,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority - else $sql.= " AND t.recuperableonly ='".$npr."'"; + else $sql.= " AND t.recuperableonly ='".$vatnpr."'"; dol_syslog("get_localtax", LOG_DEBUG); $resql=$db->query($sql); @@ -3886,6 +3988,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local); $vatratecleaned = $vatrate; + $vatratecode = ''; if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) // If vat is "xx (yy)" { $vatratecleaned = $reg[1]; @@ -4284,7 +4387,7 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id function yn($yesno, $case=1, $color=0) { global $langs; - $result='unknown'; + $result='unknown'; $classname=''; if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') // A mettre avant test sur no a cause du == 0 { $result=$langs->trans('yes'); @@ -5005,7 +5108,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb { global $conf, $langs; - $ret=''; + $ret=0; $return=''; $out=''; $divstart=$divend=''; @@ -5175,7 +5278,8 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti $sizearray=count($array); if (is_array($array) && $sizearray>0) { - foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; + $temp = array(); + foreach(array_keys($array) as $key) $temp[$key]=$array[$key][$index]; if (!$natsort) ($order=='asc') ? asort($temp) : arsort($temp); else @@ -5537,11 +5641,11 @@ function printCommonFooter($zone='private') if (empty($conf->dol_use_jmobile)) { - print ''."\n"; + print ''."\n"; print 'jQuery(".menuhider").click(function() {'; print ' console.log("We click on .menuhider");'."\n"; print " $('.side-nav').toggle();"; - if ($conf->theme == 'md') print " $('.login_block').toggle();"; + print " $('.login_block').toggle();"; print '});'."\n"; } @@ -5635,6 +5739,7 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=') { if ($a = explode($delimiter, $string)) { + $ka = array(); foreach ($a as $s) { // each part if ($s) { if ($pos = strpos($s, $kv)) { // key/value delimiter @@ -5830,10 +5935,11 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='') * Return URL we can use for advanced preview links * * @param string $modulepart propal, facture, facture_fourn, ... - * @param string $relativepath Relative path of docs - * @return string Output string with HTML + * @param string $relativepath Relative path of docs. + * @param int $alldata Return array with all components (1 is recommended, then use a simple a href link with the class, target and mime attribute added. 'documentpreview' css class is handled by jquery code into main.inc.php) + * @return string|array Output string with href link or array with all components of link */ -function getAdvancedPreviewUrl($modulepart, $relativepath) +function getAdvancedPreviewUrl($modulepart, $relativepath, $alldata=0) { global $conf, $langs; @@ -5843,8 +5949,15 @@ function getAdvancedPreviewUrl($modulepart, $relativepath) //$mime_preview[]='vnd.oasis.opendocument.presentation'; //$mime_preview[]='archive'; $num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview); + + if ($alldata == 1) + { + if ($num_mime !== false) return array('target'=>'_blank', 'css'=>'documentpreview', 'url'=>DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath), 'mime'=>dol_mimetype($relativepath), ); + else return array(); + } - if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.$relativepath).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; + // old behavior + if ($num_mime !== false) return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath)).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; else return ''; } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2b09e829a6c..dc0541e39ef 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1509,7 +1509,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) $sql.= " WHERE type = '".$type."'"; $sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; $sql.= " ORDER BY description DESC"; - + dol_syslog('/core/lib/function2.lib.php::getListOfModels', LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -1530,7 +1530,6 @@ function getListOfModels($db,$type,$maxfilenamelength=0) $const=$obj->description; $dirtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const)); - $listoffiles=array(); // Now we add models found in directories scanned diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 3314aa94631..f4319b7d11a 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -96,7 +96,8 @@ function dol_convertToWord($num, $langs, $currency=false, $centimes=false) $max_length = $levels * 3; $num = substr('00' . $num, -$max_length); $num_levels = str_split($num, 3); - for ($i = 0; $i < count($num_levels); $i++) { + $nboflevels = count($num_levels); + for ($i = 0; $i < $nboflevels; $i++) { $levels--; $hundreds = (int) ($num_levels[$i] / 100); $hundreds = ($hundreds ? ' ' . $list1[$hundreds] . ' '.$langs->transnoentities('hundred') . ( $hundreds == 1 ? '' : 's' ) . ' ': ''); diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index 605c37520d8..56d19d0e0f1 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -43,7 +43,7 @@ function holiday_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->holiday->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/holiday/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index f48a248ab14..220cc5aeccc 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2017 Charlie Benke * * 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 @@ -38,7 +39,7 @@ function facture_prepare_head($object) $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; $head[$h][1] = $langs->trans('Card'); $head[$h][2] = 'compta'; $h++; @@ -53,14 +54,6 @@ function facture_prepare_head($object) $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/apercu.php?facid='.$object->id; - $head[$h][1] = $langs->trans('Preview'); - $head[$h][2] = 'preview'; - $h++; - } - //if ($fac->mode_reglement_code == 'PRE') if (! empty($conf->prelevement->enabled)) { @@ -103,7 +96,7 @@ function facture_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->facture->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; $head[$h][1] = $langs->trans('Documents'); @@ -165,4 +158,27 @@ function invoice_admin_prepare_head() } +function invoice_rec_prepare_head($object) +{ + global $db, $langs, $conf; + + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?id='.$object->id; + $head[$h][1] = $langs->trans("CardBill"); + $head[$h][2] = 'card'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab + // $this->tabs = array('entity:-tabname); to remove a tab + complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec'); + + complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice-rec','remove'); + + return $head; +} + diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index d5a362663b7..d4ef7a2ed7a 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -147,7 +147,7 @@ function show_ldap_content($result,$level,$count,$var,$hide=0,$subcount=0) $hide=0; if (! is_numeric($key)) { - $var=!$var; + print '
    '; print ''; } @@ -919,7 +934,6 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ $tableCell.=''; print $tableCell; } - dol_syslog("yyy"); print '"; + + print ''; print '"; + print ''; // Sending id print ''; + +print ''; print ''; print ''; // multiprix nombre de prix a proposer if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; } // sousproduits activation/desactivation -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; // Utilisation formulaire Ajax sur choix produit -$var=!$var; -print ''; + +print ''; print ''; if (empty($conf->use_javascript_ajax)) { @@ -639,16 +643,16 @@ print ''; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; } // Visualiser description produit dans les formulaires activation/desactivation -$var=!$var; -print ''; + +print ''; print ''; print ''; // Activate propal merge produt card /* Kept as hidden feature only. PRODUIT_PDF_MERGE_PROPAL can be added manually. Still did not understand how this feature works. -$var=!$var; -print ''; + +print ''; print ''; print ''; // Use units /* Kept as hidden feature only. PRODUCT_USE_UNITS is hidden for the moment. Because it seems to be a duplicated feature with already existing field to store unit of product -$var=!$var; -print ''; + +print ''; print ''; print ''; // View product description in thirdparty language if (! empty($conf->global->MAIN_MULTILANGS)) { - $var=!$var; - print ''; + + print ''; print ''; print ''."\n"; print ''."\n"; - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print ''."\n"; /* - $var=!$var; - print ''."\n"; + + print ''."\n"; print ''."\n"; print '> $value) { diff --git a/htdocs/product/canvas/service/tpl/list.tpl.php b/htdocs/product/canvas/service/tpl/list.tpl.php index 4fc875e15bf..a7efe4f86ba 100644 --- a/htdocs/product/canvas/service/tpl/list.tpl.php +++ b/htdocs/product/canvas/service/tpl/list.tpl.php @@ -84,7 +84,7 @@ + ?> > $value) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b27cef6d985..536bcece10f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -140,32 +140,13 @@ if (empty($reshook)) exit; } - /* - * Build doc - */ - else if ($action == 'builddoc' && $user->rights->produit->creer) - { - // Save last template used to generate document - if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha')); - - // Define output language - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=product_create($db, $object, GETPOST('model','alpha'), $outputlangs); - if ($result <= 0) - { - dol_print_error($db,$result); - exit; - } - } - + // Actions to build doc + $upload_dir = $conf->produit->dir_output; + $permissioncreate = $user->rights->produit->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Barcode type if ($action == 'setfk_barcode_type' && $createbarcode) { @@ -548,7 +529,7 @@ if (empty($reshook)) { if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)) { - $result = $object->delete($object->id); + $result = $object->delete(DolibarrApiAccess::$user); } if ($result > 0) @@ -790,7 +771,7 @@ if (empty($reshook)) ); if ($result > 0) { - header("Location: " . DOL_URL_ROOT . "/compta/facture.php?facid=" . $facture->id); + header("Location: " . DOL_URL_ROOT . "/compta/facture/card.php?facid=" . $facture->id); exit; } } @@ -1827,51 +1808,48 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { - if ($action == '' || $action == 'view') - { - if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || - ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)) - { - if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print ''; + if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || + ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)) + { + if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print ''; - if (! isset($object->no_button_copy) || $object->no_button_copy <> 1) - { - if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) - { - print '
    '.$langs->trans('ToClone').'
    '."\n"; - } - else - { - print ''; - } - } - } - $object_is_used = $object->isObjectUsed($object->id); - - if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) - || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)) - { - if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1)) - { - if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) - { - print '
    '.$langs->trans('Delete').'
    '."\n"; - } - else - { - print ''; - } - } - else + if (! isset($object->no_button_copy) || $object->no_button_copy <> 1) + { + if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) + { + print '
    '.$langs->trans('ToClone').'
    '."\n"; + } + else { - print ''; - } - } - else + print ''; + } + } + } + $object_is_used = $object->isObjectUsed($object->id); + + if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) + || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)) + { + if (empty($object_is_used) && (! isset($object->no_button_delete) || $object->no_button_delete <> 1)) + { + if (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) + { + print '
    '.$langs->trans('Delete').'
    '."\n"; + } + else + { + print ''; + } + } + else { - print ''; - } - } + print ''; + } + } + else + { + print ''; + } } print "\n\n"; @@ -1894,12 +1872,10 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = $langs->load("propal"); - $var=true; $otherprop = $propal->liste_array(2,1,0); if (is_array($otherprop) && count($otherprop)) { - $var=!$var; $html .= '"; $productstatic->id=$objp->rowid; $productstatic->ref=$objp->ref; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index ae2782cc4de..e9ae9073835 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -188,17 +188,18 @@ if ($object->id) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); - dol_fiche_head($head, 'documents', $titre, 0, $picto); + + dol_fiche_head($head, 'documents', $titre, -1, $picto); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); // 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); if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs { - $filearrayold=dol_dir_list($upload_dirold,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearrayold=dol_dir_list($upload_dirold,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=array_merge($filearray, $filearrayold); } @@ -210,8 +211,8 @@ if ($object->id) $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); + $object->next_prev_filter=" fk_product_type = ".$object->type; + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); print '
    '; diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index bd4fa62692f..cd5c8bb25de 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -283,15 +283,16 @@ class PriceExpression /** * Delete object in database * - * @param int $rowid Row id of expression * @param User $user User that deletes * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($rowid, $user, $notrigger=0) + function delete(User $user, $notrigger=0) { $error=0; + $rowid = $this->id; + $this->db->begin(); if (! $error) diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index 0b93d17749a..bcf18750981 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -16,9 +16,9 @@ */ /** - * \file htdocs/product/dynamic_price/editor.php + * \file htdocs/product/dynamic_price/editor.php * \ingroup product - * \brief Page for editing expression + * \brief Page for editing expression */ require '../../main.inc.php'; @@ -60,6 +60,7 @@ else if ($action != 'delete') $price_expression->fetch($eid); } + /* * Actions */ @@ -148,7 +149,8 @@ if ($action == 'delete') { if ($eid != 0) { - $result = $price_expression->delete($eid, $user); + $price_expression->fetch($eid); + $result = $price_expression->delete($user); if ($result < 0) { setEventMessages("delete: ".$price_expression->error, $price_expression->errors, 'errors'); @@ -157,23 +159,28 @@ if ($action == 'delete') } } + /* * View */ -//Header -llxHeader("","",$langs->trans("CardProduct".$product->type)); -print load_fiche_titre($langs->trans("PriceExpressionEditor")); $form = new Form($db); +llxHeader("","",$langs->trans("CardProduct".$product->type)); + +print load_fiche_titre($langs->trans("PriceExpressionEditor")); + //Form/Table print '
    '; print ''; print ''; + +dol_fiche_head(); + print '
    '; diff --git a/htdocs/core/lib/donation.lib.php b/htdocs/core/lib/donation.lib.php index 51f6858eafd..665ff7cb4e3 100644 --- a/htdocs/core/lib/donation.lib.php +++ b/htdocs/core/lib/donation.lib.php @@ -81,7 +81,7 @@ function donation_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->don->dir_output . '/' . get_exdir($filename,2,0,1,$object,'donation'). '/'. dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/don/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index cc60f9feb13..f253f077243 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -48,7 +48,7 @@ function expensereport_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/fichinter.lib.php b/htdocs/core/lib/fichinter.lib.php index 964bbe14b2c..8507a85292a 100644 --- a/htdocs/core/lib/fichinter.lib.php +++ b/htdocs/core/lib/fichinter.lib.php @@ -55,14 +55,6 @@ function fichinter_prepare_head($object) $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/fichinter/apercu.php?id='.$object->id; - $head[$h][1] = $langs->trans('Preview'); - $head[$h][2] = 'preview'; - $h++; - } - // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab @@ -110,7 +102,7 @@ function fichinter_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->ficheinter->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/fichinter/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a2d6da7bdc5..6d90a1afed3 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -45,7 +45,7 @@ function dol_basename($pathfile) * @param string $types Can be "directories", "files", or "all" * @param int $recursive Determines whether subdirectories are searched * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function. Filter is checked into basename only. - * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). Exclude is checked into fullpath. + * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). Exclude is checked into fullpath. * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only @@ -208,7 +208,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil * * @param string $path Starting path from which to search. Example: 'produit/MYPROD' * @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param array|null $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')) + * @param array|null $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')) * @param string $sortcriteria Sort criteria ("","fullname","name","date","size") * @param string $sortorder Sort order (SORT_ASC, SORT_DESC) * @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like description @@ -772,7 +772,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. + // We refuse cache files/dirs, upload using .. and pipes into filenames. if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) { dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); @@ -845,6 +845,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param int $nohook Disable all hooks * @param object $object Current object in use * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error + * @see dol_delete_dir */ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { @@ -856,6 +857,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook); + // Security: + // We refuse transversal using .. and pipes into filenames. + if (preg_match('/\.\./',$file) || preg_match('/[<>|]/',$file)) + { + dol_syslog("Refused to delete file ".$file, LOG_WARNING); + return False; + } + if (empty($nohook)) { $hookmanager->initHooks(array('fileslib')); @@ -943,9 +952,18 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n * @param string $dir Directory to delete * @param int $nophperrors Disable all PHP output errors * @return boolean True if success, false if error + * @see dol_delete_file */ function dol_delete_dir($dir,$nophperrors=0) { + // Security: + // We refuse transversal using .. and pipes into filenames. + if (preg_match('/\.\./',$dir) || preg_match('/[<>|]/',$dir)) + { + dol_syslog("Refused to delete dir ".$dir, LOG_WARNING); + return False; + } + $dir_osencoded=dol_osencode($dir); return ($nophperrors?@rmdir($dir_osencoded):rmdir($dir_osencoded)); } @@ -1531,11 +1549,11 @@ function dol_uncompress($inputfile,$outputdir) * * @param string $dir Directory to scan * @param string $regexfilter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function - * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function + * @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.')). This regex value must be escaped for '/', since this char is used for preg_match function * @param int $nohook Disable all hooks * @return string Full path to most recent file */ -function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview\.png)$','^\.'),$nohook=false) +function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta|_preview.*\.png)$','^\.'),$nohook=false) { $tmparray=dol_dir_list($dir,'files',0,$regexfilter,$excludefilter,'date',SORT_DESC,'',$nohook); return $tmparray[0]; @@ -1554,7 +1572,8 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='') { global $user, $conf, $db; - + global $dolibarr_main_data_root; + if (! is_object($fuser)) $fuser=$user; if (empty($modulepart)) return 'ErrorBadParameter'; @@ -1568,141 +1587,140 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // find the subdirectory name as the reference if (empty($refname)) $refname=basename(dirname($original_file)."/"); + $relative_original_file = $original_file; + // Wrapping for some images - if ($modulepart == 'companylogo') + if (($modulepart == 'mycompany' || $modulepart == 'companylogo') && !empty($conf->mycompany->dir_output)) { $accessallowed=1; $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; } // Wrapping for users photos - elseif ($modulepart == 'userphoto') + elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { $accessallowed=1; $original_file=$conf->user->dir_output.'/'.$original_file; } // Wrapping for members photos - elseif ($modulepart == 'memberphoto') + elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { $accessallowed=1; $original_file=$conf->adherent->dir_output.'/'.$original_file; } // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture') + elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire) $accessallowed=1; $original_file=$conf->facture->dir_output.'/'.$original_file; } // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal') + elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propale->lire) $accessallowed=1; $original_file=$conf->propal->dir_output.'/'.$original_file; } // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande') + elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output)) { if ($fuser->rights->commande->lire) $accessallowed=1; $original_file=$conf->commande->dir_output.'/'.$original_file; } // Wrapping pour les apercu intervention - elseif ($modulepart == 'apercufichinter') + elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { if ($fuser->rights->ficheinter->lire) $accessallowed=1; $original_file=$conf->ficheinter->dir_output.'/'.$original_file; } // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats') + elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) { if ($fuser->rights->propale->lire) $accessallowed=1; $original_file=$conf->propal->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats commandes - elseif ($modulepart == 'orderstats') + elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { if ($fuser->rights->commande->lire) $accessallowed=1; $original_file=$conf->commande->dir_temp.'/'.$original_file; } - elseif ($modulepart == 'orderstatssupplier') + elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output)) { if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1; $original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file; } // Wrapping pour les images des stats factures - elseif ($modulepart == 'billstats') + elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { if ($fuser->rights->facture->lire) $accessallowed=1; $original_file=$conf->facture->dir_temp.'/'.$original_file; } - elseif ($modulepart == 'billstatssupplier') + elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output)) { if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1; $original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'expeditionstats') + elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { if ($fuser->rights->expedition->lire) $accessallowed=1; $original_file=$conf->expedition->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'tripsexpensesstats') + elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { if ($fuser->rights->deplacement->lire) $accessallowed=1; $original_file=$conf->deplacement->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'memberstats') + elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { if ($fuser->rights->adherent->lire) $accessallowed=1; $original_file=$conf->adherent->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats produits - elseif (preg_match('/^productstats_/i',$modulepart)) + elseif (preg_match('/^productstats_/i',$modulepart) && !empty($conf->product->dir_temp)) { if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1; $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; } - // Wrapping for products or services - elseif ($modulepart == 'tax') + // Wrapping for taxes + elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output)) { if ($fuser->rights->tax->charges->lire) $accessallowed=1; $original_file=$conf->tax->dir_output.'/'.$original_file; } - // Wrapping for products or services - elseif ($modulepart == 'actions') + // Wrapping for events + elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { if ($fuser->rights->agenda->myactions->read) $accessallowed=1; $original_file=$conf->agenda->dir_output.'/'.$original_file; } // Wrapping for categories - elseif ($modulepart == 'category') + elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output)) { if ($fuser->rights->categorie->lire) $accessallowed=1; $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les prelevements - elseif ($modulepart == 'prelevement') + elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { - if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } + if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) $accessallowed=1; $original_file=$conf->prelevement->dir_output.'/'.$original_file; } // Wrapping pour les graph energie - elseif ($modulepart == 'graph_stock') + elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { $accessallowed=1; $original_file=$conf->stock->dir_temp.'/'.$original_file; } // Wrapping pour les graph fournisseurs - elseif ($modulepart == 'graph_fourn') + elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { $accessallowed=1; $original_file=$conf->fournisseur->dir_temp.'/'.$original_file; } // Wrapping pour les graph des produits - elseif ($modulepart == 'graph_product') + elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { $accessallowed=1; $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; @@ -1711,32 +1729,31 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu elseif ($modulepart == 'barcode') { $accessallowed=1; - // If viewimage is called for barcode, we try to output an image on the fly, - // with not build of file on disk. + // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk. //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file=''; } // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'iconmailing') + elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { $accessallowed=1; $original_file=$conf->mailing->dir_temp.'/'.$original_file; } - // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'scanner_user_temp') + // Wrapping pour le scanner + elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { $accessallowed=1; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; } // Wrapping pour les images fckeditor - elseif ($modulepart == 'fckeditor') + elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { $accessallowed=1; $original_file=$conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for third parties - else if ($modulepart == 'company' || $modulepart == 'societe') + else if (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output)) { if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file)) { @@ -1747,7 +1764,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for contact - else if ($modulepart == 'contact') + else if ($modulepart == 'contact' && !empty($conf->societe->dir_output)) { if ($fuser->rights->societe->lire) { @@ -1757,7 +1774,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for invoices - else if ($modulepart == 'facture' || $modulepart == 'invoice') + else if (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1766,7 +1783,8 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } - else if ($modulepart == 'massfilesarea_proposals') + // Wrapping for mass actions + else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propal->lire || preg_match('/^specimen/i',$original_file)) { @@ -1790,9 +1808,49 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } $original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } + else if ($modulepart == 'massfilesarea_expensereport') + { + if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->expensereport->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + } + else if ($modulepart == 'massfilesarea_interventions') + { + if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->ficheinter->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + } + else if ($modulepart == 'massfilesarea_supplier_proposal' && !empty($conf->propal->dir_output)) + { + if ($fuser->rights->supplier_proposal->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->supplier_proposal->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + } + else if ($modulepart == 'massfilesarea_supplier_order') + { + if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->fournisseur->commande->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + } + else if ($modulepart == 'massfilesarea_supplier_invoice') + { + if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file)) + { + $accessallowed=1; + } + $original_file=$conf->fournisseur->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; + } - // Wrapping pour les fiches intervention - else if ($modulepart == 'ficheinter') + // Wrapping for interventions + else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) { @@ -1803,7 +1861,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les deplacements et notes de frais - else if ($modulepart == 'deplacement') + else if ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file)) { @@ -1813,7 +1871,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les propales - else if ($modulepart == 'propal') + else if ($modulepart == 'propal' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file)) { @@ -1825,7 +1883,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les commandes - else if ($modulepart == 'commande' || $modulepart == 'order') + else if (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output)) { if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file)) { @@ -1836,7 +1894,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les projets - else if ($modulepart == 'project') + else if ($modulepart == 'project' && !empty($conf->projet->dir_output)) { if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) { @@ -1845,7 +1903,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project', 1).")"; } - else if ($modulepart == 'project_task') + else if ($modulepart == 'project_task' && !empty($conf->projet->dir_output)) { if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) { @@ -1854,19 +1912,9 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project', 1).")"; } - // Wrapping for interventions - else if ($modulepart == 'fichinter') - { - if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } - $original_file=$conf->ficheinter->dir_output.'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les commandes fournisseurs - else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') + else if (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file)) { @@ -1877,7 +1925,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les factures fournisseurs - else if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') + else if (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1898,7 +1946,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les rapport de paiements - else if ($modulepart == 'facture_paiement') + else if ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1909,7 +1957,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for accounting exports - else if ($modulepart == 'export_compta') + else if ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i',$original_file)) { @@ -1919,7 +1967,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les expedition - else if ($modulepart == 'expedition') + else if ($modulepart == 'expedition' && !empty($conf->expedition->dir_output)) { if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file)) { @@ -1927,9 +1975,8 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } $original_file=$conf->expedition->dir_output."/sending/".$original_file; } - // Wrapping pour les bons de livraison - else if ($modulepart == 'livraison') + else if ($modulepart == 'livraison' && !empty($conf->expedition->dir_output)) { if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file)) { @@ -1939,7 +1986,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les actions - else if ($modulepart == 'actions') + else if ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file)) { @@ -1949,7 +1996,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les actions - else if ($modulepart == 'actionsreport') + else if ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file)) { @@ -1970,7 +2017,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les contrats - else if ($modulepart == 'contract') + else if ($modulepart == 'contract' && !empty($conf->contrat->dir_output)) { if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file)) { @@ -1981,7 +2028,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les dons - else if ($modulepart == 'donation') + else if ($modulepart == 'donation' && !empty($conf->donation->dir_output)) { if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file)) { @@ -1991,7 +2038,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les remises de cheques - else if ($modulepart == 'remisecheque') + else if ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output)) { if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file)) { @@ -2002,7 +2049,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for bank - else if ($modulepart == 'bank') + else if ($modulepart == 'bank' && !empty($conf->bank->dir_output)) { if ($fuser->rights->banque->lire) { @@ -2012,7 +2059,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for export module - else if ($modulepart == 'export') + else if ($modulepart == 'export' && !empty($conf->export->dir_temp)) { // Aucun test necessaire car on force le rep de download sur // le rep export qui est propre a l'utilisateur @@ -2021,47 +2068,42 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for import module - else if ($modulepart == 'import') + else if ($modulepart == 'import' && !empty($conf->import->dir_temp)) { $accessallowed=1; $original_file=$conf->import->dir_temp.'/'.$original_file; } // Wrapping pour l'editeur wysiwyg - else if ($modulepart == 'editor') + else if ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { $accessallowed=1; $original_file=$conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for miscellaneous medias files - elseif ($modulepart == 'medias') + elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { $accessallowed=1; - global $dolibarr_main_data_root; $original_file=$dolibarr_main_data_root.'/medias/'.$original_file; } // Wrapping for backups - else if ($modulepart == 'systemtools') + else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { - if ($fuser->admin) - { - $accessallowed=1; - } + if ($fuser->admin) $accessallowed=1; $original_file=$conf->admin->dir_output.'/'.$original_file; } // Wrapping for upload file test - else if ($modulepart == 'admin_temp') + else if ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { - if ($fuser->admin) - $accessallowed=1; + if ($fuser->admin) $accessallowed=1; $original_file=$conf->admin->dir_temp.'/'.$original_file; } // Wrapping pour BitTorrent - else if ($modulepart == 'bittorrent') + else if ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { $accessallowed=1; $dir='files'; @@ -2070,7 +2112,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour Foundation module - else if ($modulepart == 'member') + else if ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file)) { @@ -2080,7 +2122,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for Scanner - else if ($modulepart == 'scanner_user_temp') + else if ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { $accessallowed=1; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; @@ -2093,20 +2135,38 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart else { + if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a file called specimen. Test must be done before changing $original_file int full path. + if ($fuser->admin) $accessallowed=1; // If user is admin + // Define $accessallowed if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file; } else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file; } else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_output)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file; } else @@ -2130,8 +2190,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->$modulepart->dir_output.'/'.$original_file; } } - if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen - if ($fuser->admin) $accessallowed=1; // If user is admin // For modules who wants to manage different levels of permissions for documents $subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS'; @@ -2163,7 +2221,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } /** - * Store object in file + * Store object in file. * * @param string $directory Directory of cache * @param string $filename Name of filecache @@ -2179,7 +2237,7 @@ function dol_filecache($directory, $filename, $object) } /** - * Test if Refresh needed + * Test if Refresh needed. * * @param string $directory Directory of cache * @param string $filename Name of filecache @@ -2195,7 +2253,7 @@ function dol_cache_refresh($directory, $filename, $cachetime) } /** - * Read object from cachefile + * Read object from cachefile. * * @param string $directory Directory of cache * @param string $filename Name of filecache diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 3ac3cf49a9c..44e7774cae6 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -74,7 +74,7 @@ function facturefourn_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$object->ref; - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/fourn/facture/document.php?facid='.$object->id; $head[$h][1] = $langs->trans('Documents'); @@ -151,7 +151,7 @@ function ordersupplier_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->fournisseur->dir_output . "/commande/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6a0ffad4149..87039a3d454 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -129,7 +129,7 @@ function getEntity($element=false, $shared=0) else { $out=''; - $addzero = array('user', 'usergroup'); + $addzero = array('user', 'usergroup', 'email_template', 'default_values'); if (in_array($element, $addzero)) $out.= '0,'; $out.= $conf->entity; return $out; @@ -248,7 +248,24 @@ function dol_shutdown() */ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) { - if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); + if (empty($method)) + { + $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:''); + + // Management of default values + if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname])) + { + $relativepathstring = preg_replace('/\.[a-z]+$/', '', $_SERVER["PHP_SELF"]); + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + $relativepathstring=dol_string_nospecial($relativepathstring, '-'); + // $relativepathstring is now string that identify the page: '_societe_card', '_agenda_card', ... + $keyfordefaultvalue = 'MAIN_DEFAULT_FOR_'.$relativepathstring.'_'.$paramname; + global $conf; + if (isset($conf->global->$keyfordefaultvalue)) $out = $conf->global->$keyfordefaultvalue; + } + } elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:''; elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:''; elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:''); @@ -257,6 +274,8 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) if (! empty($check)) { + // Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__ + // TODO Add more var like __PREVIOUSDAY__, __PREVIOUSMONTH__, __PREVIOUSYEAR__ if (! is_array($out) && preg_match('/^__([a-z0-9]+)__$/i', $out, $reg)) { if ($reg[1] == 'DAY') @@ -279,6 +298,16 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL) global $mysoc; $out = $mysoc->country_id; } + elseif ($reg[1] == 'USERID') + { + global $user; + $out = $user->id; + } + elseif ($reg[1] == 'ENTITYID') + { + global $conf; + $out = $conf->entity; + } } switch ($check) @@ -780,7 +809,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename=' * @param array $links Array of tabs. Currently initialized by calling a function xxx_admin_prepare_head * @param string $active Active tab name (document', 'info', 'ldap', ....) * @param string $title Title - * @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. + * @param int $notab -1 or 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @return void @@ -796,7 +825,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto * @param array $links Array of tabs * @param string $active Active tab name * @param string $title Title - * @param int $notab 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. + * @param int $notab -1 or 0=Add tab header, 1=no tab header. If you set this to 1, using dol_fiche_end() to close tab is not required. * @param string $picto Add a picto on tab title * @param int $pictoisfullpath If 1, image path is a full path. If you set this to 1, you can use url returned by dol_buildpath('/mymodyle/img/myimg.png',1) for $picto. * @return string @@ -833,7 +862,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi $limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD); $displaytab=0; $nbintab=0; - $popuptab=0; + $popuptab=0; $outmore=''; for ($i = 0 ; $i <= $maxkey ; $i++) { if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2])) @@ -926,7 +955,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi $out.="
    \n"; - if (! $notab) $out.="\n".'
    '."\n"; + if (! $notab || $notab == -1) $out.="\n".'
    '."\n"; $parameters=array('tabname' => $active, 'out' => $out); $reshook=$hookmanager->executeHooks('printTabsHead',$parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead" @@ -941,7 +970,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi /** * Show tab footer of a card * - * @param int $notab 0=Add tab footer, 1=no tab footer + * @param int $notab -1 or 0=Add tab footer, 1=no tab footer * @return void */ function dol_fiche_end($notab=0) @@ -952,12 +981,12 @@ function dol_fiche_end($notab=0) /** * Return tab footer of a card * - * @param int $notab 0=Add tab footer, 1=no tab footer + * @param int $notab -1 or 0=Add tab footer, 1=no tab footer * @return string */ function dol_get_fiche_end($notab=0) { - if (! $notab) return "\n
    \n"; + if (! $notab || $notab == -1) return "\n
    \n"; else return ''; } @@ -983,18 +1012,24 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { global $conf, $form, $user, $langs; + $error = 0; + $maxvisiblephotos=1; $showimage=1; $showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0); if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0; $modulepart='unknown'; - if ($object->element == 'societe') $modulepart='societe'; - if ($object->element == 'contact') $modulepart='contact'; - if ($object->element == 'member') $modulepart='memberphoto'; - if ($object->element == 'user') $modulepart='userphoto'; - if ($object->element == 'product') $modulepart='product'; - + if ($object->element == 'societe') $modulepart='societe'; + if ($object->element == 'contact') $modulepart='contact'; + if ($object->element == 'member') $modulepart='memberphoto'; + if ($object->element == 'user') $modulepart='userphoto'; + if ($object->element == 'product') $modulepart='product'; + if ($object->element == 'propal') $modulepart='propal'; + if ($object->element == 'commande') $modulepart='commande'; + if ($object->element == 'facture') $modulepart='facture'; + if ($object->element == 'fichinter') $modulepart='ficheinter'; + if ($object->element == 'product') { $width=80; $cssclass='photoref'; @@ -1010,7 +1045,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } elseif ($conf->browser->layout != 'phone') { // Show no photo link $nophoto='/public/theme/common/nophoto.png'; - $morehtmlleft.='
    No photo
    '; + $morehtmlleft.='
    No photo
    '; } } } @@ -1020,7 +1055,57 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r { if ($modulepart != 'unknown') { - $phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); + $phototoshow=''; + + // Check if a preview file is available + if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter')) && class_exists("Imagick")) + { + $objectref = dol_sanitizeFileName($object->ref); + $dir_output = $conf->$modulepart->dir_output . "/"; + $filepath = $dir_output . $objectref . "/"; + $file = $filepath . $objectref . ".pdf"; + $relativepath = $objectref.'/'.$objectref.'.pdf'; + + // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") + $fileimage = $file.'_preview.png'; // If PDF has 1 page + $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page + $relativepathimage = $relativepath.'_preview.png'; + + // Si fichier PDF existe + if (file_exists($file)) + { + $encfile = urlencode($file); + // Conversion du PDF en image png si fichier png non existant + if ( (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) + && (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) + ) + { + $ret = dol_convert_file($file, 'png', $fileimage); + if ($ret < 0) $error++; + } + + // Si fichier png PDF d'1 page trouve + if (file_exists($fileimage)) + { + $phototoshow = '
    '; + $phototoshow.= ''; + $phototoshow.= '
    '; + } + // Si fichier png PDF de plus d'1 page trouve + elseif (file_exists($fileimagebis)) + { + $preview = preg_replace('/\.png/','',$relativepathimage) . "-0.png"; + $phototoshow = '
    '; + $phototoshow.= '

    '; + $phototoshow.= '

    '; + } + } + } + else if (! $phototoshow) + { + $phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); + } + if ($phototoshow) { $morehtmlleft.='
    '; @@ -1028,28 +1113,38 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlleft.='
    '; } } - elseif ($conf->browser->layout != 'phone') // Show no photo link + + if (! $phototoshow && $conf->browser->layout != 'phone') // Show No photo link (picto of pbject) { $morehtmlleft.='
    '; if ($object->element == 'action') { + $width=80; $cssclass='photorefcenter'; $nophoto=img_picto('', 'title_agenda', '', false, 1); - $morehtmlleft.='
    No photo
    '; + $morehtmlleft.='
    No photo
    '; } else { $width=14; $cssclass='photorefcenter'; - $nophoto=img_picto('', 'object_'.$object->picto, '', false, 1); - $morehtmlleft.='
    No photo
    '; + $picto = $object->picto; + if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub + $nophoto=img_picto('', 'object_'.$picto, '', false, 1); + $morehtmlleft.='
    No photo
    '; } $morehtmlleft.='
    '; } } } + if ($showbarcode) $morehtmlleft.='
    '.$form->showbarcode($object).'
    '; - if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - $morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + + if ($object->element == 'societe') + { + if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) + { + $morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + } } elseif ($object->element == 'product') { @@ -1067,25 +1162,13 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r $morehtmlstatus.=$object->getLibStatut(5,1); } } - elseif ($object->element == 'facture' || $object->element == 'invoice' || $object->element == 'invoice_supplier') + elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) { $tmptxt=$object->getLibStatut(6, $object->totalpaye); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } - elseif ($object->element == 'chargesociales') - { - $tmptxt=$object->getLibStatut(6, $object->totalpaye); - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); - $morehtmlstatus.=$tmptxt; - } - elseif ($object->element == 'loan') - { - $tmptxt=$object->getLibStatut(6, $object->totalpaye); - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); - $morehtmlstatus.=$tmptxt; - } - elseif ($object->element == 'contrat') + elseif ($object->element == 'contrat' || $object->element == 'contract') { if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); else $morehtmlstatus.=$object->getLibStatut(4); @@ -1097,11 +1180,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } if (! empty($object->name_alias)) $morehtmlref.='
    '.$object->name_alias.'
    '; // For thirdparty - if ($object->element == 'product' || $object->element == 'bank_account') + // Add label + if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') { - if(! empty($object->label)) $morehtmlref.='
    '.$object->label.'
    '; + if (! empty($object->label)) $morehtmlref.='
    '.$object->label.'
    '; } - + if ($object->element != 'product' && $object->element != 'bookmark') { $morehtmlref.='
    '; @@ -1548,6 +1632,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) */ function dol_now($mode='gmt') { + $ret=''; // Note that gmmktime and mktime return same value (GMT) when used without parameters //if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead if ($mode == 'gmt') $ret=time(); // Time for now at greenwich. @@ -1959,12 +2044,12 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0, $charfornl if ($showgmap) { $url=dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id,1); - $out.=' '; + $out.=' '; } if ($showomap) { $url=dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id,1); - $out.=' '; + $out.=' '; } } } @@ -2296,14 +2381,14 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo * Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img * Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img * Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1) - * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @param int $pictoisfullpath If 1, image path is a full path * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @return string Return img tag * @see #img_object, #img_picto_common */ -function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) +function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) { global $conf; @@ -2355,7 +2440,7 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $ if (preg_match('/:[^\s0-9]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB $title=$tmparray[0]; $alt=empty($tmparray[1])?'':$tmparray[1]; - return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup + return ''.dol_escape_htmltag($alt).''; // Alt is used for accessibility, title for popup } } @@ -2365,16 +2450,16 @@ function img_picto($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $ * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image to show object_picto (example: user, group, action, bill, contract, propal, product, ...) * For external modules use imagename@mymodule to search into directory "img" of module. - * @param string $morealt Add more attribute on img tag (ie: class="datecallink") + * @param string $moreatt Add more attribute on img tag (ie: class="datecallink") * @param int $pictoisfullpath If 1, image path is a full path * @param int $srconly Return only content of the src attribute of img. * @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip. * @return string Return img tag * @see #img_picto, #img_picto_common */ -function img_object($titlealt, $picto, $morealt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) +function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly=0, $notitle=0) { - return img_picto($titlealt, 'object_'.$picto, $morealt, $pictoisfullpath, $srconly, $notitle); + return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle); } /** @@ -2382,12 +2467,12 @@ function img_object($titlealt, $picto, $morealt = '', $pictoisfullpath = false, * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. - * @param string $morealt Add more attribute on img tag + * @param string $moreatt Add more attribute on img tag * @param int $pictoisfullpath If 1, image path is a full path * @return string Return img tag * @see #img_object, #img_picto */ -function img_weather($titlealt, $picto, $morealt = '', $pictoisfullpath = 0) +function img_weather($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0) { global $conf; @@ -2395,7 +2480,7 @@ function img_weather($titlealt, $picto, $morealt = '', $pictoisfullpath = 0) $path = DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/weather/'.$picto; - return img_picto($titlealt, $path, $morealt, 1); + return img_picto($titlealt, $path, $moreatt, 1); } /** @@ -2403,12 +2488,12 @@ function img_weather($titlealt, $picto, $morealt = '', $pictoisfullpath = 0) * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param string $picto Name of image file to show (If no extension provided, we use '.png'). Image must be stored into htdocs/theme/common directory. - * @param string $morealt Add more attribute on img tag + * @param string $moreatt Add more attribute on img tag * @param int $pictoisfullpath If 1, image path is a full path * @return string Return img tag * @see #img_object, #img_picto */ -function img_picto_common($titlealt, $picto, $morealt = '', $pictoisfullpath = 0) +function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0) { global $conf; @@ -2427,7 +2512,7 @@ function img_picto_common($titlealt, $picto, $morealt = '', $pictoisfullpath = 0 } } - return img_picto($titlealt, $path, $morealt, 1); + return img_picto($titlealt, $path, $moreatt, 1); } /** @@ -2510,7 +2595,7 @@ function img_edit_remove($titlealt = 'default', $other='') * @param string $other Add more attributes on img * @return string Return tag img */ -function img_edit($titlealt = 'default', $float = 0, $other = '') +function img_edit($titlealt = 'default', $float = 0, $other = 'class="pictoedit"') { global $conf, $langs; @@ -2533,9 +2618,9 @@ function img_view($titlealt = 'default', $float = 0, $other = '') if ($titlealt == 'default') $titlealt = $langs->trans('View'); - $morealt = ($float ? 'style="float: right" ' : '').$other; + $moreatt = ($float ? 'style="float: right" ' : '').$other; - return img_picto($titlealt, 'view.png', $morealt); + return img_picto($titlealt, 'view.png', $moreatt); } /** @@ -2545,7 +2630,7 @@ function img_view($titlealt = 'default', $float = 0, $other = '') * @param string $other Add more attributes on img * @return string Retourne tag img */ -function img_delete($titlealt = 'default', $other = '') +function img_delete($titlealt = 'default', $other = 'class="pictodelete"') { global $conf, $langs; @@ -2568,6 +2653,22 @@ function img_printer($titlealt = "default", $other='') return img_picto($titlealt,'printer.png',$other); } +/** + * Show delete logo + * + * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. + * @param string $other Add more attributes on img + * @return string Retourne tag img + */ +function img_split($titlealt = 'default', $other = 'class="pictosplit"') +{ + global $conf, $langs; + + if ($titlealt == 'default') $titlealt = $langs->trans('Split'); + + return img_picto($titlealt, 'split.png', $other); +} + /** * Show help logo with cursor "?" * @@ -2607,16 +2708,17 @@ function img_info($titlealt = 'default') * Show warning logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. - * @param string $morealt Add more attribute on img tag (For example 'style="float: right"'). If 1 + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"'). If 1 * @return string Return img tag */ -function img_warning($titlealt = 'default', $morealt = '') +function img_warning($titlealt = 'default', $moreatt = '') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): '')); + //return '
    '.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'
    '; + return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')); } /** @@ -2631,39 +2733,41 @@ function img_error($titlealt = 'default') if ($titlealt == 'default') $titlealt = $langs->trans('Error'); - return img_picto($titlealt, 'error.png'); + return img_picto($titlealt, 'error.png', 'class="valigntextbottom"'); } /** * Show next logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. -* @param string $morealt Add more attribute on img tag (For example 'style="float: right"') +* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_next($titlealt = 'default', $morealt='') +function img_next($titlealt = 'default', $moreatt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Next'); - return img_picto($titlealt, 'next.png', $morealt); + //return img_picto($titlealt, 'next.png', $moreatt); + return ''; } /** * Show previous logo * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. - * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_previous($titlealt = 'default', $morealt='') +function img_previous($titlealt = 'default', $moreatt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Previous'); - return img_picto($titlealt, 'previous.png', $morealt); + //return img_picto($titlealt, 'previous.png', $moreatt); + return ''; } /** @@ -2705,16 +2809,16 @@ function img_up($titlealt = 'default', $selected = 0, $moreclass='') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected - * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_left($titlealt = 'default', $selected = 0, $morealt='') +function img_left($titlealt = 'default', $selected = 0, $moreatt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Left'); - return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $morealt); + return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $moreatt); } /** @@ -2722,16 +2826,16 @@ function img_left($titlealt = 'default', $selected = 0, $morealt='') * * @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title. * @param int $selected Selected - * @param string $morealt Add more attribute on img tag (For example 'style="float: right"') + * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"') * @return string Return img tag */ -function img_right($titlealt = 'default', $selected = 0, $morealt='') +function img_right($titlealt = 'default', $selected = 0, $moreatt='') { global $conf, $langs; if ($titlealt == 'default') $titlealt = $langs->trans('Right'); - return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $morealt); + return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $moreatt); } /** @@ -3023,13 +3127,13 @@ function print_liste_field_titre($name, $file="", $field="", $begin="", $morepar /** * Get title line of an array * - * @param string $name Label of field + * @param string $name Translation key of field * @param int $thead 0=To use with standard table format, 1=To use inside
    '; print $key; diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index f1748a0dfb9..3f7029dd26b 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -50,7 +50,7 @@ function loan_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->loan->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id; $head[$tab][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index 574f7a5b950..550ec6ad534 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -79,7 +79,7 @@ function member_prepare_head(Adherent $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0,0,0,1,$object,'member'); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 1458f37fdce..89bbe24ea47 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -60,14 +60,6 @@ function commande_prepare_head(Commande $object) $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$object->id; - $head[$h][1] = $langs->trans("Preview"); - $head[$h][2] = 'preview'; - $h++; - } - if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); @@ -99,7 +91,7 @@ function commande_prepare_head(Commande $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/parsemd.lib.php b/htdocs/core/lib/parsemd.lib.php new file mode 100644 index 00000000000..13334fd400c --- /dev/null +++ b/htdocs/core/lib/parsemd.lib.php @@ -0,0 +1,56 @@ + + * + * 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 htdocs/core/lib/parsemd.lib.php + * \brief This file contains functions dedicated to MD parsind. + */ + +/** + * Function to parse MD content into HTML + * + * @param string $content MD content + * @param string $parser 'parsedown' or 'nl2br' + * @param string $replaceimagepath Replace path to image with another path. Exemple: ('doc/'=>'xxx/aaa/') + * @return string Parsed content + */ +function dolMd2Html($content, $parser='parsedown',$replaceimagepath=null) +{ + if (is_array($replaceimagepath)) + { + foreach($replaceimagepath as $key => $val) + { + $keytoreplace = ']('.$key; + $valafter = ']('.$val; + $content = preg_replace('/'.preg_quote($keytoreplace,'/').'/m', $valafter, $content); + } + } + if ($parser == 'parsedown') + { + include_once DOL_DOCUMENT_ROOT.'/includes/parsedown/Parsedown.php'; + $Parsedown = new Parsedown(); + $content = $Parsedown->text($content); + } + else + { + $content = nl2br($content); + } + + return $content; +} + diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index aaf3ae0bb9d..5aec64f3ce0 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -149,11 +149,11 @@ function product_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id,2,0,0,$object,'product').$object->id.'/photos'; - $nbFiles += count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles += count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); } $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$object->id; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 173aee8ce26..96bcbaa00c4 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -82,7 +82,7 @@ function project_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); @@ -150,8 +150,23 @@ function task_prepare_head($object) $head[$h][2] = 'task_contact'; $h++; + // Is there timespent ? + $nbTimeSpent=0; + $sql = "SELECT t.rowid"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid"; + $sql .= " AND t.fk_task =".$object->id; + $resql = $db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($obj) $nbTimeSpent=1; + } + else dol_print_error($db); + $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); $head[$h][1] = $langs->trans("TimeSpent"); + if ($nbTimeSpent > 0) $head[$h][1].= ' ...'; $head[$h][2] = 'task_time'; $h++; @@ -177,7 +192,7 @@ function task_prepare_head($object) $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][1] = $langs->trans('Documents'); if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' '.($nbFiles+$nbLinks).''; @@ -635,7 +650,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) { // Thirdparty - print ''; + print ''; $thirdpartystatic->id=$lines[$i]->socid; $thirdpartystatic->name=$lines[$i]->thirdparty_name; print $thirdpartystatic->getNomUrl(1, 'project', 10); @@ -839,10 +854,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) { // Thirdparty - print ''; + print ''; $thirdpartystatic->id=$lines[$i]->thirdparty_id; $thirdpartystatic->name=$lines[$i]->thirdparty_name; - print $thirdpartystatic->getNomUrl(1, 'project', 10); + print $thirdpartystatic->getNomUrl(1, 'project'); print ''; if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('',$langs->trans("YouAreNotContactOfProject")); @@ -1135,8 +1149,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks= $projectstatic->datee = $db->jdate($objp->datee); $projectstatic->dateo = $db->jdate($objp->dateo); - $var=!$var; - print "
    '; print $projectstatic->getNomUrl(1); if (! in_array('projectlabel', $hiddenfields)) print '
    '.dol_trunc($objp->title,24); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 13fbe06e7d4..f0d42888745 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -55,13 +55,6 @@ function propal_prepare_head($object) $head[$h][2] = 'shipping'; $h++; } - if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id; - $head[$h][1] = $langs->trans("Preview"); - $head[$h][2] = 'preview'; - $h++; - } if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -94,7 +87,7 @@ function propal_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index a6c63dc51e4..78cd0af3a12 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -70,7 +70,7 @@ function resource_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $upload_dir = $conf->resource->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $head[$h][0] = DOL_URL_ROOT.'/resource/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); if($nbFiles > 0) $head[$h][1].= ' '.$nbFiles.''; diff --git a/htdocs/core/lib/salaries.lib.php b/htdocs/core/lib/salaries.lib.php index 2e230ad2302..eaaa90a710e 100644 --- a/htdocs/core/lib/salaries.lib.php +++ b/htdocs/core/lib/salaries.lib.php @@ -45,7 +45,7 @@ function salaries_prepare_head($object) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index c20169270bf..7870824285a 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -1,6 +1,6 @@ - * Copyright (C) 2008-2012 Regis Houssin + * Copyright (C) 2008-2017 Regis Houssin * * 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,7 +74,7 @@ function dol_decode($chain) * If constant MAIN_SECURITY_SALT is defined, we use it as a salt. * * @param string $chain String to hash - * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0. + * @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5, 4:md5 for OpenLdap). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0. * @return string Hash of string */ function dol_hash($chain,$type=0) @@ -87,6 +87,7 @@ function dol_hash($chain,$type=0) if ($type == 1) return sha1($chain); else if ($type == 2) return sha1(md5($chain)); else if ($type == 3) return md5($chain); + else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5 else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain); else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain)); @@ -343,7 +344,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu * This function is also called by restrictedArea * * @param User $user User to check - * @param array $featuresarray Features/modules to check. Example: ('user','service') + * @param array $featuresarray Features/modules to check. Example: ('user','service') * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional). * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. @@ -367,7 +368,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh // For backward compatibility if ($feature == 'member') $feature='adherent'; - + $check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company) $checksoc = array('societe'); // Test for societe object $checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index fc05e2c9194..cadf133169d 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -227,11 +227,11 @@ function dol_loginfunction($langs,$conf,$mysoc) if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_small); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('thumbs/'.$mysoc->logo_small); } elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode($mysoc->logo); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode($mysoc->logo); $width=128; } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 488a74b76a3..3455979afbe 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -233,9 +233,9 @@ function show_list_sending_receive($origin,$origin_id,$filter='') $var=True; while ($i < $num) { - $var=!$var; + $objp = $db->fetch_object($resql); - print "
    '; diff --git a/htdocs/core/lib/supplier_proposal.lib.php b/htdocs/core/lib/supplier_proposal.lib.php index 1e48edcb87d..580fecf0667 100644 --- a/htdocs/core/lib/supplier_proposal.lib.php +++ b/htdocs/core/lib/supplier_proposal.lib.php @@ -65,7 +65,7 @@ function supplier_proposal_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->supplier_proposal->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/supplier_proposal/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index 0fc401f0280..4764d1bfb65 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -55,7 +55,7 @@ function tax_prepare_head(ChargeSociales $object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->tax->dir_output . "/" . dol_sanitizeFileName($object->ref); - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/compta/sociales/document.php?id='.$object->id; $head[$h][1] = $langs->trans("Documents"); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 1b5fdd69c26..4350edc3797 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -149,7 +149,7 @@ function user_prepare_head($object) require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->user->dir_output . "/" . $object->id; - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); + $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][0] = DOL_URL_ROOT.'/user/document.php?userid='.$object->id; $head[$h][1] = $langs->trans("Documents"); @@ -239,6 +239,11 @@ function user_admin_prepare_head() $head[$h][2] = 'card'; $h++; + $head[$h][0] = DOL_URL_ROOT.'/admin/usergroup.php'; + $head[$h][1] = $langs->trans("Group"); + $head[$h][2] = 'usergroupcard'; + $h++; + $head[$h][0] = DOL_URL_ROOT.'/user/admin/user_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFields"); $head[$h][2] = 'attributes'; @@ -329,25 +334,23 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) $thumbsbyrow=6; print ''; - $var=false; - // Title if ($foruserprofile) { - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; } else { - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; } - //$var=!$var; - print ' - - + global->MAIN_VIEW_LINE_NUMBER)) { ?> + + + element == 'supplier_proposal') { ?> @@ -112,15 +114,20 @@ if ($nolinesbefore) { - +global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay=2; } + $coldisplay=2; + ?> + multicurrency->enabled)) { $colspan++;?> @@ -283,7 +290,7 @@ else { "> - global->PRODUCT_USE_UNITS) @@ -293,11 +300,11 @@ else { print ''; } ?> - + situation_cycle_ref) { $coldisplay++; - print ''; + print ''; } if (! empty($usemargins)) { @@ -309,7 +316,7 @@ else { - "> + "> global->DISPLAY_MARGIN_RATES)) { - echo ''; + echo ''; $coldisplay++; } if (! empty($conf->global->DISPLAY_MARK_RATES)) { - echo ''; + echo ''; $coldisplay++; } } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d982516bd67..2f839e06281 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -46,6 +46,7 @@ $colspan = 3; // Col total ht + col edit + col delete if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc if (in_array($object->element,array('propal','supplier_proposal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button if (empty($user->rights->margins->creer)) $colspan++; +if (!empty($conf->multicurrency->enabled)) $colspan+=2; ?> @@ -114,23 +115,22 @@ $coldisplay=-1; // We remove first td if ($this->situation_counter == 1 || !$this->situation_cycle_ref) { print ''; } else { - print ''; + print ''; } $coldisplay++; - print ''; if (!empty($conf->multicurrency->enabled)) { - $colspan++; - print ''; + print ''; } if ($inputalsopricewithtax) { $coldisplay++; - print ''; } @@ -141,7 +141,7 @@ $coldisplay=-1; // We remove first td // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated // must also not be output for most entities (proposal, intervention, ...) //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; - print 'situation_counter > 1) print ' readonly'; print '>'; } else { ?> @@ -160,7 +160,7 @@ $coldisplay=-1; // We remove first td '; + print ''; } if (! empty($usemargins)) { @@ -179,10 +179,10 @@ $coldisplay=-1; // We remove first td rights->margins->creer) { @@ -193,7 +193,7 @@ $coldisplay=-1; // We remove first td if ($line->subprice < 0) echo ''; else - echo ''; + echo ''; $coldisplay++; } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) @@ -203,7 +203,7 @@ $coldisplay=-1; // We remove first td if ($line->subprice < 0) echo ''; else - echo ''; + echo ''; $coldisplay++; } } @@ -227,7 +227,7 @@ $coldisplay=-1; // We remove first td service->enabled) && $line->product_type == 1 && $dateSelector) { ?> > - - '; +print ''; print ''; print ''; + +print ''; print ''; print ''; // DISPLAY MARK RATES -$var=!$var; -print ''; + +print ''; print ''; print ''; print ''; print ''; -$var=!$var; -print ''; + +print ''; print ''; print ''; +print ''; print ''; print ''; print ''; // INTERNAL CONTACT TYPE USED AS COMMERCIAL AGENT -$var=!$var; + print ''; print ''; print ""; -print ''; +print ''; print ''; print '"; + print ''; if ($agentid > 0) { $companystatic->id=$objp->socid; $companystatic->name=$objp->name; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index abfb89171dd..bcb3cc65699 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -260,9 +260,9 @@ if ($result) $markRate = ($pv != 0)?(100 * $marge / $pv):'' ; } - $var=!$var; + - print ""; + print ''; if ($client) { print '"; + print ''; if ($id > 0) { print ''; + print ''; print '"; + print ''; print ''."\n"; // Fields title search @@ -428,17 +428,14 @@ print ''."\n"; $i=0; -$var=true; $totalarray=array(); while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); if ($obj) { - $var = !$var; - // Show here line of result - print ''; + print ''; // LIST_OF_TD_FIELDS_LIST /* if (! empty($arrayfields['t.field1']['checked'])) diff --git a/dev/skeletons/skeleton_script.php b/htdocs/modulebuilder/skeletons/skeleton_script.php similarity index 100% rename from dev/skeletons/skeleton_script.php rename to htdocs/modulebuilder/skeletons/skeleton_script.php diff --git a/dev/skeletons/skeleton_webservice_server.php b/htdocs/modulebuilder/skeletons/skeleton_webservice_server.php similarity index 100% rename from dev/skeletons/skeleton_webservice_server.php rename to htdocs/modulebuilder/skeletons/skeleton_webservice_server.php diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 133f1554b49..bb4d4650344 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -338,18 +338,8 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $url=$urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php',1).'?sondage='.$object->id_sondage; -$urllink=''; -print $urllink; -if ($action != 'edit') -{ - print ''; - print ' '.$langs->trans("Link").''; - -} +print ''; +if ($action != 'edit') print ajax_autoselect("opensurveyurl", 1); print ''; diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index d194646140c..3828d4e5e25 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -108,7 +108,7 @@ function showlogo() // Print logo if ($mysoc->logo) { if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file=thumbs/'.urlencode($mysoc->logo_small); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file=thumbs/'.urlencode($mysoc->logo_small); } } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 9a95797736d..203602bde6e 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -33,8 +33,9 @@ if (!$user->rights->opensurvey->read) accessforbidden(); $action=GETPOST('action'); $id=GETPOST('id','alpha'); $numsondage= $id; -$surveytitle=GETPOST('surveytitle'); -$status=GETPOST('status'); +$search_ref = GETPOST('search_ref', 'alpha'); +$surveytitle=GETPOST('surveytitle', 'alpha'); +$status=GETPOST('status', 'int'); //if (! isset($_POST['status']) && ! isset($_GET['status'])) $status='opened'; // If filter unknown, we choose 'opened' $sortfield = GETPOST("sortfield",'alpha'); @@ -61,6 +62,7 @@ if (GETPOST('button_removefilter')) { $status=''; $surveytitle=''; + $search_ref=''; } @@ -93,19 +95,8 @@ $moreforfilter = ''; print '
    '; print '
    '.$langs->trans("Parameter").''.$langs->trans("DefaultValue").'
    '.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' 
    '.$langs->trans("DefaultSkin").''.$conf->global->MAIN_THEME.' '.$langs->trans("UsePersonalValue").' '.$langs->trans("UsePersonalValue").' 
    '.$langs->trans("DefaultSkin").'
    '.$langs->trans("DefaultSkin").''; $url='https://www.dolistore.com/lang-en/4-skins'; if (preg_match('/fr/i',$langs->defaultlang)) $url='https://www.dolistore.com/fr/4-themes'; @@ -357,7 +360,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; print '
    '.$langs->trans("ThemeDir").''; foreach($dirthemes as $dirtheme) @@ -368,8 +371,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '
    '; + print '
    '; print ''; + /* + print ''; print ''; print ''; print ''; + print ''; print ''; print ''; + /* + print ''; print ''; print ''; print ''; + $default='5a6482'; + if ($conf->theme == 'md') $default='5a3278'; + + print ''; print ''; print ''; + /* + print ''; print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; @@ -599,8 +598,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else { - $var=!$var; - print ''; + print ''; print ''; print ''; + /* + print ''; print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -681,7 +677,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else { - print ''; + print ''; print ''; print '"; $html.= ''; diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php new file mode 100644 index 00000000000..811a99d5b2a --- /dev/null +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -0,0 +1,499 @@ + + * Copyright (C) 2012 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 +* 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 htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php + * \ingroup societe + * \brief File of class to build ODT documents for products/services + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; + + +/** + * Class to build documents using ODF templates generator + */ +class doc_generic_product_odt extends ModelePDFProduct +{ + var $emetteur; // Objet societe qui emet + + var $phpmin = array(5,2,0); // Minimum version of PHP required by module + var $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $conf,$langs,$mysoc; + + $langs->load("main"); + $langs->load("companies"); + + $this->db = $db; + $this->name = "ODT templates"; + $this->description = $langs->trans("DocumentModelOdt"); + $this->scandir = 'PRODUCT_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan + + // Dimension page pour format A4 + $this->type = 'odt'; + $this->page_largeur = 0; + $this->page_hauteur = 0; + $this->format = array($this->page_largeur,$this->page_hauteur); + $this->marge_gauche=0; + $this->marge_droite=0; + $this->marge_haute=0; + $this->marge_basse=0; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva PRODUCT_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 0; // Support add of a watermark on drafts + + // Recupere emetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined + } + + + /** + * Return description of a module + * + * @param Translate $langs Lang object to use for output + * @return string Description + */ + function info($langs) + { + global $conf,$langs; + + $langs->load("companies"); + $langs->load("errors"); + + $form = new Form($this->db); + + $texte = $this->description.".
    \n"; + $texte.= '
    '; + $texte.= ''; + $texte.= ''; + $texte.= ''; + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + $texte.= ''; + $texte.= ''; + $texte.= ''; + } + $texte.= '
    '; @@ -405,11 +407,11 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '
    '; if ($subdir == $selected_theme) { - print ' '.$subdir.''; + print ' '.$subdir.''; } else { - print ' '.$subdir; + print ' '.$subdir; } print '
    '; @@ -427,8 +429,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) // BackgroundColor if ($foruserprofile) { - /*$var=!$var; - print '
    '.$langs->trans("TopMenuBackgroundColor").''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); @@ -450,8 +452,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else { - $var=!$var; - print '
    '.$langs->trans("BackgroundColor").''; //var_dump($conf->global->THEME_ELDY_BACKBODY); @@ -473,8 +474,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) // TopMenuBackgroundColor if ($foruserprofile) { - /*$var=!$var; - print '
    '.$langs->trans("TopMenuBackgroundColor").''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); @@ -496,10 +497,10 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else { - $default='515870'; - if ($conf->theme == 'md') $default='5A3278'; - $var=!$var; - print '
    '.$langs->trans("TopMenuBackgroundColor").''; if ($edit) @@ -520,8 +521,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) // TopMenuBackgroundColor if ($foruserprofile) { - /*$var=!$var; - print '
    '.$langs->trans("TopMenuBackgroundColor").''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); @@ -544,8 +545,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) else { $default=$langs->trans('No'); - $var=!$var; - print '
    '.$langs->trans("TopMenuDisableImages").''; if ($edit) @@ -572,8 +572,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else { - $var=!$var; - print '
    '.$langs->trans("BackgroundTableTitleColor").''; if ($edit) @@ -584,7 +583,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': e6e6e6) '; + print '   ('.$langs->trans("Default").': f0f0f0) '; // $colorbacktitle1 in CSS print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print '
    '.$langs->trans("TextTitleColor").''; if ($edit) @@ -622,8 +620,8 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) // Text LinkColor if ($foruserprofile) { - /*$var=!$var; - print '
    '.$langs->trans("TopMenuBackgroundColor").''.($conf->global->THEME_ELDY_TOPMENU_BACK1?$conf->global->THEME_ELDY_TOPMENU_BACK1:$langs->trans("Default")).'conf->THEME_ELDY_TOPMENU_BACK1)?" checked":""); @@ -645,8 +643,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } else { - $var=!$var; - print '
    '.$langs->trans("LinkColor").''; if ($edit) @@ -665,11 +662,10 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) } // Use Hover - $var=!$var; if ($foruserprofile) { /* Must first change option to choose color of highlight instead of yes or no. - print '
    '.$langs->trans("HighlightLinesOnMouseHover").'global->THEME_ELDY_USE_HOVER?" checked":"").'> '.$langs->trans("UsePersonalValue").'
    '.$langs->trans("HighlightLinesColor").''; //print ''; diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index ee162bd9cc8..daf82b2f995 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -47,7 +47,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= { dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./','*',$passwordtotest)." entitytotest=".$entitytotest); - // If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko + // If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko $table = MAIN_DB_PREFIX."user"; $usernamecol1 = 'login'; $usernamecol2 = 'email'; @@ -59,6 +59,9 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'"; $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; $sql.=' AND statut = 1'; + // Required to first found the user into entity, then the superadmin. + // For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0. + $sql.=' ORDER BY entity DESC'; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 59886b99f63..54cddfcaa96 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -68,14 +68,14 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/card.php?leftmenu=users&action=create', 'NewGroup', 2, 'users', '($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin', '', 2, 0, __ENTITY__); -- Third parties insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/soc.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/card.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=f&leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/card.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=p&leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/card.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?type=c&leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/card.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); -- Third parties - Contacts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', 'contacts', 2__+MAX_llx_menu__, '/contact/list.php?leftmenu=contacts', 'ContactsAddresses', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/card.php?leftmenu=contacts&action=create', 'NewContactAddress', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__); @@ -171,7 +171,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_invoice->enabled', __HANDLER__, 'left', 1604__+MAX_llx_menu__, 'accountancy', '', 1600__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier', 'Statistics', 1, 'bills', '$user->rights->fournisseur->facture->lire', '', 2, 8, __ENTITY__); -- Accountancy - Customer invoice insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1700__+MAX_llx_menu__, 'accountancy', 'customer_bills', 6__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'BillsCustomers', 0, 'bills', '$user->rights->facture->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1701__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/card.php?action=create&leftmenu=customers_bills', 'NewBill', 1, 'bills', '$user->rights->facture->creer', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1705__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/list.php?leftmenu=customers_bills', 'List', 1, 'bills', '$user->rights->facture->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1702__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/fiche-rec.php?leftmenu=customers_bills', 'ListOfTemplates', 1, 'bills', '$user->rights->facture->lire', '', 2, 5, __ENTITY__); @@ -281,20 +281,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3600__+MAX_llx_menu__, 'project', 'projects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects', 'Projects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3601__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3602__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); - -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3610__+MAX_llx_menu__, 'project', 'myprojects', 7__+MAX_llx_menu__, '/projet/index.php?leftmenu=projects&mode=mine', 'MyProjects', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3611__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/card.php?leftmenu=projects&action=create&mode=mine', 'NewProject', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3612__+MAX_llx_menu__, 'project', '', 3610__+MAX_llx_menu__, '/projet/list.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3603__+MAX_llx_menu__, 'project', '', 3600__+MAX_llx_menu__, '/projet/stats/index.php?leftmenu=projects', 'Statistics', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3700__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects', 'Activities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3701__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3702__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3703__+MAX_llx_menu__, 'project', '', 3700__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3800__+MAX_llx_menu__, 'project', '', 7__+MAX_llx_menu__, '/projet/activity/index.php?leftmenu=projects&mode=mine', 'MyActivities', 0, 'projects', '$user->rights->projet->lire', '', 2, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3801__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks.php?leftmenu=projects&action=create', 'NewTask', 1, 'projects', '$user->rights->projet->creer', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3802__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/tasks/list.php?leftmenu=projects&mode=mine', 'List', 1, 'projects', '$user->rights->projet->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->projet->enabled', __HANDLER__, 'left', 3803__+MAX_llx_menu__, 'project', '', 3800__+MAX_llx_menu__, '/projet/activity/perweek.php?leftmenu=projects&mode=mine', 'NewTimeSpent', 1, 'projects', '$user->rights->projet->lire', '', 2, 3, __ENTITY__); -- Project - Categories insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3804__+MAX_llx_menu__, 'project', 'cat', 3__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=6', 'Categories', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->categorie->enabled', __HANDLER__, 'left', 3805__+MAX_llx_menu__, 'project', '', 3200__+MAX_llx_menu__, '/categories/card.php?action=create&type=6', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 2c2d2c5ec63..e95359e5683 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -257,7 +257,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=companylogo&file='.urlencode('thumbs/'.$mysoc->logo_mini); + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('thumbs/'.$mysoc->logo_mini); } else { diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 5402ac5bbd1..4b19ffd5f3b 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -150,8 +150,8 @@ class MenuManager print ''."\n"; foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { - print '
    '.$value.'
    '; + + // List of directories area + $texte.= ''; + + $texte.= ''; + $texte.= ''; + + $texte.= '
    '; + $texttitle=$langs->trans("ListOfDirectories"); + $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->PRODUCT_ADDON_PDF_ODT_PATH))); + $listoffiles=array(); + foreach($listofdir as $key=>$tmpdir) + { + $tmpdir=trim($tmpdir); + $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); + if (! $tmpdir) { + unset($listofdir[$key]); continue; + } + if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); + else + { + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); + if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); + } + } + $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); + // Add list of substitution keys + $texthelp.='
    '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
    '; + $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + + $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); + $texte.= '
    '; + $texte.= ''; + $texte.= '
    '; + $texte.= ''; + $texte.= '
    '; + + // Scan directories + if (count($listofdir)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + + /*if ($conf->global->MAIN_PRODUCT_CHOOSE_ODT_DOCUMENT > 0) + { + // Model for creation + $liste=ModelePDFProduct::liste_modeles($this->db); + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '"; + + $texte.= ''; + $texte.= ''; + $texte.= '"; + $texte.= ''; + + $texte.= ''; + $texte.= '"; + $texte.= '
    '.$langs->trans("DefaultModelPropalCreate").''; + $texte.= $form->selectarray('value2',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_DEFAULT); + $texte.= "
    '.$langs->trans("DefaultModelPropalToBill").''; + $texte.= $form->selectarray('value3',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_TOBILL); + $texte.= "
    '.$langs->trans("DefaultModelPropalClosed").''; + $texte.= $form->selectarray('value4',$liste,$conf->global->PRODUCT_ADDON_PDF_ODT_CLOSED); + $texte.= "
    '; + }*/ + } + + $texte.= '
    '; + $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte.= '
    '; + $texte.= ''; + + return $texte; + } + + /** + * Function to build a document on disk using the generic odt module. + * + * @param Product $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1 if OK, <=0 if KO + */ + function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) + { + global $product,$langs,$conf,$mysoc,$hookmanager,$user; + + if (empty($srctemplatepath)) + { + dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); + return -1; + } + + // Add odtgeneration hook + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + + if (! is_object($outputlangs)) $outputlangs=$langs; + $sav_charset_output=$outputlangs->charset_output; + $outputlangs->charset_output='UTF-8'; + + $outputlangs->load("main"); + $outputlangs->load("dict"); + $outputlangs->load("companies"); + $outputlangs->load("bills"); + if ($conf->produit->dir_output) + { + // If $object is id instead of object + if (! is_object($object)) + { + $id = $object; + $object = new Product($this->db); + $result=$object->fetch($id); + if ($result < 0) + { + dol_print_error($this->db,$object->error); + return -1; + } + } + $productFournisseur = new ProductFournisseur($this->db); + $supplierprices = $productFournisseur->list_product_fournisseur_price($object->id); + $object->supplierprices = $supplierprices; + + $dir = $conf->produit->dir_output; + $objectref = dol_sanitizeFileName($object->ref); + if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; + $file = $dir . "/" . $objectref . ".odt"; + + if (! file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + if (file_exists($dir)) + { + //print "srctemplatepath=".$srctemplatepath; // Src filename + $newfile=basename($srctemplatepath); + $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); + $newfiletmp=preg_replace('/template_/i','',$newfiletmp); + $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); + + $newfiletmp=$objectref.'_'.$newfiletmp; + + // Get extension (ods or odt) + $newfileformat=substr($newfile, strrpos($newfile, '.')+1); + if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) + { + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; + } + else + { + $filename=$newfiletmp.'.'.$newfileformat; + } + $file=$dir.'/'.$filename; + //print "newdir=".$dir; + //print "newfile=".$newfile; + //print "file=".$file; + //print "conf->produit->dir_temp=".$conf->produit->dir_temp; + + dol_mkdir($conf->produit->dir_temp); + + + // If CUSTOMER contact defined on product, we use it + $usecontact=false; + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); + if (count($arrayidcontact) > 0) + { + $usecontact=true; + $result=$object->fetch_contact($arrayidcontact[0]); + } + + // Recipient name + if (! empty($usecontact)) + { + // On peut utiliser le nom de la societe du contact + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; + else { + $socobject = $object->client; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } + } + else + { + $socobject=$object->client; + } + // Make substitution + $substitutionarray=array( + '__FROM_NAME__' => $this->emetteur->name, + '__FROM_EMAIL__' => $this->emetteur->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_vat + ); + complete_substitutions_array($substitutionarray, $langs, $object); + // Call the ODTSubstitution hook + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray); + $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + // Line of free text + $newfreetext=''; + $paramfreetext='product_FREE_TEXT'; + if (! empty($conf->global->$paramfreetext)) + { + $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); + } + + // Open and load template + require_once ODTPHP_PATH.'odf.php'; + try { + $odfHandler = new odf( + $srctemplatepath, + array( + 'PATH_TO_TMP' => $conf->produit->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' + ) + ); + } + catch(Exception $e) + { + $this->error=$e->getMessage(); + return -1; + } + // After construction $odfHandler->contentXml contains content and + // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by + // [!-- BEGIN lines --]*[!-- END lines --] + //print html_entity_decode($odfHandler->__toString()); + //print exit; + + + // Make substitutions into odt of freetext + try { + $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + + // Make substitutions into odt + $array_global = $this->get_substitutionarray_each_var_object($object, $outputlangs); + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + //$array_objet=$this->get_substitutionarray_object($object,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in product as contact_xxx tags + $array_thirdparty_contact = array(); + if ($usecontact) + $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); + + $tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); + complete_substitutions_array($tmparray, $outputlangs, $object); + $object->fetch_optionals(); + // Call the ODTSubstitution hook + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); + $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + foreach($tmparray as $key=>$value) + { + try { + if (preg_match('/logo$/',$key)) // Image + { + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } + else // Text + { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } + catch(OdfException $e) + { + } + } + // Replace tags of lines + try + { + $listlines = $odfHandler->setSegment('supplierprices'); + if(!empty($object->supplierprices)){ + foreach ($object->supplierprices as $supplierprice) + { + $array_lines = $this->get_substitutionarray_each_var_object($supplierprice, $outputlangs); + complete_substitutions_array($array_lines, $outputlangs, $object, $supplierprice, "completesubstitutionarray_lines"); + // Call the ODTSubstitutionLine hook + $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$array_lines,'line'=>$supplierprice); + $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + foreach($array_lines as $key => $val) + { + try + { + $listlines->setVars($key, $val, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlines->merge(); + } + } + $odfHandler->mergeSegment($listlines); + } + catch(OdfException $e) + { + $this->error=$e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + + // Replace labels translated + $tmparray=$outputlangs->get_translations_for_substitutions(); + foreach($tmparray as $key=>$value) + { + try { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + } + + // Call the beforeODTSave hook + $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + // Write new file + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { + try { + $odfHandler->exportAsAttachedPDF($file); + }catch (Exception $e){ + $this->error=$e->getMessage(); + return -1; + } + } + else { + try { + $odfHandler->saveToDisk($file); + }catch (Exception $e){ + $this->error=$e->getMessage(); + return -1; + } + } + + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $odfHandler=null; // Destroy object + + return 1; // Success + } + else + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + return -1; + } + +} + diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php new file mode 100644 index 00000000000..5dca2b8378e --- /dev/null +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -0,0 +1,849 @@ + + * + * 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 htdocs/core/modules/product/doc/pdf_standard.modules.php + * \ingroup societe + * \brief File of class to build PDF documents for products/services + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + + +/** + * Class to build documents using ODF templates generator + */ +class pdf_standard extends ModelePDFProduct +{ + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; + + /** + * @var array() Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.3 = array(5, 3) + */ + public $phpmin = array(5, 2); + + /** + * Dolibarr version of the loaded document + * @public string + */ + public $version = 'dolibarr'; + + public $page_largeur; + public $page_hauteur; + public $format; + public $marge_gauche; + public $marge_droite; + public $marge_haute; + public $marge_basse; + + public $emetteur; // Objet societe qui emet + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + global $conf,$langs,$mysoc; + + $langs->load("main"); + $langs->load("companies"); + + $this->db = $db; + $this->name = "PDF template"; + $this->description = $langs->trans("DocumentModelPdf"); + + // Dimension page pour format A4 + $this->type = 'pdf'; + $formatarray=pdf_getFormat(); + $this->page_largeur = $formatarray['width']; + $this->page_hauteur = $formatarray['height']; + $this->format = array($this->page_largeur,$this->page_hauteur); + $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; + $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; + $this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10; + $this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva PRODUCT_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 1; // Support add of a watermark on drafts + + // Recupere emetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined + } + + + /** + * Function to build a document on disk using the generic odt module. + * + * @param Product $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1 if OK, <=0 if KO + */ + function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) + { + global $user,$langs,$conf,$mysoc,$db,$hookmanager; + + if (! is_object($outputlangs)) $outputlangs=$langs; + // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO + if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; + + $outputlangs->load("main"); + $outputlangs->load("dict"); + $outputlangs->load("companies"); + $outputlangs->load("bills"); + $outputlangs->load("products"); + $outputlangs->load("orders"); + $outputlangs->load("deliveries"); + + $nblignes = count($object->lines); + + if ($conf->produit->dir_output) + { + // Definition of $dir and $file + if ($object->specimen) + { + $dir = $conf->produit->dir_output; + $file = $dir . "/SPECIMEN.pdf"; + } + else + { + $objectref = dol_sanitizeFileName($object->ref); + $dir = $conf->produit->dir_output . "/" . $objectref; + $file = $dir . "/" . $objectref . ".pdf"; + } + + $productFournisseur = new ProductFournisseur($this->db); + $supplierprices = $productFournisseur->list_product_fournisseur_price($object->id); + $object->supplierprices = $supplierprices; + + if (! file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + if (file_exists($dir)) + { + // Add pdfgeneration hook + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('pdfgeneration')); + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + global $action; + $reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks + + // Create pdf instance + $pdf=pdf_getInstance($this->format); + $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance + $pdf->SetAutoPageBreak(1,0); + + $heightforinfotot = 40; // Height reserved to output the info and total part + $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page + $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) + + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); + // Set path to the background PDF File + if (empty($conf->global->MAIN_DISABLE_FPDI) && ! empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) + { + $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/'.$conf->global->MAIN_ADD_PDF_BACKGROUND); + $tplidx = $pdf->importPage(1); + } + + $pdf->Open(); + $pagenb=0; + $pdf->SetDrawColor(128,128,128); + + $pdf->SetTitle($outputlangs->convToOutputCharset($object->ref)); + $pdf->SetSubject($outputlangs->transnoentities("Order")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->thirdparty->name)); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + + $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right + + + // New page + $pdf->AddPage(); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; + $this->_pagehead($pdf, $object, 1, $outputlangs); + $pdf->SetFont('','', $default_font_size - 1); + $pdf->MultiCell(0, 3, ''); // Set interline to 3 + $pdf->SetTextColor(0,0,0); + + + $tab_top = 42; + $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?42:10); + $tab_height = 130; + $tab_height_newpage = 150; + + // + $pdf->SetFont('','B', $default_font_size); + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $tab_top, dol_htmlentitiesbr($object->label), 0, 1); + $nexY = $pdf->GetY(); + + $pdf->SetFont('','', $default_font_size); + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, dol_htmlentitiesbr($object->description), 0, 1); + $nexY = $pdf->GetY(); + + $nexY+=5; + + if ($object->weight) + { + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Weight").': '.dol_htmlentitiesbr($object->weight), 0, 1); + $nexY = $pdf->GetY(); + } + if ($object->weight) + { + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.$object->length.'x'.$object->width.'x'.$object->height, 0, 1); + $nexY = $pdf->GetY(); + } + if ($object->surface) + { + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Area").': '.dol_htmlentitiesbr($object->surface), 0, 1); + $nexY = $pdf->GetY(); + } + if ($object->volume) + { + $pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Volume").': '.dol_htmlentitiesbr($object->volume), 0, 1); + $nexY = $pdf->GetY(); + } + + + // Affiche notes + // TODO There is no public note on product yet + $notetoshow=empty($object->note_public)?'':$object->note_public; + if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE)) + { + // Get first sale rep + if (is_object($object->thirdparty)) + { + $salereparray=$object->thirdparty->getSalesRepresentatives($user); + $salerepobj=new User($this->db); + $salerepobj->fetch($salereparray[0]['id']); + if (! empty($salerepobj->signature)) $notetoshow=dol_concatdesc($notetoshow, $salerepobj->signature); + } + } + if ($notetoshow) + { + $tab_top = 88; + + $pdf->SetFont('','', $default_font_size - 1); + $pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1); + $nexY = $pdf->GetY(); + $height_note=$nexY-$tab_top; + + // Rect prend une longueur en 3eme param + $pdf->SetDrawColor(192,192,192); + $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); + + $tab_height = $tab_height - $height_note; + $tab_top = $nexY+6; + } + else + { + $height_note=0; + } + + $iniY = $tab_top + 7; + $curY = $tab_top + 7; + $nexY = $tab_top + 7; + + // Loop on each lines + /* + for ($i = 0 ; $i < $nblignes ; $i++) + { + $curY = $nexY; + $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage + $pdf->SetTextColor(0,0,0); + + $pdf->setTopMargin($tab_top_newpage); + $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pageposbefore=$pdf->getPage(); + + // Description of product line + $curX = $this->posxdesc-1; + + $showpricebeforepagebreak=1; + + $pdf->startTransaction(); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc); + $pageposafter=$pdf->getPage(); + if ($pageposafter > $pageposbefore) // There is a pagebreak + { + $pdf->rollbackTransaction(true); + $pageposafter=$pageposbefore; + //print $pageposafter.'-'.$pageposbefore;exit; + $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc); + $pageposafter=$pdf->getPage(); + $posyafter=$pdf->GetY(); + if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text + { + if ($i == ($nblignes-1)) // No more lines, and no space left to show total, so we create a new page + { + $pdf->AddPage('','',true); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + $pdf->setPage($pageposafter+1); + } + } + else + { + // We found a page break + $showpricebeforepagebreak=0; + } + } + else // No pagebreak + { + $pdf->commitTransaction(); + } + + $nexY = $pdf->GetY(); + $pageposafter=$pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + // We suppose that a too long description is moved completely on next page + if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { + $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + } + + $pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut + + // VAT Rate + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) + { + $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxtva, $curY); + $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 3, $vat_rate, 0, 'R'); + } + + // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxup, $curY); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); + + // Quantity + $qty = pdf_getlineqty($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->posxqty, $curY); + // Enough for 6 chars + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxqty-0.8, 4, $qty, 0, 'R'); + } + else + { + $pdf->MultiCell($this->posxdiscount-$this->posxqty-0.8, 4, $qty, 0, 'R'); + } + + // Unit + if($conf->global->PRODUCT_USE_UNITS) + { + $unit = pdf_getlineunit($object, $i, $outputlangs, $hidedetails, $hookmanager); + $pdf->SetXY($this->posxunit, $curY); + $pdf->MultiCell($this->posxdiscount-$this->posxunit-0.8, 4, $unit, 0, 'L'); + } + + // Discount on line + $pdf->SetXY($this->posxdiscount, $curY); + if ($object->lines[$i]->remise_percent) + { + $pdf->SetXY($this->posxdiscount-2, $curY); + $remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails); + $pdf->MultiCell($this->postotalht-$this->posxdiscount+2, 3, $remise_percent, 0, 'R'); + } + + // Total HT line + $total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails); + $pdf->SetXY($this->postotalht, $curY); + $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); + + // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + + $localtax1ligne=$object->lines[$i]->total_localtax1; + $localtax2ligne=$object->lines[$i]->total_localtax2; + $localtax1_rate=$object->lines[$i]->localtax1_tx; + $localtax2_rate=$object->lines[$i]->localtax2_tx; + $localtax1_type=$object->lines[$i]->localtax1_type; + $localtax2_type=$object->lines[$i]->localtax2_type; + + if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; + if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; + if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; + + $vatrate=(string) $object->lines[$i]->tva_tx; + + // Retrieve type from database for backward compatibility with old records + if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined + && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax + { + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); + $localtax1_type = $localtaxtmp_array[0]; + $localtax2_type = $localtaxtmp_array[2]; + } + + // retrieve global local tax + if ($localtax1_type && $localtax1ligne != 0) + $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + if ($localtax2_type && $localtax2ligne != 0) + $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; + if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; + $this->tva[$vatrate] += $tvaligne; + + // Add line + if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) + { + $pdf->setPage($pageposafter); + $pdf->SetLineStyle(array('dash'=>'1,1','color'=>array(80,80,80))); + //$pdf->SetDrawColor(190,190,200); + $pdf->line($this->marge_gauche, $nexY+1, $this->page_largeur - $this->marge_droite, $nexY+1); + $pdf->SetLineStyle(array('dash'=>0)); + } + + $nexY+=2; // Passe espace entre les lignes + + // Detect if some page were added automatically and output _tableau for past pages + while ($pagenb < $pageposafter) + { + $pdf->setPage($pagenb); + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); + } + $this->_pagefoot($pdf,$object,$outputlangs,1); + $pagenb++; + $pdf->setPage($pagenb); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } + if (isset($object->lines[$i+1]->pagebreak) && $object->lines[$i+1]->pagebreak) + { + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); + } + $this->_pagefoot($pdf,$object,$outputlangs,1); + // New page + $pdf->AddPage(); + if (! empty($tplidx)) $pdf->useTemplate($tplidx); + $pagenb++; + if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); + } + } + + // Show square + if ($pagenb == 1) + { + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + else + { + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); + $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; + } + */ + + // Affiche zone infos + //$posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); + + // Affiche zone totaux + //$posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); + + // Pied de page + $this->_pagefoot($pdf,$object,$outputlangs); + if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); + + $pdf->Close(); + + $pdf->Output($file,'F'); + + // Add pdfgeneration hook + $hookmanager->initHooks(array('pdfgeneration')); + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + global $action; + $reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + return 1; // Pas d'erreur + } + else + { + $this->error=$langs->trans("ErrorCanNotCreateDir",$dir); + return 0; + } + } + else + { + $this->error=$langs->trans("ErrorConstantNotDefined","PRODUCT_OUTPUTDIR"); + return 0; + } + } + + + /** + * Show table for lines + * + * @param TCPDF $pdf Object PDF + * @param string $tab_top Top position of table + * @param string $tab_height Height of table (rectangle) + * @param int $nexY Y (not used) + * @param Translate $outputlangs Langs object + * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title + * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code + * @return void + */ + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') + { + global $conf; + + // Force to disable hidetop and hidebottom + $hidebottom=0; + if ($hidetop) $hidetop=-1; + + $currency = !empty($currency) ? $currency : $conf->currency; + $default_font_size = pdf_getPDFFontSize($outputlangs); + + // Amount in (at tab_top - 1) + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('','', $default_font_size - 2); + + if (empty($hidetop)) + { + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); + $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); + $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); + + //$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR='230,230,230'; + if (! empty($conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)) $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_droite-$this->marge_gauche, 5, 'F', null, explode(',',$conf->global->MAIN_PDF_TITLE_BACKGROUND_COLOR)); + } + + $pdf->SetDrawColor(128,128,128); + $pdf->SetFont('','', $default_font_size - 1); + + // Output Rect + $this->printRect($pdf,$this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height, $hidetop, $hidebottom); // Rect prend une longueur en 3eme param et 4eme param + + if (empty($hidetop)) + { + $pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); // line prend une position y en 2eme param et 4eme param + + $pdf->SetXY($this->posxdesc-1, $tab_top+1); + $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); + } + + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) + { + $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxtva-3, $tab_top+1); + $pdf->MultiCell($this->posxup-$this->posxtva+3,2, $outputlangs->transnoentities("VAT"),'','C'); + } + } + + $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxup-1, $tab_top+1); + $pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceUHT"),'','C'); + } + + $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + $pdf->SetXY($this->posxqty-1, $tab_top+1); + if($conf->global->PRODUCT_USE_UNITS) + { + $pdf->MultiCell($this->posxunit-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); + } + else + { + $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); + } + } + + if($conf->global->PRODUCT_USE_UNITS) { + $pdf->line($this->posxunit - 1, $tab_top, $this->posxunit - 1, $tab_top + $tab_height); + if (empty($hidetop)) { + $pdf->SetXY($this->posxunit - 1, $tab_top + 1); + $pdf->MultiCell($this->posxdiscount - $this->posxunit - 1, 2, $outputlangs->transnoentities("Unit"), '', + 'C'); + } + } + + $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); + if (empty($hidetop)) + { + if ($this->atleastonediscount) + { + $pdf->SetXY($this->posxdiscount-1, $tab_top+1); + $pdf->MultiCell($this->postotalht-$this->posxdiscount+1,2, $outputlangs->transnoentities("ReductionShort"),'','C'); + } + } + + if ($this->atleastonediscount) + { + $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); + } + if (empty($hidetop)) + { + $pdf->SetXY($this->postotalht-1, $tab_top+1); + $pdf->MultiCell(30,2, $outputlangs->transnoentities("TotalHT"),'','C'); + } + } + + /** + * Show top header of page. + * + * @param TCPDF $pdf Object PDF + * @param Object $object Object to show + * @param int $showaddress 0=no, 1=yes + * @param Translate $outputlangs Object lang for output + * @param string $titlekey Translation key to show as title of document + * @return void + */ + function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey="") + { + global $conf,$langs,$hookmanager; + + $outputlangs->load("main"); + $outputlangs->load("bills"); + $outputlangs->load("propal"); + $outputlangs->load("companies"); + $outputlangs->load("orders"); + $default_font_size = pdf_getPDFFontSize($outputlangs); + + if ($object->type == 1) $titlekey='ServiceSheet'; + else $titlekey='ProductSheet'; + + pdf_pagehead($pdf,$outputlangs,$this->page_hauteur); + + // Show Draft Watermark + if($object->statut==0 && (! empty($conf->global->COMMANDE_DRAFT_WATERMARK)) ) + { + pdf_watermark($pdf,$outputlangs,$this->page_hauteur,$this->page_largeur,'mm',$conf->global->COMMANDE_DRAFT_WATERMARK); + } + + $pdf->SetTextColor(0,0,60); + $pdf->SetFont('','B', $default_font_size + 3); + + $posy=$this->marge_haute; + $posx=$this->page_largeur-$this->marge_droite-100; + + $pdf->SetXY($this->marge_gauche,$posy); + + // Logo + $logo=$conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; + if ($this->emetteur->logo) + { + if (is_readable($logo)) + { + $height=pdf_getHeightForLogo($logo); + $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) + } + else + { + $pdf->SetTextColor(200,0,0); + $pdf->SetFont('','B', $default_font_size -2); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); + } + } + else + { + $text=$this->emetteur->name; + $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + } + + $pdf->SetFont('','B', $default_font_size + 3); + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $title=$outputlangs->transnoentities($titlekey); + $pdf->MultiCell(100, 3, $title, '', 'R'); + + $pdf->SetFont('','B',$default_font_size); + + $posy+=5; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Ref")." : " . $outputlangs->convToOutputCharset($object->ref), '', 'R'); + + $posy+=1; + $pdf->SetFont('','', $default_font_size - 1); + + /*if ($object->ref_client) + { + $posy+=5; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : " . $outputlangs->convToOutputCharset($object->ref_client), '', 'R'); + }*/ + + /*$posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date,"%d %b %Y",false,$outputlangs,true), '', 'R'); + */ + + // Get contact + /* + if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) + { + $arrayidcontact=$object->getIdContact('internal','SALESREPFOLL'); + if (count($arrayidcontact) > 0) + { + $usertmp=new User($this->db); + $usertmp->fetch($arrayidcontact[0]); + $posy+=4; + $pdf->SetXY($posx,$posy); + $pdf->SetTextColor(0,0,60); + $pdf->MultiCell(100, 3, $langs->trans("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + } + }*/ + + $posy+=2; + + // Show list of linked objects + $posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 100, 3, 'R', $default_font_size); + + if ($showaddress) + { + /* + // Sender properties + $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty); + + // Show sender + $posy=42; + $posx=$this->marge_gauche; + if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=$this->page_largeur-$this->marge_droite-80; + $hautcadre=40; + + // Show sender frame + $pdf->SetTextColor(0,0,0); + $pdf->SetFont('','', $default_font_size - 2); + $pdf->SetXY($posx,$posy-5); + $pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":", 0, 'L'); + $pdf->SetXY($posx,$posy); + $pdf->SetFillColor(230,230,230); + $pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1); + $pdf->SetTextColor(0,0,60); + + // Show sender name + $pdf->SetXY($posx+2,$posy+3); + $pdf->SetFont('','B', $default_font_size); + $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); + $posy=$pdf->getY(); + + // Show sender information + $pdf->SetXY($posx+2,$posy); + $pdf->SetFont('','', $default_font_size - 1); + $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L'); + */ + } + + $pdf->SetTextColor(0,0,0); + } + + /** + * Show footer of page. Need this->emetteur object + * + * @param TCPDF $pdf PDF + * @param Object $object Object to show + * @param Translate $outputlangs Object lang for output + * @param int $hidefreetext 1=Hide free text + * @return int Return height of bottom margin including footer text + */ + function _pagefoot(&$pdf,$object,$outputlangs,$hidefreetext=0) + { + global $conf; + $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; + return pdf_pagefoot($pdf,$outputlangs,'PRODUCT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext); + } + +} + diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index e08ea074bbd..d7138af84a8 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -24,6 +24,43 @@ * \class ModeleProductCode * \brief Parent class for product code generators */ + +/** + * \file htdocs/core/modules/contract/modules_contract.php + * \ingroup contract + * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering + */ + + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +/** + * Parent class to manage intervention document templates + */ +abstract class ModelePDFProduct extends CommonDocGenerator +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + static function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='product'; + $liste=array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $liste=getListOfModels($db,$type,$maxfilenamelength); + return $liste; + } +} + abstract class ModeleProductCode { var $error=''; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 06b188496a5..7d0fe1a41e6 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -186,6 +186,25 @@ class doc_generic_project_odt extends ModelePDFProjects { global $conf; + // adding phone numbers if external + $phone_pro = ''; + $phone_perso = ''; + $phone_mobile = ''; + + $ct = new Contact($this->db); + if ($contact['source']=='external') { + $ct = new Contact($this->db); + $ct->fetch($contact['id']); + $phone_pro = $ct->phone_pro; + $phone_perso = $ct->phone_perso; + $phone_mobile = $ct->phone_mobile; + } elseif ($contact['source']=='internal') { + $ct = new User($this->db); + $ct->fetch($contact['id']); + $phone_pro = $ct->office_phone; + $phone_mobile = $ct->user_mobile; + } + return array( 'projcontacts_id'=>$contact['id'], 'projcontacts_rowid'=>$contact['rowid'], @@ -194,7 +213,10 @@ class doc_generic_project_odt extends ModelePDFProjects 'projcontacts_firstname'=>$contact['firstname'], 'projcontacts_fullcivname'=>$contact['fullname'], 'projcontacts_socname'=>$contact['socname'], - 'projcontacts_email'=>$contact['email'] + 'projcontacts_email'=>$contact['email'], + 'projcontacts_phone_pro'=>$phone_pro, + 'projcontacts_phone_perso'=>$phone_perso, + 'projcontacts_phone_mobile'=>$phone_mobile ); } @@ -712,7 +734,7 @@ class doc_generic_project_odt extends ModelePDFProjects $listtasksfiles = $listlines->__get('tasksfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref).'/'.dol_sanitizeFileName($task->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) @@ -756,7 +778,7 @@ class doc_generic_project_odt extends ModelePDFProjects $listlines = $odfHandler->setSegment('projectfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) { diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 1dba105217d..187018e0031 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -665,7 +665,7 @@ class doc_generic_task_odt extends ModelePDFTask $listtasksfiles = $odfHandler->setSegment('tasksfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($object->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) @@ -707,7 +707,7 @@ class doc_generic_task_odt extends ModelePDFTask $listlines = $odfHandler->setSegment('projectfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); - $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','name',SORT_ASC,1); + $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$','name',SORT_ASC,1); foreach ($filearray as $filedetail) diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 41cd29f8b35..972a75eecc8 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -554,6 +554,7 @@ class pdf_azur extends ModelePDFPropales // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index cc47c9570a6..11ee8a32d7d 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -199,7 +199,7 @@ class pdf_paiement while ($i < $num) { $objp = $this->db->fetch_object($result); - $var=!$var; + $lines[$i][0] = $objp->facnumber; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"day",false,$outputlangs,true); diff --git a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php index 1d9f2333300..f20e912e1ed 100644 --- a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php @@ -197,7 +197,7 @@ class pdf_paiement_fourn while ($i < $num) { $objp = $this->db->fetch_object($result); - $var=!$var; + $lines[$i][0] = $objp->ref; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"day",false,$outputlangs,true); diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index dd29a839a48..1e7e6f4bcad 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -388,8 +388,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices } // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->pu_ht), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); // Unit price before discount $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); @@ -429,7 +430,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; @@ -466,11 +468,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -482,11 +484,11 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -500,12 +502,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -593,8 +595,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(255,255,255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + + $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + $object->remise), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + $object->remise), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -719,8 +723,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); if ($deja_regle > 0) { @@ -757,9 +762,10 @@ class pdf_canelle extends ModelePDFSuppliersInvoices * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -767,6 +773,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -775,7 +782,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 111fe12d9ec..c882ed89800 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -400,8 +400,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Unit price before discount + $up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxup, $curY); - $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, price($object->lines[$i]->subprice), 0, 'R', 0); + $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 3, $up_excl_tax, 0, 'R', 0); // Quantity $pdf->SetXY($this->posxqty, $curY); @@ -436,8 +437,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; - + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -489,11 +491,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->setPage($pagenb); if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); $pagenb++; @@ -505,11 +507,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf,$object,$outputlangs,1); // New page @@ -523,12 +525,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Show square if ($pagenb == 1) { - $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); + $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } else { - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab=$this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -691,8 +693,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (! empty($object->remise)?$object->remise:0)), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248,248,248); @@ -826,8 +829,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFillColor(224,224,224); $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $total_ttc = ($conf->multicurrency->enabled && $object->multiccurency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('','', $default_font_size - 1); $pdf->SetTextColor(0,0,0); @@ -876,9 +880,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -886,6 +891,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -894,7 +900,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); @@ -1073,14 +1079,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! empty($object->date_commande)) { - $posy+=4; + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dol_print_date($object->date_commande,"day",false,$outputlangs,true), '', 'R'); } else { - $posy+=4; + $posy+=5; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(255,0,0); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderToProcess"), '', 'R'); diff --git a/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php b/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php index 83c0d38b0ce..edb37ddcdde 100644 --- a/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php +++ b/htdocs/core/modules/supplier_payment/pdf/pdf_cow.modules.php @@ -530,9 +530,10 @@ class pdf_cow extends ModelePDFSuppliersPayments * @param Translate $outputlangs Langs object * @param int $hidetop Hide top bar of array * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf,$mysoc; @@ -540,6 +541,7 @@ class pdf_cow extends ModelePDFSuppliersPayments $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -550,7 +552,7 @@ class pdf_cow extends ModelePDFSuppliersPayments $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3) - 60, $tab_top-6); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 32c8eb23cbb..3b2812c7b90 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -460,7 +460,9 @@ class pdf_aurore extends ModelePDFSupplierProposal */ // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - $tvaligne=$object->lines[$i]->total_tva; + if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + else $tvaligne=$object->lines[$i]->total_tva; + $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; $localtax1_rate=$object->lines[$i]->localtax1_tx; @@ -560,7 +562,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy=$this->_tableau_info($pdf, $object, $bottomlasttab, $outputlangs); // Affiche zone totaux - $posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); + //$posy=$this->_tableau_tot($pdf, $object, 0, $bottomlasttab, $outputlangs); // Affiche zone versements /* @@ -1089,9 +1091,10 @@ class pdf_aurore extends ModelePDFSupplierProposal * @param Translate $outputlangs Langs object * @param int $hidetop 1=Hide top bar of array and title, 0=Hide nothing, -1=Hide only title * @param int $hidebottom Hide bottom bar of array + * @param string $currency Currency code * @return void */ - function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0) + function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0, $currency='') { global $conf; @@ -1099,6 +1102,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $hidebottom=0; if ($hidetop) $hidetop=-1; + $currency = !empty($currency) ? $currency : $conf->currency; $default_font_size = pdf_getPDFFontSize($outputlangs); // Amount in (at tab_top - 1) @@ -1107,7 +1111,7 @@ class pdf_aurore extends ModelePDFSupplierProposal if (empty($hidetop)) { - $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->currency)); + $titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$currency)); $pdf->SetXY($this->page_largeur - $this->marge_droite - ($pdf->GetStringWidth($titre) + 3), $tab_top-4); $pdf->MultiCell(($pdf->GetStringWidth($titre) + 3), 2, $titre); diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 1e8d2b3a91c..91af81ef178 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -103,8 +103,10 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface */ private function getFilename($suffixinfilename='') { - $tmp=str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, SYSLOG_FILE); - return $suffixinfilename?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp):$tmp; + global $conf; + if (! empty($conf->global->SYSLOG_FILE)) $tmp=str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $conf->global->SYSLOG_FILE); + else $tmp='dolibarr.log'; + return $suffixinfilename?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp):$tmp; } /** @@ -122,12 +124,12 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface $logfile = $this->getFilename($suffixinfilename); - if (defined("SYSLOG_FILE_NO_ERROR")) $filefd = @fopen($logfile, 'a+'); + if (! empty($conf->global->SYSLOG_FILE_NO_ERROR)) $filefd = @fopen($logfile, 'a+'); else $filefd = fopen($logfile, 'a+'); if (! $filefd) { - if (! defined("SYSLOG_FILE_NO_ERROR")) + if (empty($conf->global->SYSLOG_FILE_NO_ERROR)) { // Do not break dolibarr usage if log fails //throw new Exception('Failed to open log file '.basename($logfile)); diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 0f0848f3afd..c2885f1c89a 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -111,13 +111,9 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface if (! empty($conf->global->MAIN_SYSLOG_DISABLE_SYSLOG)) return; // Global option to disable output of this handler - if (defined("SYSLOG_FACILITY") && constant("SYSLOG_FACILITY")) + if (! empty($conf->global->SYSLOG_FACILITY)) { - if (constant(constant('SYSLOG_FACILITY'))) - { - $facility = constant(constant("SYSLOG_FACILITY")); - } - else $facility = LOG_USER; + $facility = constant($conf->global->SYSLOG_FACILITY); } else $facility = LOG_USER; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php new file mode 100644 index 00000000000..b7079dde30e --- /dev/null +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -0,0 +1,433 @@ + + * Copyright (C) 2012 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 +* 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 htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php + * \ingroup societe + * \brief File of class to build ODT documents for third parties + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/user/modules_user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; + + +/** + * Class to build documents using ODF templates generator + */ +class doc_generic_user_odt extends ModelePDFUser +{ + var $emetteur; // Objet societe qui emet + + var $phpmin = array(5,2,0); // Minimum version of PHP required by module + var $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $conf,$langs,$mysoc; + + $langs->load("main"); + $langs->load("companies"); + + $this->db = $db; + $this->name = "ODT templates"; + $this->description = $langs->trans("DocumentModelOdt"); + $this->scandir = 'USER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan + + // Dimension page pour format A4 + $this->type = 'odt'; + $this->page_largeur = 0; + $this->page_hauteur = 0; + $this->format = array($this->page_largeur,$this->page_hauteur); + $this->marge_gauche=0; + $this->marge_droite=0; + $this->marge_haute=0; + $this->marge_basse=0; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva USER_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 0; // Support add of a watermark on drafts + + // Recupere emetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined + } + + + /** + * Return description of a module + * + * @param Translate $langs Lang object to use for output + * @return string Description + */ + function info($langs) + { + global $conf,$langs; + + $langs->load("companies"); + $langs->load("errors"); + + $form = new Form($this->db); + + $texte = $this->description.".
    \n"; + $texte.= '
    '; + $texte.= ''; + $texte.= ''; + $texte.= ''; + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + $texte.= ''; + $texte.= ''; + $texte.= ''; + } + $texte.= ''; + + // List of directories area + $texte.= ''; + + $texte.= ''; + $texte.= ''; + + $texte.= '
    '; + $texttitle=$langs->trans("ListOfDirectories"); + $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USER_ADDON_PDF_ODT_PATH))); + $listoffiles=array(); + foreach($listofdir as $key=>$tmpdir) + { + $tmpdir=trim($tmpdir); + $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); + if (! $tmpdir) { + unset($listofdir[$key]); continue; + } + if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); + else + { + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); + if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); + } + } + $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); + // Add list of substitution keys + $texthelp.='
    '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
    '; + $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + + $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); + $texte.= '
    '; + $texte.= ''; + $texte.= '
    '; + $texte.= ''; + $texte.= '
    '; + + // Scan directories + if (count($listofdir)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + // Model for creation + $liste=ModelePDFUser::liste_modeles($this->db); + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '"; + + $texte.= ''; + $texte.= ''; + $texte.= '"; + $texte.= ''; + + $texte.= ''; + $texte.= '"; + $texte.= '
    '.$langs->trans("DefaultModelPropalCreate").''; + $texte.= $form->selectarray('value2',$liste,$conf->global->USER_ADDON_PDF_ODT_DEFAULT); + $texte.= "
    '.$langs->trans("DefaultModelPropalToBill").''; + $texte.= $form->selectarray('value3',$liste,$conf->global->USER_ADDON_PDF_ODT_TOBILL); + $texte.= "
    '.$langs->trans("DefaultModelPropalClosed").''; + $texte.= $form->selectarray('value4',$liste,$conf->global->USER_ADDON_PDF_ODT_CLOSED); + $texte.= "
    '; + } + } + + $texte.= '
    '; + $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte.= '
    '; + $texte.= '
    '; + + return $texte; + } + + /** + * Function to build a document on disk using the generic odt module. + * + * @param User $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1 if OK, <=0 if KO + */ + function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) + { + global $user,$langs,$conf,$mysoc,$hookmanager; + + if (empty($srctemplatepath)) + { + dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); + return -1; + } + + // Add odtgeneration hook + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + + if (! is_object($outputlangs)) $outputlangs=$langs; + $sav_charset_output=$outputlangs->charset_output; + $outputlangs->charset_output='UTF-8'; + + $outputlangs->load("main"); + $outputlangs->load("dict"); + $outputlangs->load("companies"); + $outputlangs->load("bills"); + + if ($conf->user->dir_output) + { + // If $object is id instead of object + if (! is_object($object)) + { + $id = $object; + $object = new User($this->db); + $result=$object->fetch($id); + if ($result < 0) + { + dol_print_error($this->db,$object->error); + return -1; + } + } + + $dir = $conf->user->dir_output; + $objectref = dol_sanitizeFileName($object->ref); + if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; + $file = $dir . "/" . $objectref . ".odt"; + + if (! file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + if (file_exists($dir)) + { + //print "srctemplatepath=".$srctemplatepath; // Src filename + $newfile=basename($srctemplatepath); + $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); + $newfiletmp=preg_replace('/template_/i','',$newfiletmp); + $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); + + $newfiletmp=$objectref.'_'.$newfiletmp; + + // Get extension (ods or odt) + $newfileformat=substr($newfile, strrpos($newfile, '.')+1); + if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) + { + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; + } + else + { + $filename=$newfiletmp.'.'.$newfileformat; + } + $file=$dir.'/'.$filename; + //print "newdir=".$dir; + //print "newfile=".$newfile; + //print "file=".$file; + //print "conf->user->dir_temp=".$conf->user->dir_temp; + + dol_mkdir($conf->user->dir_temp); + + + // If CUSTOMER contact defined on user, we use it + $usecontact=false; + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); + if (count($arrayidcontact) > 0) + { + $usecontact=true; + $result=$object->fetch_contact($arrayidcontact[0]); + } + + // Recipient name + if (! empty($usecontact)) + { + // On peut utiliser le nom de la societe du contact + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; + else { + $socobject = $object->client; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } + } + else + { + $socobject=$object->client; + } + + // Open and load template + require_once ODTPHP_PATH.'odf.php'; + try { + $odfHandler = new odf( + $srctemplatepath, + array( + 'PATH_TO_TMP' => $conf->user->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' + ) + ); + } + catch(Exception $e) + { + $this->error=$e->getMessage(); + return -1; + } + + // Make substitutions into odt + $array_user=$this->get_substitutionarray_user($object,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in user as contact_xxx tags + $array_thirdparty_contact = array(); + if ($usecontact) + $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); + + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_other,$array_thirdparty_contact); + complete_substitutions_array($tmparray, $outputlangs, $object); + $object->fetch_optionals(); + // Call the ODTSubstitution hook + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); + $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + foreach($tmparray as $key=>$value) + { + try { + if (preg_match('/logo$/',$key)) // Image + { + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } + else // Text + { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } + catch(OdfException $e) + { + } + } + + // Replace labels translated + $tmparray=$outputlangs->get_translations_for_substitutions(); + foreach($tmparray as $key=>$value) + { + try { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + } + + // Call the beforeODTSave hook + $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + // Write new file + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { + try { + $odfHandler->exportAsAttachedPDF($file); + }catch (Exception $e){ + $this->error=$e->getMessage(); + return -1; + } + } + else { + try { + $odfHandler->saveToDisk($file); + }catch (Exception $e){ + $this->error=$e->getMessage(); + return -1; + } + } + + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $odfHandler=null; // Destroy object + + return 1; // Success + } + else + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + return -1; + } + + function get_substitutionarray_object($object,$outputlangs) { + foreach($object as $key => $value) { + if(!is_array($value) && !is_object($value)) { + $array_other['object_'.$key] = $value; + } + } + return $array_other; + } + +} + diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php new file mode 100644 index 00000000000..3e94ece9372 --- /dev/null +++ b/htdocs/core/modules/user/modules_user.class.php @@ -0,0 +1,62 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * + * 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/ + */ + + +/** + * \class ModeleProductCode + * \brief Parent class for product code generators + */ + +/** + * \file htdocs/core/modules/contract/modules_contract.php + * \ingroup contract + * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering + */ + + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +/** + * Parent class to manage intervention document templates + */ +abstract class ModelePDFUser extends CommonDocGenerator +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + static function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='user'; + $liste=array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $liste=getListOfModels($db,$type,$maxfilenamelength); + return $liste; + } +} \ No newline at end of file diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php new file mode 100644 index 00000000000..35367052796 --- /dev/null +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -0,0 +1,501 @@ + + * Copyright (C) 2012 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 +* 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 htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php + * \ingroup societe + * \brief File of class to build ODT documents for third parties + */ + +require_once DOL_DOCUMENT_ROOT.'/core/modules/usergroup/modules_usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; + + +/** + * Class to build documents using ODF templates generator + */ +class doc_generic_usergroup_odt extends ModelePDFUserGroup +{ + var $emetteur; // Objet societe qui emet + + var $phpmin = array(5,2,0); // Minimum version of PHP required by module + var $version = 'dolibarr'; + + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + global $conf,$langs,$mysoc; + + $langs->load("main"); + $langs->load("companies"); + + $this->db = $db; + $this->name = "ODT templates"; + $this->description = $langs->trans("DocumentModelOdt"); + $this->scandir = 'USERGROUP_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan + + // Dimension page pour format A4 + $this->type = 'odt'; + $this->page_largeur = 0; + $this->page_hauteur = 0; + $this->format = array($this->page_largeur,$this->page_hauteur); + $this->marge_gauche=0; + $this->marge_droite=0; + $this->marge_haute=0; + $this->marge_basse=0; + + $this->option_logo = 1; // Affiche logo + $this->option_tva = 0; // Gere option tva USERGROUP_TVAOPTION + $this->option_modereg = 0; // Affiche mode reglement + $this->option_condreg = 0; // Affiche conditions reglement + $this->option_codeproduitservice = 0; // Affiche code produit-service + $this->option_multilang = 1; // Dispo en plusieurs langues + $this->option_escompte = 0; // Affiche si il y a eu escompte + $this->option_credit_note = 0; // Support credit notes + $this->option_freetext = 1; // Support add of a personalised text + $this->option_draft_watermark = 0; // Support add of a watermark on drafts + + // Recupere emetteur + $this->emetteur=$mysoc; + if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined + } + + + /** + * Return description of a module + * + * @param Translate $langs Lang object to use for output + * @return string Description + */ + function info($langs) + { + global $conf,$langs; + + $langs->load("companies"); + $langs->load("errors"); + + $form = new Form($this->db); + + $texte = $this->description.".
    \n"; + $texte.= '
    '; + $texte.= ''; + $texte.= ''; + $texte.= ''; + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + $texte.= ''; + $texte.= ''; + $texte.= ''; + } + $texte.= ''; + + // List of directories area + $texte.= ''; + + $texte.= ''; + $texte.= ''; + + $texte.= '
    '; + $texttitle=$langs->trans("ListOfDirectories"); + $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH))); + $listoffiles=array(); + foreach($listofdir as $key=>$tmpdir) + { + $tmpdir=trim($tmpdir); + $tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir); + if (! $tmpdir) { + unset($listofdir[$key]); continue; + } + if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); + else + { + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); + if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); + } + } + $texthelp=$langs->trans("ListOfDirectoriesForModelGenODT"); + // Add list of substitution keys + $texthelp.='
    '.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'
    '; + $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it + + $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); + $texte.= '
    '; + $texte.= ''; + $texte.= '
    '; + $texte.= ''; + $texte.= '
    '; + + // Scan directories + if (count($listofdir)) + { + $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; + + if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) + { + // Model for creation + $liste=ModelePDFUserGroup::liste_modeles($this->db); + $texte.= ''; + $texte.= ''; + $texte.= ''; + $texte.= '"; + + $texte.= ''; + $texte.= ''; + $texte.= '"; + $texte.= ''; + + $texte.= ''; + $texte.= '"; + $texte.= '
    '.$langs->trans("DefaultModelPropalCreate").''; + $texte.= $form->selectarray('value2',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT); + $texte.= "
    '.$langs->trans("DefaultModelPropalToBill").''; + $texte.= $form->selectarray('value3',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL); + $texte.= "
    '.$langs->trans("DefaultModelPropalClosed").''; + $texte.= $form->selectarray('value4',$liste,$conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED); + $texte.= "
    '; + } + } + + $texte.= '
    '; + $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); + $texte.= '
    '; + $texte.= '
    '; + + return $texte; + } + + /** + * Function to build a document on disk using the generic odt module. + * + * @param UserGroup $object Object source to build document + * @param Translate $outputlangs Lang output object + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return int 1 if OK, <=0 if KO + */ + function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) + { + global $user,$langs,$conf,$mysoc,$hookmanager; + + if (empty($srctemplatepath)) + { + dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING); + return -1; + } + + // Add odtgeneration hook + if (! is_object($hookmanager)) + { + include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + $hookmanager=new HookManager($this->db); + } + $hookmanager->initHooks(array('odtgeneration')); + global $action; + + if (! is_object($outputlangs)) $outputlangs=$langs; + $sav_charset_output=$outputlangs->charset_output; + $outputlangs->charset_output='UTF-8'; + + $outputlangs->load("main"); + $outputlangs->load("dict"); + $outputlangs->load("companies"); + $outputlangs->load("bills"); + + if ($conf->user->dir_output) + { + // If $object is id instead of object + if (! is_object($object)) + { + $id = $object; + $object = new UserGroup($this->db); + $result=$object->fetch($id); + if ($result < 0) + { + dol_print_error($this->db,$object->error); + return -1; + } + } + + $dir = $conf->usergroup->dir_output; + $objectref = dol_sanitizeFileName($object->ref); + if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref; + $file = $dir . "/" . $objectref . ".odt"; + + if (! file_exists($dir)) + { + if (dol_mkdir($dir) < 0) + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + if (file_exists($dir)) + { + //print "srctemplatepath=".$srctemplatepath; // Src filename + $newfile=basename($srctemplatepath); + $newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile); + $newfiletmp=preg_replace('/template_/i','',$newfiletmp); + $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); + + $newfiletmp=$objectref.'_'.$newfiletmp; + + // Get extension (ods or odt) + $newfileformat=substr($newfile, strrpos($newfile, '.')+1); + if ( ! empty($conf->global->MAIN_DOC_USE_TIMING)) + { + $format=$conf->global->MAIN_DOC_USE_TIMING; + if ($format == '1') $format='%Y%m%d%H%M%S'; + $filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat; + } + else + { + $filename=$newfiletmp.'.'.$newfileformat; + } + $file=$dir.'/'.$filename; + //print "newdir=".$dir; + //print "newfile=".$newfile; + //print "file=".$file; + //print "conf->user->dir_temp=".$conf->user->dir_temp; + + dol_mkdir($conf->user->dir_temp); + + + // If CUSTOMER contact defined on user, we use it + $usecontact=false; + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); + if (count($arrayidcontact) > 0) + { + $usecontact=true; + $result=$object->fetch_contact($arrayidcontact[0]); + } + + // Recipient name + if (! empty($usecontact)) + { + // On peut utiliser le nom de la societe du contact + if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; + else { + $socobject = $object->client; + // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use + $contactobject = $object->contact; + } + } + else + { + $socobject=$object->client; + } + // Make substitution + $substitutionarray=array( + '__FROM_NAME__' => $this->emetteur->name, + '__FROM_EMAIL__' => $this->emetteur->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_vat + ); + complete_substitutions_array($substitutionarray, $langs, $object); + // Call the ODTSubstitution hook + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray); + $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + // Line of free text + $newfreetext=''; + $paramfreetext='user_FREE_TEXT'; + if (! empty($conf->global->$paramfreetext)) + { + $newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray); + } + + // Open and load template + require_once ODTPHP_PATH.'odf.php'; + try { + $odfHandler = new odf( + $srctemplatepath, + array( + 'PATH_TO_TMP' => $conf->user->dir_temp, + 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. + 'DELIMITER_LEFT' => '{', + 'DELIMITER_RIGHT' => '}' + ) + ); + } + catch(Exception $e) + { + $this->error=$e->getMessage(); + return -1; + } + // After construction $odfHandler->contentXml contains content and + // [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by + // [!-- BEGIN lines --]*[!-- END lines --] + //print html_entity_decode($odfHandler->__toString()); + //print exit; + + + // Make substitutions into odt of freetext + try { + $odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + + // Make substitutions into odt + $array_user=$this->get_substitutionarray_user($user,$outputlangs); + $array_global=$this->get_substitutionarray_each_var_object($object,$outputlangs); + $array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs); + $array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs); + $array_objet=$this->get_substitutionarray_each_var_object($object,$outputlangs); + $array_other=$this->get_substitutionarray_other($outputlangs); + // retrieve contact information for use in user as contact_xxx tags + $array_thirdparty_contact = array(); + if ($usecontact) + $array_thirdparty_contact=$this->get_substitutionarray_contact($contactobject,$outputlangs,'contact'); + + $tmparray = array_merge($array_global,$array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact); + complete_substitutions_array($tmparray, $outputlangs, $object); + $object->fetch_optionals(); + // Call the ODTSubstitution hook + $parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray); + $reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + foreach($tmparray as $key=>$value) + { + try + { + if (preg_match('/logo$/',$key)) // Image + { + if (file_exists($value)) $odfHandler->setImage($key, $value); + else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); + } + else // Text + { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + } + catch(OdfException $e) + { + } + } + // Replace tags of lines + try + { + $listlines = $odfHandler->setSegment('lines'); + foreach ($object->members as $u) + { + $tmparray=$this->get_substitutionarray_each_var_object($u,$outputlangs); + unset($tmparray['object_pass']); + unset($tmparray['object_pass_indatabase']); + complete_substitutions_array($tmparray, $outputlangs, $object, $user, "completesubstitutionarray_users"); + // Call the ODTSubstitutionLine hook + $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$u); + $reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + foreach($tmparray as $key => $val) + { + try + { + if(!is_array($val)) { + $listlines->setVars($key, $val, true, 'UTF-8'); + } + } + catch(OdfException $e) + { + } + catch(SegmentException $e) + { + } + } + $listlines->merge(); + } + $odfHandler->mergeSegment($listlines); + } + catch(OdfException $e) + { + $this->error=$e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + return -1; + } + + // Replace labels translated + $tmparray=$outputlangs->get_translations_for_substitutions(); + foreach($tmparray as $key=>$value) + { + try { + $odfHandler->setVars($key, $value, true, 'UTF-8'); + } + catch(OdfException $e) + { + } + } + + // Call the beforeODTSave hook + $parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs); + $reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + // Write new file + if (!empty($conf->global->MAIN_ODT_AS_PDF)) { + try { + $odfHandler->exportAsAttachedPDF($file); + }catch (Exception $e){ + $this->error=$e->getMessage(); + return -1; + } + } + else { + try { + $odfHandler->saveToDisk($file); + }catch (Exception $e){ + $this->error=$e->getMessage(); + return -1; + } + } + + $reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); + + $odfHandler=null; // Destroy object + + return 1; // Success + } + else + { + $this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir); + return -1; + } + } + + return -1; + } + +} + diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php new file mode 100644 index 00000000000..26edb08d57c --- /dev/null +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -0,0 +1,62 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2012 Regis Houssin + * + * 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/ + */ + + +/** + * \class ModeleProductCode + * \brief Parent class for product code generators + */ + +/** + * \file htdocs/core/modules/contract/modules_contract.php + * \ingroup contract + * \brief File with parent class for generating contracts to PDF and File of class to manage contract numbering + */ + + require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; + +/** + * Parent class to manage intervention document templates + */ +abstract class ModelePDFUserGroup extends CommonDocGenerator +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param integer $maxfilenamelength Max length of value to show + * @return array List of templates + */ + static function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='group'; + $liste=array(); + + include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + $liste=getListOfModels($db,$type,$maxfilenamelength); + return $liste; + } +} \ No newline at end of file diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 8fcd0d2b930..5b29d25202e 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -59,6 +59,18 @@ elseif ($modulepart == 'holiday') if (! $user->rights->holiday->read) accessforbidden(); $accessallowed=1; } +elseif ($modulepart == 'expensereport') +{ + $result=restrictedArea($user,'expensereport',$id,'expensereport'); + if (! $user->rights->expensereport->lire) accessforbidden(); + $accessallowed=1; +} +elseif ($modulepart == 'user') +{ + $result=restrictedArea($user,'user',$id,'user'); + if (! $user->rights->user->user->lire) accessforbidden(); + $accessallowed=1; +} // Security: // Limit access if permissions are wrong @@ -103,12 +115,36 @@ elseif ($modulepart == 'holiday') $dir=$conf->holiday->dir_output; // By default } } +elseif ($modulepart == 'user') +{ + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $object = new User($db); + if ($id > 0) + { + $result = $object->fetch($id); + if ($result <= 0) dol_print_error($db,'Failed to load object'); + $dir=$conf->user->dir_output; // By default + } +} +elseif ($modulepart == 'expensereport') +{ + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $object = new ExpenseReport($db); + if ($id > 0) + { + $result = $object->fetch($id); + if ($result <= 0) dol_print_error($db,'Failed to load object'); + $dir=$conf->expensereport->dir_output; // By default + } +} if (empty($backtourl)) { if (in_array($modulepart, array('product','produit','service','produit|service'))) $backtourl=DOL_URL_ROOT."/product/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + else if (in_array($modulepart, array('expensereport'))) $backtourl=DOL_URL_ROOT."/expensereport/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('holiday'))) $backtourl=DOL_URL_ROOT."/holiday/document.php?id=".$id.'&file='.urldecode($_POST["file"]); else if (in_array($modulepart, array('project'))) $backtourl=DOL_URL_ROOT."/projet/document.php?id=".$id.'&file='.urldecode($_POST["file"]); + else if (in_array($modulepart, array('user'))) $backtourl=DOL_URL_ROOT."/user/document.php?id=".$id.'&file='.urldecode($_POST["file"]); } @@ -185,7 +221,7 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS } else { - dol_print_error('', 'Cancel on photo_resize with a not supported value of modulepart='.$modulepart); + dol_print_error('', 'confirm_resize on photo_resize without backtourl defined for modulepart='.$modulepart); exit; } } @@ -253,7 +289,7 @@ if ($action == 'confirm_crop') } else { - dol_print_error('', 'Cancel on photo_resize with a not supported value of modulepart='.$modulepart); + dol_print_error('', 'confirm_crop on photo_resize without backtourl defined for modulepart='.$modulepart); exit; } } @@ -294,8 +330,8 @@ print '
    '; print ''.$langs->trans("Resize").''; print $langs->trans("ResizeDesc").'
    '; -print $langs->trans("NewLength").': px   '.$langs->trans("or").'   '; -print $langs->trans("NewHeight").': px  
    '; +print $langs->trans("NewLength").': px   '.$langs->trans("or").'   '; +print $langs->trans("NewHeight").': px  
    '; print ''; print ''; @@ -323,11 +359,12 @@ if (! empty($conf->use_javascript_ajax)) $height=$infoarray['height']; $width=$infoarray['width']; $widthforcrop=$width; $refsizeforcrop='orig'; $ratioforcrop=1; + // If image is too large, we use another scale. if (! empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth']/2))) { - $widthforcrop=min(round($_SESSION['dol_screenwidth']/2),$widthforcrop); + $widthforcrop=round($_SESSION['dol_screenwidth']/2); $refsizeforcrop='screenwidth'; - $ratioforcrop=2; + $ratioforcrop=1; } print ''."\n"; @@ -342,12 +379,12 @@ if (! empty($conf->use_javascript_ajax)) print '
    '.$langs->trans("NewSizeAfterCropping").': - - - - - - + + + + + +
    @@ -370,6 +407,7 @@ if (! empty($conf->use_javascript_ajax)) print ' -
    +
    global->MAIN_EASTER_EGG_COMMITSTRIP)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + if (substr($langs->defaultlang,0,2)=='fr') { + $resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/"); + } else { + $resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/"); + } + if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') + { + $xml = simplexml_load_string($resgetcommitstrip['content']); + $little = $xml->channel->item[0]->children('content',true); + print $little->encoded; + } +} + ?> element,array('propal', 'supplier_proposal','facture','fac $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); if ($nolinesbefore) { ?> -
    global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> +
    trans('AddNewLine'); ?>trans("FreeZone"); ?>
    + - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> + - "> + "> - "> + "> "> + "> remise_percent); ?>">%remise_percent); ?>">% %% %%%%' . $form->load_tva('tva_tx', $line->tva_tx.($line->vat_src_code?(' ('.$line->vat_src_code.')'):''), $seller, $buyer, 0, $line->info_bits, $line->product_type, false, 1) . '%%situation_counter > 1) print ' readonly'; print '>situation_counter > 1) print ' readonly'; print '> info_bits & 2) != 2) { - print 'situation_counter > 1) print ' readonly'; print '>%'; } else { ?> @@ -170,7 +170,7 @@ $coldisplay=-1; // We remove first td situation_cycle_ref) { $coldisplay++; - print '%% product->enabled) || ! empty($conf->service->enabled)) { ?> - + - + '.$margin_rate.'%%%'.$mark_rate.'%%%
    trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> + trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); echo $form->select_date($line->date_start,'date_start',$hourmin,$hourmin,$line->date_start?0:1,"updateligne",1,0,1); diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index e928f8d64fc..c347c693691 100755 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -54,7 +54,7 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0; 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..8a403d675d7 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"; @@ -1370,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)) @@ -1390,13 +1399,14 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $logouttext=''; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $logouthtmltext=$appli.'
    '; + //$logouthtmltext=$appli.'
    '; if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { $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 @@ -1420,6 +1430,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a $toprightmenu.=''; $toprightmenu.='
    '.$langs->trans("MARGIN_TYPE").''; print ' '; print ''; // DISPLAY MARGIN RATES -$var=!$var; -print '
    '.$langs->trans("DisplayMarginRates").''; if (! empty($conf->use_javascript_ajax)) @@ -189,8 +189,8 @@ print ''.$langs->trans('MarginRate').' = '.$langs->trans('Margin').' / '.$la print '
    '.$langs->trans("DisplayMarkRates").''; if (! empty($conf->use_javascript_ajax)) @@ -212,8 +212,8 @@ print ''.$langs->trans('MarkRate').' = '.$langs->trans('Margin').' / '.$langs->trans('SellingPrice').'
    '.$langs->trans("ForceBuyingPriceIfNull").''; if (! empty($conf->use_javascript_ajax)) @@ -242,11 +242,11 @@ $methods = array( 3 => $langs->trans('UseDiscountOnTotal') ); -$var=!$var; + print '
    '; print ''; print ""; -print '
    '.$langs->trans("MARGIN_METHODE_FOR_DISCOUNT").''; print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, $conf->global->MARGIN_METHODE_FOR_DISCOUNT); @@ -259,11 +259,11 @@ print '
    '.$langs->trans("AgentContactType").''; $formcompany = new FormCompany($db); diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index c7a0af0b605..846daad7806 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -220,9 +220,9 @@ if ($result) $markRate = ($pv != 0)?(100 * $marge / $pv):'' ; } - $var=!$var; + - print "
    '; $invoicestatic->id=$objp->facid; @@ -295,7 +295,7 @@ if ($result) } // affichage totaux marges - $var=!$var; + $totalMargin = $cumul_vente - $cumul_achat; /*if ($totalMargin < 0) { diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index ff06d6ce69e..efcb35b802f 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -259,9 +259,9 @@ if ($result) $markRate = ($pv != 0)?(100 * $marge / $pv):'' ; } - $var=!$var; + - print "
    '; $invoicestatic->id=$objp->facid; @@ -307,7 +307,7 @@ if ($result) } // affichage totaux marges - $var=!$var; + $totalMargin = $cumul_vente - $cumul_achat; $marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):''; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 7550b672007..b1023839eca 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -93,7 +93,7 @@ if ($id > 0 || ! empty($ref)) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); - dol_fiche_head($head, 'margin', $titre, 0, $picto); + dol_fiche_head($head, 'margin', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; @@ -196,12 +196,12 @@ if ($id > 0 || ! empty($ref)) $var=True; while ($i < $num /*&& $i < $conf->liste_limit*/) { $objp = $db->fetch_object($result); - $var=!$var; + $marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ; $markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ; - print '
    '; $invoicestatic->id=$objp->facid; $invoicestatic->ref=$objp->facnumber; @@ -229,7 +229,7 @@ if ($id > 0 || ! empty($ref)) } // affichage totaux marges - $var=!$var; + $totalMargin = $cumul_vente - $cumul_achat; if ($totalMargin < 0) { diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index df472489c36..45ce972bbc3 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -89,7 +89,7 @@ if ($socid > 0) $head = societe_prepare_head($object); - dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; @@ -206,9 +206,9 @@ if ($socid > 0) $marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ; $markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ; - $var=!$var; + - print "
    '; $invoicestatic->id=$objp->facid; $invoicestatic->ref=$objp->facnumber; @@ -232,7 +232,7 @@ if ($socid > 0) } // affichage totaux marges - $var=!$var; + $totalMargin = $cumul_vente - $cumul_achat; if ($totalMargin < 0) { diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 80fc5d9a1d4..ebb99eb9807 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -114,7 +114,7 @@ if (! defined('NOREQUIRESOC')) require_once DOL_DOCUMENT_ROOT .'/societe/class/ */ if (! defined('NOREQUIRETRAN')) { - $langs = new Translate('',$conf); // A mettre apres lecture de la conf + $langs = new Translate('',$conf); // Must be after reading conf } /* @@ -180,7 +180,7 @@ if (! defined('NOREQUIREDB')) //print "Will work with data into entity instance number '".$conf->entity."'"; - // Here we read database (llx_const table) and define $conf->global->XXX var. + // Here we read database (llx_const table and llx_default_values) and define $conf->global->XXX var. $conf->setValues($db); } @@ -258,7 +258,3 @@ $hookmanager=new HookManager($db); if (! defined('MAIN_LABEL_MENTION_NPR') ) define('MAIN_LABEL_MENTION_NPR','NPR'); - -// We force FPDF -if (! empty($dolibarr_pdf_force_fpdf)) $conf->global->MAIN_USE_FPDF=$dolibarr_pdf_force_fpdf; - diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php new file mode 100644 index 00000000000..182268a5f06 --- /dev/null +++ b/htdocs/modulebuilder/index.php @@ -0,0 +1,91 @@ + + * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2005-2010 Regis Houssin + * + * 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/modulebuilder/index.php + * \brief Home page for module builder module + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + +$langs->load("admin"); +$langs->load("modulebuilder"); +$langs->load("other"); + +// Security check +if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed'); + + + +/* + * View + */ + +$socstatic=new Societe($db); + + +llxHeader("",$langs->trans("ModuleBuilder"),""); + + +$text=$langs->trans("ModuleBuilder"); + +print load_fiche_titre($text, '', 'title_setup'); + +$tmp=explode(',', $dolibarr_main_document_root_alt); +$dircustom = $tmp[0]; + +// Show description of content +print $langs->trans("ModuleBuilderDesc", $dircustom).'

    '; + + + +/* +if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // Entry for Module builder +{ + global $dolibarr_main_document_root_alt; + if (! empty($dolibarr_main_document_root_alt) && is_array($dolibarr_main_document_root_alt)) + { + foreach ($dolibarr_main_document_root_alt as $diralt) + {*/ + $dirsincustom=dol_dir_list($dircustom); + + if (is_array($dirsincustom) && count($dirsincustom) > 0) + { + foreach ($dirsincustom as $dircustom) + { + $fullname = $dircustom['fullname']; + if (dol_is_file($fullname.'/modulebuilder.txt')) + { + print '
    '.$module.'
    '; + } + } + } +/* } + } + else + { + $newmenu->add('', 'NoGeneratedModuleFound', 0, 0); + }*/ + + + +llxFooter(); + +$db->close(); diff --git a/dev/skeletons/.gitignore b/htdocs/modulebuilder/skeletons/.gitignore similarity index 100% rename from dev/skeletons/.gitignore rename to htdocs/modulebuilder/skeletons/.gitignore diff --git a/dev/skeletons/README b/htdocs/modulebuilder/skeletons/README similarity index 100% rename from dev/skeletons/README rename to htdocs/modulebuilder/skeletons/README diff --git a/dev/skeletons/build_api_class.php b/htdocs/modulebuilder/skeletons/build_api_class.php similarity index 100% rename from dev/skeletons/build_api_class.php rename to htdocs/modulebuilder/skeletons/build_api_class.php diff --git a/dev/skeletons/build_class_from_table.php b/htdocs/modulebuilder/skeletons/build_class_from_table.php similarity index 100% rename from dev/skeletons/build_class_from_table.php rename to htdocs/modulebuilder/skeletons/build_class_from_table.php diff --git a/dev/skeletons/build_webservice_from_class.php b/htdocs/modulebuilder/skeletons/build_webservice_from_class.php similarity index 100% rename from dev/skeletons/build_webservice_from_class.php rename to htdocs/modulebuilder/skeletons/build_webservice_from_class.php diff --git a/dev/skeletons/modMyModule.class.php b/htdocs/modulebuilder/skeletons/modMyModule.class.php similarity index 100% rename from dev/skeletons/modMyModule.class.php rename to htdocs/modulebuilder/skeletons/modMyModule.class.php diff --git a/dev/skeletons/skeleton_api_class.class.php b/htdocs/modulebuilder/skeletons/skeleton_api_class.class.php similarity index 100% rename from dev/skeletons/skeleton_api_class.class.php rename to htdocs/modulebuilder/skeletons/skeleton_api_class.class.php diff --git a/dev/skeletons/skeleton_card.php b/htdocs/modulebuilder/skeletons/skeleton_card.php similarity index 100% rename from dev/skeletons/skeleton_card.php rename to htdocs/modulebuilder/skeletons/skeleton_card.php diff --git a/dev/skeletons/skeleton_class.class.php b/htdocs/modulebuilder/skeletons/skeleton_class.class.php similarity index 100% rename from dev/skeletons/skeleton_class.class.php rename to htdocs/modulebuilder/skeletons/skeleton_class.class.php diff --git a/dev/skeletons/skeleton_list.php b/htdocs/modulebuilder/skeletons/skeleton_list.php similarity index 96% rename from dev/skeletons/skeleton_list.php rename to htdocs/modulebuilder/skeletons/skeleton_list.php index 77485c6d638..c7b728617ea 100644 --- a/dev/skeletons/skeleton_list.php +++ b/htdocs/modulebuilder/skeletons/skeleton_list.php @@ -109,12 +109,12 @@ if (empty($user->socid)) $fieldstosearchall["t.note_private"]="NotePrivate"; // Definition of fields for list $arrayfields=array( - 't.field1'=>array('label'=>$langs->trans("Field1"), 'checked'=>1), - 't.field2'=>array('label'=>$langs->trans("Field2"), 'checked'=>1), - //'t.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), - 't.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), - 't.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 't.field1'=>array('label'=>"Field1", 'checked'=>1), + 't.field2'=>array('label'=>"Field2", 'checked'=>1), + //'t.entity'=>array('label'=>"Entity", 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->multicompany->transverse_mode))), + 't.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), + 't.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + //'t.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -354,7 +354,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); } } } @@ -365,7 +365,7 @@ print $hookmanager->resPrint; if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$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"; -print ''; -print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.id_sondage",$param,"","",$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Title"), $_SERVER["PHP_SELF"], "p.titre",$param,"","",$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Type")); -print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser,$param,"","",$sortfield,$sortorder); -print_liste_field_titre($langs->trans("NbOfVoters")); -print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin",$param,"",'align="center"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.status",$param,"",'align="center"',$sortfield,$sortorder); -print_liste_field_titre(''); -print ''."\n"; - -print ''; -print ''; +print ''; +print ''; print ''; print ''; print ''; @@ -119,6 +110,17 @@ print $searchpitco; print ''; print ''."\n"; +print ''; +print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.id_sondage", $param,"","",$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Title"), $_SERVER["PHP_SELF"], "p.titre", $param,"","",$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Type")); +print_liste_field_titre($langs->trans("Author"), $_SERVER["PHP_SELF"], "u.".$fieldtosortuser, $param,"","",$sortfield,$sortorder); +print_liste_field_titre($langs->trans("NbOfVoters"), $_SERVER["PHP_SELF"], "", $param,"",'align="right"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("ExpireDate"), $_SERVER["PHP_SELF"], "p.date_fin", $param,"",'align="center"',$sortfield,$sortorder); +print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.status", $param,"",'align="center"',$sortfield,$sortorder); +print_liste_field_titre(''); +print ''."\n"; + $sql = "SELECT p.id_sondage, p.fk_user_creat, p.format, p.date_fin, p.status, p.titre, p.nom_admin,"; $sql.= " u.login, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."opensurvey_sondage as p"; @@ -133,9 +135,20 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql.= " WHERE p.entity = ".getEntity('survey',1); if ($status == 'expired') $sql.=" AND date_fin < '".$db->idate($now)."'"; if ($status == 'opened') $sql.=" AND date_fin >= '".$db->idate($now)."'"; -if ($surveytitle) $sql.=" AND titre LIKE '%".$db->escape($surveytitle)."%'"; +if ($search_ref) $sql.=natural_search("p.id_sondage", $search_ref); +if ($surveytitle) $sql.=natural_search("p.titre", $surveytitle); + $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($conf->liste_limit+1, $offset); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1,$offset); $resql=$db->query($sql); if (! $resql) dol_print_error($db); @@ -159,8 +172,7 @@ while ($i < min($num,$limit)) $opensurvey_static->id=$obj->id_sondage; $opensurvey_static->status=$obj->status; - $var=!$var; - print ''; + print ''; print ''; - print''."\n"; + print''."\n"; print ''; print ''; print "\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; print "\n"; /* -$var=!$var; -print ''; */ /* -$var=!$var; -print ''; */ -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; print ''; print "\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; @@ -167,55 +167,55 @@ print ''; print ''; print "\n"; -$var=!$var; -print ''; -/*$var=!$var; -print ''; */ -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; -$var=!$var; -print ''; print ''; print "\n"; -$var=!$var; -print ''; -$var=!$var; -print ''; diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 1496bb3552e..4c1cb588f1f 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -209,7 +209,8 @@ function showPaypalPaymentUrl($type,$ref) $out='

    '; $out.=img_picto('','object_globe.png').' '.$langs->trans("ToOfferALinkForOnlinePayment",$servicename).'
    '; $url=getPaypalPaymentUrl(0,$type,$ref); - $out.='
    '; + $out.=''; + $out.=ajax_autoselect("paypalurl", 0); return $out; } diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 8d9609459ed..23a958211b2 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -147,11 +147,11 @@ if ($mode == 'setup' && $user->admin) $submit_enabled=0; foreach ($printer->conf as $key) { - $var=!$var; + switch ($key['type']) { case "text": case "password": - print ''; + print ''; print ''.$langs->trans($key['varname']).''; print ''."\n"; break; case "info": // Google Api setup or Google OAuth Token - print ''; + print ''; print ''; if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') { @@ -195,7 +195,7 @@ if ($mode == 'setup' && $user->admin) if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') { // Token - print ''; + print ''; print ''; print ''; + + print ''; print ''; print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index 7949b47c346..24f1d64e30c 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -16,7 +16,7 @@ */ /** - * \file htdocs/product/admin/expression_globals.php + * \file htdocs/product/admin/dynamic_prices.php * \ingroup product * \brief Page for configuring dynamic prices */ @@ -161,16 +161,25 @@ if ($action != 'create_updater' && $action != 'edit_updater') { print ''; //Space for buttons print ''; - $var=True; - foreach ($price_globals->listGlobalVariables() as $i=>$entry) { - $var = !$var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $arrayglobalvars=$price_globals->listGlobalVariables(); + if (! empty($arrayglobalvars)) + { + foreach ($arrayglobalvars as $i=>$entry) { + $var = !$var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + else + { + print ''; } print '
    '; print ''.img_picto('','object_opensurvey').' '.$obj->id_sondage.''; print ''.dol_htmlentities($obj->titre).''; @@ -184,7 +196,7 @@ while ($i < min($num,$limit)) print ''.$nbuser.''.$nbuser.''.dol_print_date($db->jdate($obj->date_fin),'day'); if ($db->jdate($obj->date_fin) < time()) { print ' ('.$langs->trans("Expired").')'; } diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 8abcac5a6f1..1a020ab86bf 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -110,22 +110,22 @@ print ''.$langs->trans("AccountParameter").''.$langs->trans("Value").'
    '; + +print '
    '; print ''.$langs->trans("PAYBOX_PBX_SITE").''; print ''; print '
    '.$langs->trans("Example").': 1999888 ('.$langs->trans("Test").')'; print '
    '; + +print '
    '; print ''.$langs->trans("PAYBOX_PBX_RANG").''; print ''; print '
    '.$langs->trans("Example").': 99 ('.$langs->trans("Test").')'; print '
    '; + +print '
    '; print ''.$langs->trans("PAYBOX_PBX_IDENTIFIANT").''; print ''; print '
    '.$langs->trans("Example").': 2 ('.$langs->trans("Test").')'; @@ -138,8 +138,8 @@ print '
    '.$langs->trans("Value").'
    '; + +print '
    '; print $langs->trans("PAYBOX_IBS_DEVISE").''; print ''; print '
    '.$langs->trans("Example").': 978 (EUR)'; @@ -147,51 +147,51 @@ print '
    '; + +print '
    '; print $langs->trans("PAYBOX_CGI_URL_V1").''; print ''; print '
    '.$langs->trans("Example").': http://mysite/cgi-bin/module_linux.cgi'; print '
    '; + +print '
    '; print ''.$langs->trans("PAYBOX_CGI_URL_V2").''; print ''; print '
    '.$langs->trans("Example").': http://mysite/cgi-bin/modulev2_redhat72.cgi'; print '
    '; + +print '
    '; print $langs->trans("VendorName").''; print ''; print '
    '.$langs->trans("Example").': '.$mysoc->name; print '
    '; + +print '
    '; print $langs->trans("CSSUrlForPaymentForm").''; print ''; print '
    '.$langs->trans("Example").': http://mysite/mycss.css'; print '
    '; + +print '
    '; print $langs->trans("MessageOK").''; $doleditor=new DolEditor('PAYBOX_MESSAGE_OK',$conf->global->PAYBOX_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%'); $doleditor->Create(); print '
    '; + +print '
    '; print $langs->trans("MessageKO").''; $doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_2,'90%'); $doleditor->Create(); print '
    '; + +print '
    '; print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").''; print ''; print '   '.$langs->trans("Example").': myemail@myserver.com'; diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index e63fb3e85c7..4942d15a9ce 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -128,34 +128,34 @@ print ''.$langs->trans("AccountParameter").''.$langs->trans("Value").'
    '; + +print '
    '; print $langs->trans("PAYPAL_API_SANDBOX").''; print $form->selectyesno("PAYPAL_API_SANDBOX",$conf->global->PAYPAL_API_SANDBOX,1); print '
    '; + +print '
    '; print $langs->trans("PAYPAL_API_USER").''; print ''; print '   '.$langs->trans("Example").': paypal_api1.mywebsite.com'; print '
    '; + +print '
    '; print $langs->trans("PAYPAL_API_PASSWORD").''; print ''; print '
    '; + +print '
    '; print $langs->trans("PAYPAL_API_SIGNATURE").''; print ''; print '
    '.$langs->trans("Example").': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF'; print '
    '; + +print '
    '; print $langs->trans("PAYPAL_SSLVERSION").''; print $form->selectarray("PAYPAL_SSLVERSION",array('1'=> $langs->trans('TLSv1'),'6'=> $langs->trans('TLSv1.2')),$conf->global->PAYPAL_SSLVERSION); print '
    '.$langs->trans("UsageParameter").''.$langs->trans("Value").'
    '; + +print '
    '; print $langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").''; print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",array('integral'=> $langs->trans('PaypalModeIntegral'),'paypalonly'=> $langs->trans('PaypalModeOnlyPaypal')),$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY); print '
    '; +/* +print '
    '; print ''.$langs->trans("PAYPAL_API_EXPRESS").''; print $form->selectyesno("PAYPAL_API_EXPRESS",$conf->global->PAYPAL_API_EXPRESS); print '
    '; + +print '
    '; print $langs->trans("VendorName").''; print ''; print '   '.$langs->trans("Example").': '.$mysoc->name; print '
    '; + +print '
    '; print $langs->trans("CSSUrlForPaymentForm").''; print ''; print '   '.$langs->trans("Example").': http://mysite/mycss.css'; print '
    '; + +print '
    '; print $langs->trans("PAYPAL_ADD_PAYMENT_URL").''; print $form->selectyesno("PAYPAL_ADD_PAYMENT_URL",$conf->global->PAYPAL_ADD_PAYMENT_URL,1); print '
    '; + +print '
    '; print $langs->trans("MessageOK").''; $doleditor=new DolEditor('PAYPAL_MESSAGE_OK',$conf->global->PAYPAL_MESSAGE_OK,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%'); $doleditor->Create(); print '
    '; + +print '
    '; print $langs->trans("MessageKO").''; $doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,'',100,'dolibarr_details','In',false,true,true,ROWS_4,'90%'); $doleditor->Create(); print '
    '; + +print '
    '; print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").''; print ''; print '   '.$langs->trans("Example").': myemail@myserver.com'; @@ -227,16 +227,16 @@ print ''.$langs->trans("UrlGenerationParameters").''.$langs->trans("Value").'
    '; + +print '
    '; print $langs->trans("SecurityToken").''; print ''; if (! empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); print '
    '; + +print '
    '; print $langs->trans("SecurityTokenIsUnique").''; print $form->selectyesno("PAYPAL_SECURITY_TOKEN_UNIQUE",(empty($conf->global->PAYPAL_SECURITY_TOKEN)?0:$conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE),1); print '
    admin) print '
    '.$langs->trans("Token").''; $tokenobj=null; @@ -265,8 +265,8 @@ if ($mode == 'config' && $user->admin) $langs->load($driver); $printer = new $classname($db); //print '
    '.print_r($printer, true).'
    '; - $var=!$var; - print '
    '.img_picto('', $printer->picto).' '.$langs->trans($printer->desc).''; if (! empty($conf->use_javascript_ajax)) @@ -348,8 +348,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 '
    '.$row['login'].''.$row['module'].''.$row['driver'].' 
    '.$entry->code.''.$entry->description.''.price($entry->value).'id.'">'.img_edit().'  '; - print 'id.'">'.img_delete().'
    '.$entry->code.''.$entry->description.''.price($entry->value).'id.'">'.img_edit().'  '; + print 'id.'">'.img_delete().'
    '; + print $langs->trans("None"); + print '
    '; @@ -218,16 +227,9 @@ if ($action == 'create_variable' || $action == 'edit_variable') { print ''; print ''; print ''; -} else if ($action != 'create_updater') { - //Action Buttons - print '
    '; - print ''.$langs->trans("Add").''; - print '
    '; - //Separator is only need for updaters table is showed after buttons - print '

    '; } -//Updaters table +// Updaters table if ($action != 'create_variable' && $action != 'edit_variable') { print $langs->trans("GlobalVariableUpdaters"); print ''; @@ -241,26 +243,34 @@ if ($action != 'create_variable' && $action != 'edit_variable') { print ''; //Space for buttons print ''; - $var=True; - foreach ($price_updaters->listUpdaters() as $i=>$entry) { - $code = ""; - if ($entry->fk_variable > 0) { - $res = $price_globals->fetch($entry->fk_variable); - if ($res > 0) { - $code = $price_globals->code; - } - } - $var = !$var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $arraypriceupdaters = $price_updaters->listUpdaters(); + if (! empty($arraypriceupdaters)) + { + foreach ($arraypriceupdaters as $i=>$entry) { + $code = ""; + if ($entry->fk_variable > 0) { + $res = $price_globals->fetch($entry->fk_variable); + if ($res > 0) { + $code = $price_globals->code; + } + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + } + } + else + { + print ''; } print '
     
    '.$code.''.$entry->description.''.$langs->trans("GlobalVariableUpdaterType".$entry->type).''.$entry->parameters.''.$entry->update_interval.''.$entry->getLastUpdated().'id.'">'.img_edit().'  '; - print 'id.'">'.img_delete().'
    '.$code.''.$entry->description.''.$langs->trans("GlobalVariableUpdaterType".$entry->type).''.$entry->parameters.''.$entry->update_interval.''.$entry->getLastUpdated().'id.'">'.img_edit().'  '; + print 'id.'">'.img_delete().'
    '; + print $langs->trans("None"); + print '
    '; diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index e284572e7e7..224acd9c04b 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -155,7 +155,6 @@ $genPriceOptions = function($level) use ($price_options) { return $return; }; - ?> @@ -173,7 +172,8 @@ $genPriceOptions = function($level) use ($price_options) { '."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -402,146 +391,161 @@ foreach ($dirproduct as $dirroot) } print '
    trans('SellingPrice').' '.$i; // Label of price - if (! empty($conf->global->{"PRODUIT_MULTIPRICES_LABEL$i"})) { + $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; + if (! empty($conf->global->$keyforlabel)) { print ' - '.$langs->trans($conf->global->$keyforlabel); } ?> diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index c42c3981494..3582f8b25b6 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -33,6 +33,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $langs->load("admin"); @@ -44,9 +45,9 @@ if (! $user->admin || (empty($conf->product->enabled) && empty($conf->service->e $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); -$type = GETPOST('type','alpha'); $label = GETPOST('label','alpha'); $scandir = GETPOST('scandir','alpha'); +$type='product'; // Pricing Rules $select_pricing_rules=array( @@ -66,6 +67,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_ dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity); } +$error = 0; /* @@ -118,10 +120,12 @@ if ($action == 'setModuleOptions') if ($action == 'other' && GETPOST('value_PRODUIT_LIMIT_SIZE') >= 0) { $res = dolibarr_set_const($db, "PRODUIT_LIMIT_SIZE", GETPOST('value_PRODUIT_LIMIT_SIZE'),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; } if ($action == 'other' && GETPOST('value_PRODUIT_MULTIPRICES_LIMIT') > 0) { $res = dolibarr_set_const($db, "PRODUIT_MULTIPRICES_LIMIT", GETPOST('value_PRODUIT_MULTIPRICES_LIMIT'),'chaine',0,'',$conf->entity); + if (! $res > 0) $error++; } if ($action == 'other') { @@ -154,28 +158,19 @@ if ($action == 'other') } } -} -if ($action == 'other') -{ + $value = GETPOST('activate_sousproduits','alpha'); $res = dolibarr_set_const($db, "PRODUIT_SOUSPRODUITS", $value,'chaine',0,'',$conf->entity); -} -if ($action == 'other') -{ + $value = GETPOST('activate_viewProdDescInForm','alpha'); $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $value,'chaine',0,'',$conf->entity); -} -if ($action == 'other') -{ + $value = GETPOST('activate_viewProdTextsInThirdpartyLanguage','alpha'); $res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $value,'chaine',0,'',$conf->entity); -} -if ($action == 'other') { + $value = GETPOST('activate_mergePropalProductCard','alpha'); $res = dolibarr_set_const($db, "PRODUIT_PDF_MERGE_PROPAL", $value,'chaine',0,'',$conf->entity); -} -if ($action == 'other') -{ + $value = GETPOST('activate_usesearchtoselectproduct','alpha'); $res = dolibarr_set_const($db, "PRODUIT_USE_SEARCH_TO_SELECT", $value,'chaine',0,'',$conf->entity); } @@ -184,8 +179,8 @@ if ($action == 'specimen') // For products { $modele= GETPOST('module','alpha'); - $inter = new Fichinter($db); - $inter->initAsSpecimen(); + $product = new Product($db); + $product->initAsSpecimen(); // Search template files $file=''; $classname=''; $filefound=0; @@ -207,9 +202,9 @@ if ($action == 'specimen') // For products $module = new $classname($db); - if ($module->write_file($inter,$langs) > 0) + if ($module->write_file($product, $langs, '') > 0) { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=products&file=SPECIMEN.pdf"); + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=product&file=SPECIMEN.pdf"); return; } else @@ -265,24 +260,19 @@ if ($action == 'set') $value = GETPOST('value'); if (GETPOST('value','alpha')) $res = dolibarr_set_const($db, $const, $value,'chaine',0,'',$conf->entity); else $res = dolibarr_del_const($db, $const,$conf->entity); + if (! $res > 0) $error++; } -/*else if ($action == 'useecotaxe') -{ - $ecotaxe = GETPOST("activate_useecotaxe"); - $res = dolibarr_set_const($db, "PRODUIT_USE_ECOTAXE", $ecotaxe,'chaine',0,'',$conf->entity); -}*/ if ($action == 'other') { $value = GETPOST('activate_units', 'alpha'); $res = dolibarr_set_const($db, "PRODUCT_USE_UNITS", $value, 'chaine', 0, '', $conf->entity); + if (! $res > 0) $error++; } if ($action) { - if (! $res > 0) $error++; - - if (! $error) + if (! $error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } @@ -317,14 +307,13 @@ $linkback=''.$langs->trans("BackToM print load_fiche_titre($title,$linkback,'title_setup'); $head = product_admin_prepare_head(); -dol_fiche_head($head, 'general', $tab, 0, 'product'); +dol_fiche_head($head, 'general', $tab, -1, 'product'); $form=new Form($db); -/* - * Module to manage product / services code - */ +// Module to manage product / services code $dirproduct=array('/core/modules/product/'); +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); print load_fiche_titre($langs->trans("ProductCodeChecker"), '', ''); @@ -367,7 +356,7 @@ foreach ($dirproduct as $dirroot) if ($modCodeProduct->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; $var = !$var; - print '
    '.$modCodeProduct->name.''.$modCodeProduct->info($langs).''.$modCodeProduct->getExample($langs).'
    '; - -// Load array def with activated templates +// Module to build doc $def = array(); $sql = "SELECT nom"; $sql.= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql.= " WHERE type = 'product'"; +$sql.= " WHERE type = '".$type."'"; $sql.= " AND entity = ".$conf->entity; $resql=$db->query($sql); if ($resql) { $i = 0; $num_rows=$db->num_rows($resql); - if ($num_rows > 0) + while ($i < $num_rows) { - print '
    '; - print load_fiche_titre($langs->trans("ModelModulesProduct"), '', ''); - - while ($i < $num_rows) - { - $array = $db->fetch_array($resql); - array_push($def, $array[0]); - $i++; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; - - $var=true; - foreach ($dirproduct as $dirroot) - { - $dir = dol_buildpath($dirroot.'core/modules/product/doc/',0); - $handle=@opendir($dir); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (preg_match('/\.modules\.php$/i',$file)) - { - $name = substr($file, 4, dol_strlen($file) -16); - $classname = substr($file, 0, dol_strlen($file) -12); - - try { - dol_include_once($dirroot.'core/modules/product/doc/'.$file); - } - catch(Exception $e) - { - dol_syslog($e->getMessage(), LOG_ERR); - } - - $module = new $classname($db); - - $modulequalified=1; - if (! empty($module->version)) { - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; - else if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; - } - - if ($modulequalified) - { - $var = !$var; - print ''; - - // Activate / Disable - if (in_array($name, $def)) - { - print ""; - } - else - { - if (versioncompare($module->phpmin,versionphparray()) > 0) - { - print ""; - } - else - { - print ""; - } - } - - // Info - $htmltooltip = ''.$langs->trans("Name").': '.$module->name; - $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); - if ($module->type == 'pdf') - { - $htmltooltip.='
    '.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur; - } - $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; - $htmltooltip.='
    '.$langs->trans("WatermarkOnDraft").': '.yn((! empty($module->option_draft_watermark)?$module->option_draft_watermark:''), 1, 1); - - print ''; - - // Preview - print ''; - - print "\n"; - } - } - } - closedir($handle); - } - } - print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '; - print $module->name; - print "\n"; - if (method_exists($module,'info')) print $module->info($langs); - else print $module->description; - print '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; - print img_picto($langs->trans("Enabled"),'switch_on'); - print ''; - print "\n"; - print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion",join('.',$module->phpmin))),'switch_off'); - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; - print "'; - print $form->textwithpicto('',$htmltooltip,1,0); - print ''; - if ($module->type == 'pdf') - { - $linkspec=''.img_object($langs->trans("Preview"),'bill').''; - } - else - { - $linkspec=img_object($langs->trans("PreviewNotAvailable"),'generic'); - } - print $linkspec; - print '
    '; + $array = $db->fetch_array($resql); + array_push($def, $array[0]); + $i++; } } else { - dol_print_error($db); + dol_print_error($db); } - + +print '
    '; + +print load_fiche_titre($langs->trans("ProductDocumentTemplates"), '', ''); + +print ''; +print ''; +print ''; +print ''; +print '\n"; +print '\n"; +print ''; +print ''; +print "\n"; + +clearstatcache(); + +$var=true; +foreach ($dirmodels as $reldir) +{ + foreach (array('','/doc') as $valdir) + { + $dir = dol_buildpath($reldir."core/modules/product".$valdir); + if (is_dir($dir)) + { + $handle=opendir($dir); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + $filelist[]=$file; + } + closedir($handle); + arsort($filelist); + + foreach($filelist as $file) + { + if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) + { + + if (file_exists($dir.'/'.$file)) + { + $name = substr($file, 4, dol_strlen($file) -16); + $classname = substr($file, 0, dol_strlen($file) -12); + + require_once $dir.'/'.$file; + $module = new $classname($db); + + $modulequalified=1; + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0; + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0; + + if ($modulequalified) + { + $var = !$var; + print ''; + + // Active + if (in_array($name, $def)) + { + print ''; + } + else + { + print '"; + } + + // Defaut + print ''; + + // Info + $htmltooltip = ''.$langs->trans("Name").': '.$module->name; + $htmltooltip.='
    '.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); + if ($module->type == 'pdf') + { + $htmltooltip.='
    '.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; + } + $htmltooltip.='

    '.$langs->trans("FeaturesSupported").':'; + $htmltooltip.='
    '.$langs->trans("Logo").': '.yn($module->option_logo,1,1); + $htmltooltip.='
    '.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1); + $htmltooltip.='
    '.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1); + $htmltooltip.='
    '.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); + $htmltooltip.='
    '.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark,1,1); + + + print ''; + + // Preview + print ''; + + print "\n"; + } + } + } + } + } + } + } +} + +print '
    '.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status")."'.$langs->trans("Default")."'.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
    '; + print (empty($module->name)?$name:$module->name); + print "\n"; + if (method_exists($module,'info')) print $module->info($langs); + else print $module->description; + print ''."\n"; + print ''; + print img_picto($langs->trans("Enabled"),'switch_on'); + print ''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print "'; + if ($conf->global->PRODUCT_ADDON_PDF == $name) + { + print img_picto($langs->trans("Default"),'on'); + } + else + { + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + } + print ''; + print $form->textwithpicto('',$htmltooltip,1,0); + print ''; + if ($module->type == 'pdf') + { + print ''.img_object($langs->trans("Preview"),'contract').''; + } + else + { + print img_object($langs->trans("PreviewNotAvailable"),'generic'); + } + print '
    '; +print "
    "; /* * Other conf @@ -574,8 +578,8 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) $rowspan++; if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) $rowspan++; if (! empty($conf->global->MAIN_MULTILANGS)) $rowspan++; -$var=!$var; -print '
    '.$langs->trans("PricingRule").''; $current_rule = 'PRODUCT_PRICE_UNIQ'; @@ -597,16 +601,16 @@ print '
    '.$langs->trans("MultiPricesNumPrices").'
    '.$langs->trans("AssociatedProductsAbility").''; print $form->selectyesno("activate_sousproduits",$conf->global->PRODUIT_SOUSPRODUITS,1); @@ -614,8 +618,8 @@ print '
    '.$form->textwithpicto($langs->trans("UseSearchToSelectProduct"),$langs->trans('UseSearchToSelectProductTooltip'),1).'
    '.$langs->trans("NumberOfProductShowInSelect").'
    '.$langs->trans("ViewProductDescInFormAbility").''; print $form->selectyesno("activate_viewProdDescInForm",$conf->global->PRODUIT_DESC_IN_FORM,1); @@ -657,8 +661,8 @@ print '
    '.$langs->trans("MergePropalProductCard").''; print $form->selectyesno("activate_mergePropalProductCard",$conf->global->PRODUIT_PDF_MERGE_PROPAL,1); @@ -668,8 +672,8 @@ print '
    '.$langs->trans("UseUnits").''; print $form->selectyesno("activate_units",$conf->global->PRODUCT_USE_UNITS,1); @@ -680,8 +684,8 @@ print '
    '.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").''; print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)?$conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE:0), 1); @@ -722,7 +726,7 @@ if (! empty($conf->global->PRODUCT_CANVAS_ABILITY)) if ($conf->$module->enabled) { - $var=!$var; + print "
    "; print $object->description; diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index ca5944c421f..304b0d68333 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -84,7 +84,7 @@ print load_fiche_titre($title,$linkback,'title_setup'); $head = product_admin_prepare_head(); -dol_fiche_head($head, 'attributes', $textobject, 0, 'product'); +dol_fiche_head($head, 'attributes', $textobject, -1, 'product'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index cc6f1b5116d..671bb9779a7 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -271,16 +271,16 @@ else print ''.$langs->trans("Value").'
    '.$langs->trans("OldVATRates").''."\n"; print $form->load_tva('oldvatrate', $oldvatrate, $mysoc); print '
    '.$langs->trans("NewVATRates").''."\n"; print $form->load_tva('newvatrate', $newvatrate, $mysoc); @@ -288,8 +288,8 @@ else print '
    '.$langs->trans("PriceBaseTypeToChange").''."\n"; print $form->selectPriceBaseType($price_base_type); diff --git a/htdocs/product/canvas/product/tpl/list.tpl.php b/htdocs/product/canvas/product/tpl/list.tpl.php index e57fd5adfab..ad00d75259e 100644 --- a/htdocs/product/canvas/product/tpl/list.tpl.php +++ b/htdocs/product/canvas/product/tpl/list.tpl.php @@ -84,7 +84,7 @@ + ?>
    '; $html .= $langs->trans("AddToDraftProposals").''; $html .= $form->selectarray("propalid", $otherprop, 0, 1); @@ -1921,11 +1897,9 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = $langs->load("orders"); - $var=true; $othercom = $commande->liste_array(2, 1, null); if (is_array($othercom) && count($othercom)) { - $var=!$var; $html .= '
    '; $html .= $langs->trans("AddToDraftOrders").''; $html .= $form->selectarray("commandeid", $othercom, 0, 1); @@ -1947,11 +1921,9 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = $langs->load("bills"); - $var=true; $otherinvoice = $invoice->liste_array(2, 1, null); if (is_array($otherinvoice) && count($otherinvoice)) { - $var=!$var; $html .= '
    '; $html .= $langs->trans("AddToDraftInvoices").''; $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); @@ -2001,19 +1973,20 @@ if (! empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action = /* * Documents generes */ -if ($action == '' || $action == 'view') + +if ($action != 'edit' && $action != 'delete') { print '
    '; print ''; // ancre - $filedir=$upload_dir; - + // Documents + $objectref = dol_sanitizeFileName($object->ref); + $relativepath = $comref . '/' . $objectref . '.pdf'; + $filedir = $conf->produit->dir_output . '/' . $objectref; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed=$user->rights->produit->creer; $delallowed=$user->rights->produit->supprimer; - $var=true; - print $formfile->showdocuments($modulepart,$object->ref,$filedir,$urlsource,$genallowed,$delallowed,'',0,0,0,28,0,'',0,'',$object->default_lang, '', $object); $somethingshown=$formfile->numoffiles; diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index 49af8c73123..e2ee97e0100 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -339,7 +339,7 @@ class ProductApi extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - return $this->product->delete($id); + return $this->product->delete(DolibarrApiAccess::$user); } /** diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 90bc9d7296f..14885532952 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -246,7 +246,7 @@ class Products extends DolibarrApi global $user; $user = DolibarrApiAccess::$user; - return $this->product->delete($id); + return $this->product->delete(DolibarrApiAccess::$user); } /** @@ -264,7 +264,7 @@ class Products extends DolibarrApi */ function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { $categories = new Categories(); - return $categories->getListForItem('product', $sortfield, $sortorder, $limit, $page, $id); + return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'product', $id); } /** diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a0fac8aec74..e25ad186369 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2017 Ferran Marcet * Copyright (C) 2017 Gustavo Novaro * * This program is free software; you can redistribute it and/or modify @@ -937,7 +937,7 @@ class Product extends CommonObject // End call triggers } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->product->dir_output) @@ -1012,18 +1012,18 @@ class Product extends CommonObject /** * Delete a product from database (if not used) * - * @param int $id Product id (usage of this is deprecated, delete should be called without parameters on a fetched object) + * @param User $user Product id (usage of this is deprecated, delete should be called without parameters on a fetched object) * @param int $notrigger Do not execute trigger * @return int < 0 if KO, 0 = Not possible, > 0 if OK */ - function delete($id=0, $notrigger=0) + function delete(User $user, $notrigger=0) { // Deprecation warning if ($id > 0) { dol_syslog(__METHOD__ . " with parameter is deprecated", LOG_WARNING); } - global $conf,$user,$langs; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; $error=0; @@ -3429,6 +3429,41 @@ class Product extends CommonObject return $result; } + + /** + * Create a document onto disk according to template module. + * + * @param string $modele Force model to use ('' to not force) + * @param Translate $outputlangs Object langs to use for output + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$user,$langs; + + $langs->load("products"); + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->PRODUCT_ADDON_PDF)) + { + $modele = $conf->global->PRODUCT_ADDON_PDF; + } + else + { + $modele = 'strato'; + } + } + + $modelpath = "core/modules/product/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + /** * Return label of status of object * @@ -3524,6 +3559,11 @@ class Product extends CommonObject if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); } + if ($mode == 6) + { + if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); + if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); + } return $langs->trans('Unknown'); } @@ -3944,11 +3984,11 @@ class Product extends CommonObject $return =''."\n"; $nbphoto=0; - $filearray=dol_dir_list($dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearray=dol_dir_list($dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs { - $filearrayold=dol_dir_list($dirold,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); + $filearrayold=dol_dir_list($dirold,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=array_merge($filearray, $filearrayold); } @@ -4323,6 +4363,7 @@ class Product extends CommonObject $now=dol_now(); // Initialize parameters + $this->specimen=1; $this->id=0; $this->ref = 'PRODUCT_SPEC'; $this->label = 'PRODUCT SPECIMEN'; diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 230a3dbee23..37068a1daca 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -571,7 +571,7 @@ if ($id > 0 || ! empty($ref)) continue; } } - $var=!$var; + print "\n
    '; // Price expression selector -print ''; print '
    '.$langs->trans("PriceExpressionSelected").''; +print '
    '.$langs->trans("PriceExpressionSelected").''; $price_expression_list = array(0 => $langs->trans("New")); //Put the new as first option foreach ($price_expression->list_price_expression() as $entry) { $price_expression_list[$entry->id] = $entry->title; @@ -204,6 +211,8 @@ $doleditor->Create(); print '
    '; +dol_fiche_end(); + //Buttons print '
    '; print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 69a9344832b..546d94773a3 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class. $langs->load("products"); $langs->load("suppliers"); $langs->load("bills"); -if (! empty($conf->margin->enabled)) $langs->load("margins"); +$langs->load("margins"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); @@ -305,10 +305,11 @@ if ($id > 0 || $ref) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); - dol_fiche_head($head, 'suppliers', $titre, 0, $picto); + + dol_fiche_head($head, 'suppliers', $titre, -1, $picto); $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'); print '
    '; @@ -394,7 +395,7 @@ if ($id > 0 || $ref) { if (empty($form->result)) { - print ' - '.$langs->trans("CreateDolibarrThirdPartySupplier").''; + print ' - '.$langs->trans("CreateDolibarrThirdPartySupplier").''; } } } @@ -620,9 +621,9 @@ if ($id > 0 || $ref) foreach($product_fourn_list as $productfourn) { - $var=!$var; + - print "
    '.$productfourn->getSocNomUrl(1,'supplier').'
    '; -print ''; +print ''; if (! empty($conf->product->enabled)) { - $statProducts = ""; + $statProducts = ''; $statProducts.= ''; $statProducts.= ""; - $statProducts.= ""; + $statProducts.= ''; $statProducts.= ''; $statProducts.= ""; - $statProducts.= ""; + $statProducts.= ''; $statProducts.= ''; $statProducts.= ""; } if (! empty($conf->service->enabled)) { - $statServices = ""; + $statServices = ''; $statServices.= ''; $statServices.= ""; - $statServices.= ""; + $statServices.= ''; $statServices.= ''; $statServices.= ""; - $statServices.= ""; + $statServices.= ''; $statServices.= ''; $statServices.= ""; @@ -220,7 +220,7 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; + print ''; $total+=$obj->nb; $i++; @@ -268,7 +268,7 @@ if ($result) $colnb=5; if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++; - print ''; + print ''; $var=True; @@ -292,8 +292,8 @@ if ($result) } } - $var=!$var; - print ""; + + print ''; print ''; } print '"; print '"; print "\n"; $i++; @@ -427,8 +427,8 @@ function activitytrim($product_type) { if ($trim1+$trim2+$trim3+$trim4 > 0) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; @@ -461,8 +461,8 @@ function activitytrim($product_type) } if ($trim1+$trim2+$trim3+$trim4 > 0) { - $var=!$var; - print ''; + + print ''; print ''; print ''; print ''; diff --git a/htdocs/product/info.php b/htdocs/product/info.php index e29d1a168cb..e6011c7945c 100644 --- a/htdocs/product/info.php +++ b/htdocs/product/info.php @@ -91,10 +91,11 @@ if ($id > 0 || $ref) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); - dol_fiche_head($head, 'info', $titre, 0, $picto); + + dol_fiche_head($head, 'info', $titre, -1, $picto); $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'); $object->info($object->id); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 85b63077a05..10d819738ca 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -45,7 +45,12 @@ $langs->load("suppliers"); $langs->load("companies"); if (! empty($conf->productbatch->enabled)) $langs->load("productbatch"); -$action = GETPOST('action'); +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); + $sref=GETPOST("sref"); $sbarcode=GETPOST("sbarcode"); $snom=GETPOST("snom"); @@ -69,6 +74,8 @@ if (!$_POST) { $search_hidechildproducts = GETPOST('search_hidechildproducts'); } +$diroutputmassaction=$conf->product->dir_output . '/temp/massgeneration/'.$user->id; + $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -209,6 +216,16 @@ if (empty($reshook)) $search_accountancy_code_buy=''; $search_array_options=array(); } + + // Mass actions + $objectclass='Product'; + if ((string) $type == '1') { $objectlabel='Services'; } + if ((string) $type == '0') { $objectlabel='Products'; } + + $permtoread = $user->rights->produit->lire; + $permtodelete = $user->rights->produit->supprimer; + $uploaddir = $conf->product->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -340,6 +357,8 @@ else { $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); @@ -394,6 +413,15 @@ else if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); } + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + if ($user->rights->produit->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); + if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + print ''; if ($optioncss != '') print ''; print ''; @@ -403,7 +431,7 @@ else print ''; print ''; - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_products.png', 0, '', '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, '', '', $limit); if (! empty($catid)) { @@ -470,48 +498,13 @@ else $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 '
    '.$langs->trans("Statistics").'
    '.$langs->trans("Statistics").'
    '.$langs->trans("ProductsNotOnSell").''.round($prodser[0][0]).'
    '.$langs->trans("ProductsOnSell").''.round($prodser[0][1]).'
    '.$langs->trans("ProductsOnSellAndOnBuy").''.round($prodser[0][2]).'
    '.$langs->trans("ServicesNotOnSell").''.round($prodser[1][0]).'
    '.$langs->trans("ServicesOnSell").''.round($prodser[1][1]).'
    '.$langs->trans("ServicesOnSellAndOnBuy").''.round($prodser[1][2]).'
    '.$obj->label.''.$obj->nb.'
    '.$transRecordedType.'
    '.$transRecordedType.'
    '; $product_static->id=$objp->rowid; $product_static->ref=$objp->ref; @@ -325,10 +325,10 @@ if ($result) print ''; - print $product_static->LibStatut($objp->tosell,5,0); + print $product_static->LibStatut($objp->tosell,3,0); print "'; - print $product_static->LibStatut($objp->tobuy,5,1); + print $product_static->LibStatut($objp->tobuy,3,1); print "
    '.$tmpyear.'
    '.$tmpyear.''.price($trim1).''.price($trim2).''.price($trim3).'
    '.$tmpyear.'
    '.$tmpyear.''.price($trim1).''.price($trim2).''.price($trim3).'
    '."\n"; - print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder); - 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['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.tosell']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - + // Lines with input filters - print ''; + print ''; if (! empty($arrayfields['p.ref']['checked'])) { print ''; } - print ''; print ''; - + print ''; + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder); + 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['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.tosell']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + $product_static=new Product($db); $product_fourn =new ProductFournisseur($db); - $var=true; $i = 0; while ($i < min($num,$limit)) { - $objp = $db->fetch_object($resql); + $obj = $db->fetch_object($resql); // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { $sql = "SELECT label"; $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql.= " WHERE fk_product=".$objp->rowid; + $sql.= " WHERE fk_product=".$obj->rowid; $sql.= " AND lang='". $langs->getDefaultLang() ."'"; $sql.= " LIMIT 1"; @@ -647,30 +676,29 @@ else if ($result) { $objtp = $db->fetch_object($result); - if (! empty($objtp->label)) $objp->label = $objtp->label; + if (! empty($objtp->label)) $obj->label = $objtp->label; } } - $product_static->id = $objp->rowid; - $product_static->ref = $objp->ref; - $product_static->ref_fourn = $objp->ref_supplier; - $product_static->label = $objp->label; - $product_static->type = $objp->fk_product_type; - $product_static->status_buy = $objp->tobuy; - $product_static->status = $objp->tosell; - $product_static->entity = $objp->entity; + $product_static->id = $obj->rowid; + $product_static->ref = $obj->ref; + $product_static->ref_fourn = $obj->ref_supplier; + $product_static->label = $obj->label; + $product_static->type = $obj->fk_product_type; + $product_static->status_buy = $obj->tobuy; + $product_static->status = $obj->tosell; + $product_static->entity = $obj->entity; if (! empty($conf->stock->enabled) && $user->rights->stock->lire && $type != 1) // To optimize call of load_stock { - if ($objp->fk_product_type != 1) // Not a service + if ($obj->fk_product_type != 1) // Not a service { $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() } } - $var=!$var; - print ''; + print ''; // Ref if (! empty($arrayfields['p.ref']['checked'])) @@ -689,27 +717,27 @@ else // Label if (! empty($arrayfields['p.label']['checked'])) { - print ''; + print ''; } // Barcode if (! empty($arrayfields['p.barcode']['checked'])) { - print ''; + print ''; } // Duration if (! empty($arrayfields['p.duration']['checked'])) { print ''; } @@ -718,10 +746,10 @@ else if (! empty($arrayfields['p.sellprice']['checked'])) { print ''; } @@ -730,10 +758,10 @@ else if (! empty($arrayfields['p.minbuyprice']['checked'])) { print ''; } @@ -763,9 +791,9 @@ else if (! empty($arrayfields['p.desiredstock']['checked'])) { print ''; } @@ -773,9 +801,9 @@ else if (! empty($arrayfields['p.stock']['checked'])) { print ''; @@ -784,9 +812,9 @@ else if (! empty($arrayfields['stock_virtual']['checked'])) { print ''; @@ -795,13 +823,13 @@ else if (! empty($arrayfields['p.tobatch']['checked'])) { print ''; } // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''; + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''; // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''; + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''; // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -814,7 +842,7 @@ else if ($align) print ' align="'.$align.'"'; print '>'; $tmpkey='options_'.$key; - print $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); + print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); print ''; } } @@ -827,14 +855,14 @@ else if (! empty($arrayfields['p.datec']['checked'])) { print ''; } // Date modification if (! empty($arrayfields['p.tms']['checked'])) { print ''; } @@ -845,7 +873,7 @@ else if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); } else { - print $product_static->LibStatut($objp->tosell,5,0); + print $product_static->LibStatut($obj->tosell,5,0); } print ''; } @@ -856,12 +884,19 @@ else if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); } else { - print $product_static->LibStatut($objp->tobuy,5,1); + print $product_static->LibStatut($obj->tobuy,5,1); } print ''; } - // Action - print ''; + // Action + print ''; print "\n"; $i++; diff --git a/htdocs/product/note.php b/htdocs/product/note.php index 9a914527a83..0178635ed10 100644 --- a/htdocs/product/note.php +++ b/htdocs/product/note.php @@ -91,10 +91,10 @@ if ($id > 0 || ! empty($ref)) $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); - dol_fiche_head($head, 'note', $titre, 0, $picto); + dol_fiche_head($head, 'note', $titre, -1, $picto); $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'); $cssclass='titlefield'; diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 52ed6c9c969..5320e637316 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -103,7 +103,7 @@ $head[$h][1] = $title; $head[$h][2] = 'popularityprop'; $h++; -dol_fiche_head($head,'popularityprop',$langs->trans("Statistics")); +dol_fiche_head($head, 'popularityprop', $langs->trans("Statistics"), -1); // Array of liens to show @@ -136,7 +136,6 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - $var=True; while ($i < $num) { $objp = $db->fetch_object($resql); @@ -166,7 +165,6 @@ print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', print_liste_field_titre($langs->trans('NbOfQtyInProposals'), $_SERVER["PHP_SELF"], 'c', '', $param, 'align="right"', $sortfield, $sortorder); print "\n"; -$var=True; foreach($infoprod as $prodid => $vals) { // Multilangs @@ -186,8 +184,7 @@ foreach($infoprod as $prodid => $vals) } } - $var=!$var; - print ""; + print ""; print ''; + print ''; // Label of price print ''; + print ''; print ''; @@ -1723,7 +1724,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) foreach ($prodcustprice->lines as $line) { $var = ! $var; - print ""; + print ''; // Date $staticsoc = new Societe($db); $staticsoc->fetch($line->fk_soc); @@ -1804,7 +1805,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) // Line for default price - print ""; + print ''; print ""; print ""; @@ -1839,7 +1840,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { $var = ! $var; - print ""; + print ''; // Date $staticsoc = new Societe($db); $staticsoc->fetch($line->fk_soc); diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 13bc0fef186..8e3d1aa1985 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -121,10 +121,7 @@ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s on p.rowid = s.fk_produc if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ -if ($sall) -{ - $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; -} +if ($sall) $sql.=natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $all); // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) { @@ -137,41 +134,32 @@ if (dol_strlen($type)) $sql.= " AND p.fk_product_type <> '1'"; } } -if ($sref) $sql.= " AND p.ref LIKE '%".$sref."%'"; -if ($sbarcode) $sql.= " AND p.barcode LIKE '%".$sbarcode."%'"; -if ($snom) $sql.= " AND p.label LIKE '%".$db->escape($snom)."%'"; -if (! empty($tosell)) -{ - $sql.= " AND p.tosell = ".$tosell; -} -if (! empty($tobuy)) -{ - $sql.= " AND p.tobuy = ".$tobuy; -} -if (! empty($canvas)) -{ - $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; -} -if($catid) -{ - $sql.= " AND cp.fk_categorie = ".$catid; -} -if ($fourn_id > 0) -{ - $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; -} +if ($sref) $sql.= natural_search('p.ref', $ref); +if ($sbarcode) $sql.= natural_search('p.barcode', $sbarcode); +if ($snom) $sql.= natural_search('p.label', $snom); +if (! empty($tosell)) $sql.= " AND p.tosell = ".$tosell; +if (! empty($tobuy)) $sql.= " AND p.tobuy = ".$tobuy; +if (! empty($canvas)) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; +if($catid) $sql.= " AND cp.fk_categorie = ".$catid; +if ($fourn_id > 0) $sql.= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; // Insert categ filter -if ($search_categ) -{ - $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); -} +if ($search_categ) $sql .= " AND cp.fk_categorie = ".$db->escape($search_categ); $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,"; $sql.= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock"; -if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; // Not used yet +if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte"; $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($limit + 1, $offset); -$resql = $db->query($sql); +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1, $offset); + +$resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -197,31 +185,31 @@ if ($resql) llxHeader("", $texte, $helpurl); - if ($sref || $snom || $sall || GETPOST('search')) - { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, 'title_products'); - } - else - { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"").(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, 'title_products'); - } - - if (! empty($catid)) - { - print "
    "; - $c = new Categorie($db); - $c->fetch($catid); - $ways = $c->print_all_ways(' > ','product/reassort.php'); - print " > ".$ways[0]."
    \n"; - print "

    "; - } - print ''; print ''; print ''; print ''; print ''; + if ($sref || $snom || $sall || GETPOST('search')) + { + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); + } + else + { + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"").(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); + } + + if (! empty($catid)) + { + print "
    "; + $c = new Categorie($db); + $c->fetch($catid); + $ways = $c->print_all_ways(' > ','product/reassort.php'); + print " > ".$ways[0]."
    \n"; + print "

    "; + } + // Filter on categories $moreforfilter=''; if (! empty($conf->categorie->enabled)) @@ -264,32 +252,8 @@ if ($resql) print '
    '; print '
    '; @@ -617,29 +610,65 @@ else print $form->selectarray('tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$tobuy,1); print ''; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + print ''; + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
    '.dol_trunc($objp->label,40).''.dol_trunc($obj->label,40).''.$objp->barcode.''.$obj->barcode.''; - if (preg_match('/([0-9]+)[a-z]/i',$objp->duration)) + if (preg_match('/([0-9]+)[a-z]/i',$obj->duration)) { - if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); - elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); - //elseif (preg_match('/([0-9]+)h/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); - else print $objp->duration; + if (preg_match('/([0-9]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([0-9]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([0-9]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); + elseif (preg_match('/([0-9]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + //elseif (preg_match('/([0-9]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); + else print $obj->duration; } print ''; - if ($objp->tosell) + if ($obj->tosell) { - if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC"); - else print price($objp->price).' '.$langs->trans("HT"); + if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC"); + else print price($obj->price).' '.$langs->trans("HT"); } print ''; - if ($objp->tobuy && $objp->minsellprice != '') + if ($obj->tobuy && $obj->minsellprice != '') { - //print price($objp->minsellprice).' '.$langs->trans("HT"); - if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0) + //print price($obj->minsellprice).' '.$langs->trans("HT"); + if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) { if ($product_fourn->product_fourn_price_id > 0) { @@ -753,9 +781,9 @@ else if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { print ''; - if ($objp->fk_product_type != 1) + if ($obj->fk_product_type != 1) { - print $objp->seuil_stock_alerte; + print $obj->seuil_stock_alerte; } print ''; - if ($objp->fk_product_type != 1) + if ($obj->fk_product_type != 1) { - print $objp->desiredstock; + print $obj->desiredstock; } print ''; - if ($objp->fk_product_type != 1) + if ($obj->fk_product_type != 1) { - if ($objp->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' '; + if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' '; print $product_static->stock_reel; } print ''; - if ($objp->fk_product_type != 1) + if ($obj->fk_product_type != 1) { - if ($objp->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' '; + if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' '; print $product_static->stock_theorique; } print ''; - print yn($objp->tobatch); + print yn($obj->tobatch); print ''.$objp->accountancy_code_sell.''.$obj->accountancy_code_sell.''.$objp->accountancy_code_buy.''.$obj->accountancy_code_buy.''; - print dol_print_date($objp->date_creation, 'dayhour'); + print dol_print_date($obj->date_creation, 'dayhour'); print ''; - print dol_print_date($objp->date_update, 'dayhour'); + print dol_print_date($obj->date_update, 'dayhour'); print ' '; + if ($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($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
    '; if ($vals['type'] == 1) print img_object($langs->trans("ShowService"),"service"); else print img_object($langs->trans("ShowProduct"),"product"); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index e6bde28d27e..0f42c6fb445 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -654,10 +654,11 @@ llxHeader('', $title, $helpurl); $head = product_prepare_head($object); $titre = $langs->trans("CardProduct" . $object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); -dol_fiche_head($head, 'price', $titre, 0, $picto); + +dol_fiche_head($head, 'price', $titre, -1, $picto); $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'); @@ -760,7 +761,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { $var = ! $var; - print '
    '; @@ -1242,7 +1243,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { $var = !$var; - print '
    '; print $form->textwithpicto($langs->trans('SellingPrice') . ' ' . $i, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1); print '
    " . $langs->trans("Default") . "" . "
    '; - // Lignes des titres - print ""; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); - if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); - // Details per warehouse - if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context) - { - if ($nb_warehouse>1) { - foreach($warehouses_list as &$wh) { - print_liste_field_titre($wh['label'], '', '','','','align="right"'); - } - - } - } - if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); - print "\n"; - // Lignes des champs de filtre - print ''; + print ''; print ''; @@ -310,24 +274,47 @@ if ($resql) if ($virtualdiffersfromphysical) print ''; print ''; print ''; + print ''; print ''; print ''; - $var=True; + // Lignes des titres + print ""; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("StockLimit"), $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); + // Details per warehouse + if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context) + { + if ($nb_warehouse>1) { + foreach($warehouses_list as &$wh) { + print_liste_field_titre($wh['label'], '', '','','','align="right"'); + } + + } + } + if ($virtualdiffersfromphysical) print_liste_field_titre($langs->trans("VirtualStock"),$_SERVER["PHP_SELF"], "",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); + print "\n"; + while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ''; + print ''; @@ -376,27 +363,17 @@ if ($resql) } print ''; print ''; - print ''; - print "\n"; + print ''; + print ''; + print "\n"; $i++; } print "
    '; print ''; print '   '; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; print '
    '; - + print '
    '; $product=new Product($db); $product->fetch($objp->rowid); $product->load_stock(); - print $product->getNomUrl(1,'',16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''.$langs->trans("Movements").''.$product->LibStatut($objp->statut,5,0).''.$product->LibStatut($objp->tobuy,5,1).'
    '.$product->LibStatut($objp->tobuy,5,1).'
    "; print ''; + print ''; - if ($num > $conf->liste_limit) - { - if ($sref || $snom || $sall || GETPOST('search')) - { - print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, ''); - } - else - { - print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy.(!empty($search_categ) ? '&search_categ='.$search_categ : '').(!empty($toolowstock) ? '&toolowstock='.$toolowstock : ''), $sortfield, $sortorder,'',$num, 0, ''); - } - } - $db->free($resql); } diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 471aa7e3e6d..af1c6f2ec15 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -126,10 +126,7 @@ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowi if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ -if ($sall) -{ - $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; -} +if ($sall) $sql.=natural_search(array('p.ref','p.label','p.description','p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) { @@ -163,9 +160,17 @@ $sql.= " pb.batch, pb.eatby, pb.sellby,"; $sql.= " pl.eatby, pl.sellby"; if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($limit + 1, $offset); -$resql = $db->query($sql); +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit + 1, $offset); + +$resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); @@ -191,13 +196,19 @@ if ($resql) llxHeader("",$title,$helpurl,$texte); + print '
    '; + print ''; + print ''; + print ''; + print ''; + if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, 'title_products'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); } else { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, 'title_products'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products', 0, '', '', $limit); } if (! empty($catid)) @@ -210,12 +221,6 @@ if ($resql) print "
    "; } - print ''; - print ''; - print ''; - print ''; - print ''; - // Filter on categories $moreforfilter=''; if (! empty($conf->categorie->enabled)) @@ -252,26 +257,8 @@ if ($resql) print '
    '; print ''; - // Lignes des titres - print ""; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); - if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "e.label",$param,"",'',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Batch"), $_SERVER["PHP_SELF"], "pb.batch",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EatByDate"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellByDate"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); - // TODO Add info of running suppliers/customers orders - //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy","",$param,'align="right"',$sortfield,$sortorder); - print "\n"; - // Lignes des champs de filtre - print ''; + print ''; print ''; @@ -291,16 +278,35 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; print ''; + // Lignes des titres + print ""; + print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Warehouse"), $_SERVER["PHP_SELF"], "e.label",$param,"",'',$sortfield,$sortorder); + //print_liste_field_titre($langs->trans("DesiredStock"), $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Batch"), $_SERVER["PHP_SELF"], "pb.batch",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EatByDate"), $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("SellByDate"), $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stock_physique",$param,"",'align="right"',$sortfield,$sortorder); + // TODO Add info of running suppliers/customers orders + //print_liste_field_titre($langs->trans("TheoreticalStock"),$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Sell").')',$_SERVER["PHP_SELF"], "p.tosell","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status").' ('.$langs->trans("Buy").')',$_SERVER["PHP_SELF"], "p.tobuy","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); + print "\n"; + $product_static=new Product($db); $warehousetmp=new Entrepot($db); - $var=True; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); @@ -334,9 +340,7 @@ if ($resql) $warehousetmp->label=$objp->warehouse_ref; $warehousetmp->fk_parent=$objp->warehouse_parent; - $var=!$var; - - print ''; + print ''; // Ref print ''; print ''; print ''; + print ''; print "\n"; $i++; } diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 192017af2a5..341d002a1af 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -211,9 +211,9 @@ if ($id > 0 || ! empty($ref)) while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($result); - $var=!$var; + - print ''; + print ''; print '"; + print ''; print '\n"; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 53e5b0ab0a6..f0e5b0f13c4 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -234,9 +234,9 @@ if ($id > 0 || ! empty($ref)) while ($i < min($num,$conf->liste_limit)) { $objp = $db->fetch_object($result); - $var=!$var; + - print ''; + print ''; print ''; - print ""; + print ''; print ""; + print ''; // Label print ''; // Bank name @@ -611,7 +613,7 @@ if ($socid && $action != 'edit' && $action != "create") { $colspan=8; if (! empty($conf->prelevement->enabled)) $colspan+=2; - print ''; + print ''; } print '
    '; print ''; print '    '; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; print '
    '; @@ -377,6 +381,7 @@ if ($resql) print ''.$langs->trans("Movements").''.$product_static->LibStatut($objp->statut,5,0).''.$product_static->LibStatut($objp->tobuy,5,1).'
    '; $orderstatic->id=$objp->commandeid; $orderstatic->ref=$objp->ref; diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 8c5f1a3ba86..6a8183ca7de 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -177,9 +177,9 @@ if ($id > 0 || ! empty($ref)) while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($result); - $var=!$var; + - print "
    '.img_object($langs->trans("ShowContract"),"contract").' '; print $objp->rowid; print "
    '; $invoicestatic->id=$objp->facid; $invoicestatic->ref=$objp->facnumber; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index eb853539e01..95f74352305 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -474,9 +474,9 @@ else } } - $var=!$var; + //print ''.dol_print_date($objp->datem).'
    "; $productstatic->id=$objp->rowid; $productstatic->ref = $objp->ref; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index e6631d4b716..3e3eb4c28a7 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -176,8 +176,8 @@ class MouvementStock extends CommonObject if ($this->db->jdate($obj->eatby) != $eatby && $this->db->jdate($obj->eatby) != $eatbywithouthour) // We test date without hours and with hours for backward compatibility { // If found and eatby/sellby defined into table and provided and differs, return error - $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)); - dol_syslog($langs->transnoentities("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby)), dol_print_date($eatby)), LOG_ERR); + $this->errors[]=$langs->trans("ThisSerialAlreadyExistWithDifferentDate", $batch, dol_print_date($this->db->jdate($obj->eatby), 'dayhour'), dol_print_date($eatby, 'dayhour')); + dol_syslog("ThisSerialAlreadyExistWithDifferentDate batch=".$batch.", eatby found into product_lot = ".$obj->eatby." = ".dol_print_date($this->db->jdate($obj->eatby), 'dayhourrfc')." so eatbywithouthour = ".$eatbywithouthour." = ".dol_print_date($eatbywithouthour)." - eatby provided = ".$eatby." = ".dol_print_date($eatby, 'dayhourrfc'), LOG_ERR); $this->db->rollback(); return -3; } @@ -277,7 +277,7 @@ class MouvementStock extends CommonObject // Check if stock is enough when qty is < 0 // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. - if ($qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) + if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { if (! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) { @@ -292,6 +292,7 @@ class MouvementStock extends CommonObject } if (! $foundforbatch || $qtyisnotenough) { + $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferLotIsNotEnough'); $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough'); $this->db->rollback(); @@ -302,6 +303,7 @@ class MouvementStock extends CommonObject { if (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { + $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough'); $this->errors[] = $langs->trans('qtyToTranferIsNotEnough'); $this->db->rollback(); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0d92afe96e0..f28f3fd00d3 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -438,6 +438,35 @@ class Productlot extends CommonObject } } + + /** + * Return label of status of object + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut(0,$mode); + } + + /** + * Return label of a given status + * + * @param int $statut Status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label of status + */ + function LibStatut($statut,$mode=0) + { + global $langs; + + //$langs->load('stocks'); + + return ''; + } + + /** * Return a link to the a lot card (with optionaly the picto) * Use this->id,this->lastname, this->firstname diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 7349b48d1c9..a6e20aabcab 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -77,7 +77,7 @@ if ($result) $i = 0; print ''; - print ''; + print ''; if ($num) { @@ -87,8 +87,8 @@ if ($result) while ($i < $num) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; print "\n"; print ''; print "\n"; @@ -132,16 +132,16 @@ if ($resql) print '
    '.$langs->trans("Warehouses").'
    '.$langs->trans("Warehouses").'
    rowid\">".img_object($langs->trans("ShowStock"),"stock")." ".$objp->label."'.$entrepot->LibStatut($objp->statut,5).'
    '; print ""; - print ''; - print ''; + print ''; + print ''; if (! empty($conf->productbatch->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; } - print ''; - print ''; + print ''; + print ''; print "\n"; $var=True; @@ -149,8 +149,8 @@ if ($resql) while ($i < min($num,$max)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + + print ''; print ''; print ""; + print ''; print "\n"; print "\n"; print "\n"; diff --git a/htdocs/societe/project.php b/htdocs/societe/project.php index fe206dd4cc5..72c371ce934 100644 --- a/htdocs/societe/project.php +++ b/htdocs/societe/project.php @@ -79,7 +79,7 @@ if ($socid) if (! empty($conf->notification->enabled)) $langs->load("mails"); $head = societe_prepare_head($object); - dol_fiche_head($head, 'project', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'project', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 65bd12b2be4..185589f01cb 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -344,7 +344,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) // View if ($socid && $action != 'edit' && $action != "create") { - dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'rib', $langs->trans("ThirdParty"), -1, 'company'); // Confirm delete third party if ($action == 'delete') @@ -359,14 +359,16 @@ if ($socid && $action != 'edit' && $action != "create") print load_fiche_titre($langs->trans("DefaultRIB"), '', ''); + print '
    '; print '
    '; + print '
    '.$langs->trans("LastMovements",min($num,$max)).''.$langs->trans("Product").''.$langs->trans("LastMovements",min($num,$max)).''.$langs->trans("Product").''.$langs->trans("Batch").''.$langs->trans("EatByDate").''.$langs->trans("SellByDate").''.$langs->trans("Batch").''.$langs->trans("EatByDate").''.$langs->trans("SellByDate").''.$langs->trans("Warehouse").''.$langs->trans("FullList").''.$langs->trans("Warehouse").''.$langs->trans("FullList").'
    '.dol_print_date($db->jdate($objp->datem),'dayhour').'rowid\">"; print img_object($langs->trans("ShowProduct"),"product").' '.$objp->produit; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 0bfd9048352..f1c625308e7 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -149,18 +149,8 @@ if ($result) print '
    '; print ''."\n"; - print ""; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "estimatedvalue",'',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - // Lignes des champs de filtre - print ''; + print ''; print ''; print ''; + + print ''; + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("LocationSummary"),$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("PhysicalStock"), $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "estimatedvalue",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; if ($num) { @@ -197,7 +197,7 @@ if ($result) $warehouse->lieu = $objp->lieu; $warehouse->fk_parent = $objp->fk_parent; - print ""; + print ''; print ''; // Location print ''; @@ -224,7 +224,7 @@ if ($result) print "\n"; - $var=!$var; + $i++; } diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 03c0ebd78ba..2ab78ac735d 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -361,7 +361,7 @@ print getTitleFieldOfList('',0); print ''; -print ''; +print ''; // Product print ''; foreach($listofdata as $key => $val) { - $var=!$var; + $productstatic->fetch($val['id_product']); $warehousestatics->fetch($val['id_sw']); $warehousestatict->fetch($val['id_tw']); - print ''; + print ''; print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index d23dca08282..bc4099f66ec 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2015 Juanjo Menent * @@ -95,7 +95,7 @@ $arrayfields=array( 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))), - 'm.warehouse'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it + 'e.label'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), @@ -418,7 +418,7 @@ $sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,"; $sql.= " m.rowid as mid, m.value as qty, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,"; $sql.= " m.batch,"; $sql.= " pl.rowid as lotid, pl.eatby, pl.sellby,"; -$sql.= " u.login"; +$sql.= " u.login, u.photo, u.lastname, u.firstname"; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -665,6 +665,7 @@ if ($resql) if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product) $param.='&search_product='.urlencode($search_product); + if ($search_batch) $param.='&search_batch='.urlencode($search_batch); if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse); if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined @@ -727,43 +728,8 @@ if ($resql) print '
    '; print '
    '; print ''; @@ -183,6 +173,16 @@ if ($result) print '
    ' . $warehouse->getNomUrl(1) . ''.$objp->lieu.'
    '; $filtertype=0; @@ -402,13 +402,13 @@ print '
    '; print $productstatic->getNomUrl(1).' - '.$productstatic->label; print '
    '."\n"; - print ""; - if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['m.warehouse']['checked'])) print_liste_field_titre($arrayfields['m.warehouse']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible - if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"], "m.value","",$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['m.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['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - // Lignes des champs de filtre - print ''; + print ''; if (! empty($arrayfields['m.rowid']['checked'])) { // Ref @@ -799,7 +765,7 @@ if ($resql) // Batch if (! empty($arrayfields['m.batch']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.eatby']['checked'])) { @@ -812,7 +778,7 @@ if ($resql) print ''; } // Warehouse - if (! empty($arrayfields['m.warehouse']['checked'])) + if (! empty($arrayfields['e.label']['checked'])) { print ''; print "\n"; + print ''; + if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'],$_SERVER["PHP_SELF"],'m.rowid','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'],$_SERVER["PHP_SELF"],'m.datem','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'],$_SERVER["PHP_SELF"],'p.label','',$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['e.label']['checked'])) print_liste_field_titre($arrayfields['e.label']['label'],$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"], "m.value","",$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['m.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['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + $arrayofuniqueproduct=array(); - $var=True; while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); @@ -912,6 +913,7 @@ if ($resql) $productstatic->label=$objp->produit; $productstatic->type=$objp->type; $productstatic->entity=$objp->entity; + $productlot->id = $objp->lotid; $productlot->batch= $objp->batch; $productlot->eatby= $objp->eatby; @@ -928,8 +930,7 @@ if ($resql) $origin = ''; } - $var=!$var; - print ""; + print ""; // Id movement if (! empty($arrayfields['m.rowid']['checked'])) { @@ -974,7 +975,7 @@ if ($resql) print ''; } // Warehouse - if (! empty($arrayfields['m.warehouse']['checked'])) + if (! empty($arrayfields['e.label']['checked'])) { print '\n"; } if (! empty($arrayfields['m.inventorycode']['checked'])) @@ -997,7 +1001,7 @@ if ($resql) if (! empty($arrayfields['m.label']['checked'])) { // Label of movement - print ''; + print ''; } if (! empty($arrayfields['origin']['checked'])) { diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 14cd07ec817..7c524a167b9 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -110,7 +110,7 @@ $parameters=array('id'=>$id, 'ref'=>$ref, '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($action == 'addlimitstockwarehouse') { +if ($action == 'addlimitstockwarehouse') { $seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); @@ -538,7 +538,8 @@ if ($id > 0 || $ref) $head=product_prepare_head($object); $titre=$langs->trans("CardProduct".$object->type); $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); - dol_fiche_head($head, 'stock', $titre, 0, $picto); + + dol_fiche_head($head, 'stock', $titre, -1, $picto); dol_htmloutput_events(); @@ -625,7 +626,8 @@ if ($id > 0 || $ref) print ''; // Real stock - $text_stock_options = ''; + $text_stock_options = $langs->trans("RealStockDesc").'
    '; + $text_stock_options.= $langs->trans("RealStockWillAutomaticallyWhen").'
    '; $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)?$langs->trans("DeStockOnShipment").'
    ':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'
    ':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'
    ':''); @@ -642,57 +644,55 @@ if ($id > 0 || $ref) $stocktheo = price2num($object->stock_theorique, 'MS'); + $found=0; + $helpondiff=''.$langs->trans("StockDiffPhysicTeoric").':
    '; + // Number of customer orders running + if (! empty($conf->commande->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $helpondiff.=$langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; + $result=$object->load_stats_commande(0,'0'); + if ($result < 0) dol_print_error($db,$object->error); + $helpondiff.=' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; + } + + // Number of product from customer order already sent (partial shipping) + if (! empty($conf->expedition->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $result=$object->load_stats_sending(0,'2'); + $helpondiff.=$langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; + } + + // Number of supplier order running + if (! empty($conf->fournisseur->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $result=$object->load_stats_commande_fournisseur(0,'3,4'); + $helpondiff.=$langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; + $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); + if ($result < 0) dol_print_error($db,$object->error); + $helpondiff.=' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; + } + + // Number of product from supplier order already received (partial receipt) + if (! empty($conf->fournisseur->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $helpondiff.=$langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; + } + // Calculating a theorical value - print ''; - print "'; + print "'; print ''; - print ''; - print ''; - // Last movement $sql = "SELECT max(m.datem) as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; @@ -831,7 +831,7 @@ if ($resql) $entrepotstatic->libelle=$obj->label; $entrepotstatic->lieu=$obj->lieu; $stock_real = price2num($obj->reel, 'MS'); - print ''; + print ''; print ''; print ''; // PMP @@ -897,7 +897,7 @@ if ($resql) } } $i++; - $var=!$var; + } } else dol_print_error($db); @@ -951,12 +951,12 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) { $ent = new Entrepot($db); $ent->fetch($line['fk_entrepot']); - print ''; + print ''; print ''; print ''; print ''; print ''; - $var=!$var; + } } diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 3407c75a6f5..4d1b82307f8 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -270,24 +270,6 @@ llxHeader('','ProductLot',''); $form=new Form($db); -// Put here content of your page - -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { @@ -335,19 +317,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $formconfirm; } - print '
    '; //print ''; @@ -900,9 +866,44 @@ if ($resql) print '
    '. dol_print_date($objp->sellby,'day') .''; print $warehousestatic->getNomUrl(1); @@ -983,10 +984,13 @@ if ($resql) // Author if (! empty($arrayfields['m.fk_user_author']['checked'])) { - print ''; + print ''; $userstatic->id=$objp->fk_user_author; - $userstatic->lastname=$objp->login; - print $userstatic->getNomUrl(1); + $userstatic->login=$objp->login; + $userstatic->lastname=$objp->lastname; + $userstatic->firstname=$objp->firstname; + $userstatic->photo=$objp->photo; + print $userstatic->getNomUrl(-1); print "'.$objp->label.''.$objp->label.'
    '.$langs->trans("VirtualStock").'".(empty($stocktheo)?0:$stocktheo); + print '
    '; + print $form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")); + print '"; + //print (empty($stocktheo)?0:$stocktheo); + print $form->textwithpicto((empty($stocktheo)?0:$stocktheo), $helpondiff); if ($object->seuil_stock_alerte != '' && ($object->stock_theorique < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
    '; - print $langs->trans("StockDiffPhysicTeoric"); - print ''; - - $found=0; - // Number of customer orders running - if (! empty($conf->commande->enabled)) - { - if ($found) print '
    '; else $found=1; - print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; - $result=$object->load_stats_commande(0,'0'); - if ($result < 0) dol_print_error($db,$object->error); - print ' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; - } - - // Number of product from customer order already sent (partial shipping) - if (! empty($conf->expedition->enabled)) - { - if ($found) print '
    '; else $found=1; - $result=$object->load_stats_sending(0,'2'); - print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; - } - - // Number of supplier order running - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '
    '; else $found=1; - $result=$object->load_stats_commande_fournisseur(0,'3,4'); - print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; - $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); - if ($result < 0) dol_print_error($db,$object->error); - print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; - } - - // Number of product from supplier order already received (partial receipt) - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '
    '; else $found=1; - print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; - } - - print '
    '.$entrepotstatic->getNomUrl(1).''.$stock_real.($stock_real < 0 ?' '.img_warning():'').'
    '.$ent->getNomUrl(3).'
    '.$ent->getNomUrl(3).''.$line['seuil_stock_alerte'].''.$line['desiredstock'].''.img_delete().'
    '."\n"; $linkback = '' . $langs->trans("BackToList") . ''; - // Ref - print ''; - print ''; - print ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'batch'); + + print '
    '; + print '
    '; + + print '
    ' . $langs->trans('Batch') . ''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'batch'); - print '
    '."\n"; // Product - print ''; print ''; @@ -364,7 +345,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Sell by print ''; print ''; @@ -375,6 +356,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '.$langs->trans("Product").''; + print '
    '.$langs->trans("Product").''; $producttmp = new Product($db); $producttmp->fetch($object->fk_product); print $producttmp->getNomUrl(1, 'stock'); @@ -356,7 +337,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Eat by print '
    '; print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print '
    '; print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print '
    '; + print '
    '; + dol_fiche_end(); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 2910103e380..b3c4737b1a5 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -236,8 +236,7 @@ if ($search_fk_user_creat) $sql.= natural_search("fk_user_creat",$search_fk_user if ($search_fk_user_modif) $sql.= natural_search("fk_user_modif",$search_fk_user_modif); if ($search_import_key) $sql.= natural_search("import_key",$search_import_key); - -if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); +if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall); // Add where from extra fields foreach ($search_array_options as $key => $val) { @@ -342,6 +341,69 @@ if ($resql) print '
    '; print ''."\n"; + // Fields title search + print ''; + if (! empty($arrayfields['t.entity']['checked'])) print ''; + if (! empty($arrayfields['t.batch']['checked'])) print ''; + if (! empty($arrayfields['t.fk_product']['checked'])) print ''; + if (! empty($arrayfields['t.eatby']['checked'])) print ''; + if (! empty($arrayfields['t.sellby']['checked'])) print ''; + if (! empty($arrayfields['t.fk_user_creat']['checked'])) print ''; + if (! empty($arrayfields['t.fk_user_modif']['checked'])) print ''; + if (! empty($arrayfields['t.import_key']['checked'])) print ''; + // 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); + $typeofextrafield=$extrafields->attribute_type[$key]; + print ''; + } + } + } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['t.datec']['checked'])) + { + // Date creation + print ''; + } + if (! empty($arrayfields['t.tms']['checked'])) + { + // Date modification + print ''; + } + /*if (! empty($arrayfields['u.statut']['checked'])) + { + // Status + print ''; + }*/ + // Action column + print ''; + print ''."\n"; + // Fields title print ''; if (! empty($arrayfields['t.entity']['checked'])) print_liste_field_titre($arrayfields['t.entity']['label'],$_SERVER['PHP_SELF'],'t.entity','',$param,'',$sortfield,$sortorder); @@ -360,7 +422,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); } } } @@ -371,72 +433,9 @@ if ($resql) if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$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"; - // Fields title search - print ''; - if (! empty($arrayfields['t.entity']['checked'])) print ''; - if (! empty($arrayfields['t.batch']['checked'])) print ''; - if (! empty($arrayfields['t.fk_product']['checked'])) print ''; - if (! empty($arrayfields['t.eatby']['checked'])) print ''; - if (! empty($arrayfields['t.sellby']['checked'])) print ''; - if (! empty($arrayfields['t.fk_user_creat']['checked'])) print ''; - if (! empty($arrayfields['t.fk_user_modif']['checked'])) print ''; - if (! empty($arrayfields['t.import_key']['checked'])) print ''; - // 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); - $typeofextrafield=$extrafields->attribute_type[$key]; - print ''; - } - } - } - // Fields from hook - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (! empty($arrayfields['t.datec']['checked'])) - { - // Date creation - print ''; - } - if (! empty($arrayfields['t.tms']['checked'])) - { - // Date modification - print ''; - } - /*if (! empty($arrayfields['u.statut']['checked'])) - { - // Status - print ''; - }*/ - // Action column - print ''; - print ''."\n"; - $productlot = new Productlot($db); $i=0; @@ -453,7 +452,7 @@ if ($resql) $productlot->batch = $obj->batch; // You can use here results - print ''; + print ''; if (! empty($arrayfields['t.entity']['checked'])) { print ''; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 437361b5cf5..2de8bbb19b7 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -53,6 +53,8 @@ $type = GETPOST('type','int'); $tobuy = GETPOST('tobuy', 'int'); $salert = GETPOST('salert', 'alpha'); $mode = GETPOST('mode','alpha'); +$draftorder = GETPOST('draftorder','alpha'); + $fourn_id = GETPOST('fourn_id','int'); $fk_supplier = GETPOST('fk_supplier','int'); @@ -96,7 +98,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $snom = ''; $sal = ''; $salert = ''; + $draftorder=''; } +if($draftorder == 'on') $draftchecked = "checked"; // Create orders if ($action == 'order' && isset($_POST['valid'])) @@ -399,7 +403,7 @@ $head[1][2] = 'replenishorders'; print load_fiche_titre($langs->trans('Replenishment'), '', 'title_generic.png'); -dol_fiche_head($head, 'replenish', '', 0, ''); +dol_fiche_head($head, 'replenish', '', -1, ''); print $langs->trans("ReplenishmentStatusDesc").'
    '."\n"; if ($usevirtualstock == 1) @@ -421,6 +425,7 @@ print ''; print ''; print ''; print ''; +print ''; print ''; print '
    '; print $langs->trans('Warehouse').' '.$formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1); @@ -433,10 +438,11 @@ print ''; $param = (isset($type)? '&type=' . $type : ''); -$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&salert=' . $salert; +$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&salert=' . $salert . '&draftorder='.$draftorder; $param .= '&sref=' . $sref; $param .= '&mode=' . $mode; $param .= '&fk_supplier=' . $fk_supplier; @@ -494,6 +501,23 @@ print '' ''. ''; +// Lignes des champs de filtre +print '
    '; +print ''; +print ''; +print ''; +if (!empty($conf->service->enabled) && $type == 1) print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + // Lines of title print ''; print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); @@ -508,23 +532,6 @@ print_liste_field_titre($langs->trans('StockToBuy'), $_SERVER["PHP_SELF"], '', $ print_liste_field_titre($langs->trans('SupplierRef'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); print "\n"; -// Lignes des champs de filtre -print ''; -print ''; -print ''; -print ''; -if (!empty($conf->service->enabled) && $type == 1) print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; - $prod = new Product($db); $var = True; @@ -567,7 +574,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) } // Force call prod->load_stats_xxx to choose status to count (otherwise it is loaded by load_stock function) - $result=$prod->load_stats_commande_fournisseur(0,'1,2,3,4'); + if(isset($draftchecked)){ + $result=$prod->load_stats_commande_fournisseur(0,'0,1,2,3,4'); + }else { + $result=$prod->load_stats_commande_fournisseur(0,'1,2,3,4'); + } + $result=$prod->load_stats_reception(0,'4'); //print $prod->stats_commande_fournisseur['qty'].'
    '."\n"; @@ -600,7 +612,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) $picto = img_picto($langs->trans("NoPendingReceptionOnSupplierOrder"), './img/no', '', 1); } - print ''; + print ''; // Select field //print ''; @@ -654,11 +666,12 @@ print '
    '; + if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + $searchclass=''; + if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; + print ''; + } + print ''; + print ''; + print ''; + print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); + print ''; + $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + print $searchpitco; + print '
    '; - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select'))) - { - $crit=$val; - $tmpkey=preg_replace('/search_options_/','',$key); - $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; - if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; - print ''; - } - print ''; - print ''; - print ''; - print $form->selectarray('search_statut', array('-1'=>'','0'=>$langs->trans('Disabled'),'1'=>$langs->trans('Enabled')),$search_statut); - print ''; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); - print $searchpitco; - print '
    '.$obj->entity.'
        ' . $langs->trans('AlertOnly') . ' ' . $langs->trans('Draft') . '  '; +$searchpitco=$form->showFilterAndCheckAddButtons(0); +print $searchpitco; +print '
        ' . $langs->trans('AlertOnly') . '   '; -$searchpitco=$form->showFilterAndCheckAddButtons(0); -print $searchpitco; -print '
    '; if ($num > $conf->liste_limit) { - if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) + if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { $filters = '&sref=' . $sref . '&snom=' . $snom; $filters .= '&sall=' . $sall; $filters .= '&salert=' . $salert; + $filters .= '&draftorder=' . $draftorder; $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; @@ -670,6 +683,7 @@ if ($num > $conf->liste_limit) $filters .= '&fourn_id=' . $fourn_id; $filters .= (isset($type)? '&type=' . $type : ''); $filters .= '&salert=' . $salert; + $filters .= '&draftorder=' . $draftorder; $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 4986d7c524d..607e28165ed 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -97,7 +97,7 @@ $head[1][0] = DOL_URL_ROOT.'/product/stock/replenishorders.php'; $head[1][1] = $texte; $head[1][2] = 'replenishorders'; -dol_fiche_head($head, 'replenishorders', '', 0, ''); +dol_fiche_head($head, 'replenishorders', '', -1, ''); $commandestatic = new CommandeFournisseur($db); @@ -160,71 +160,9 @@ if ($resql) print ''; - print ''. - ''; - print_liste_field_titre( - $langs->trans('Ref'), - $_SERVER['PHP_SELF'], - 'cf.ref', - '', - '', - '', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans('Company'), - $_SERVER['PHP_SELF'], - 's.nom', - '', - '', - '', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans('Author'), - $_SERVER['PHP_SELF'], - 'u.login', - '', - '', - '', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans('AmountTTC'), - $_SERVER['PHP_SELF'], - 'cf.total_ttc', - '', - '', - '', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans('OrderCreation'), - $_SERVER['PHP_SELF'], - 'cf.date_creation', - '', - '', - '', - $sortfield, - $sortorder - ); - print_liste_field_titre( - $langs->trans('Status'), - $_SERVER['PHP_SELF'], - 'cf.fk_statut', - '', - '', - 'align="right"', - $sortfield, - $sortorder - ); - print ''. + print '
    '; - ''. + print ''. ''. @@ -246,20 +184,81 @@ if ($resql) ''. ''; - $var = true; + print ''; + print_liste_field_titre( + $langs->trans('Ref'), + $_SERVER['PHP_SELF'], + 'cf.ref', + '', + '', + '', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('Company'), + $_SERVER['PHP_SELF'], + 's.nom', + '', + '', + '', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('Author'), + $_SERVER['PHP_SELF'], + 'u.login', + '', + '', + '', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('AmountTTC'), + $_SERVER['PHP_SELF'], + 'cf.total_ttc', + '', + '', + '', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('OrderCreation'), + $_SERVER['PHP_SELF'], + 'cf.date_creation', + '', + '', + '', + $sortfield, + $sortorder + ); + print_liste_field_titre( + $langs->trans('Status'), + $_SERVER['PHP_SELF'], + 'cf.fk_statut', + '', + '', + 'align="right"', + $sortfield, + $sortorder + ); + print ''; + $userstatic = new User($db); while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object($resql); - $var = !$var; $showline = dolDispatchToDo($obj->rowid) && (!$sproduct || in_array($sproduct, getProducts($obj->rowid))); if ($showline) { $href = DOL_URL_ROOT . '/fourn/commande/card.php?id=' . $obj->rowid; - print ''. + print ''. // Ref ''; @@ -2309,7 +2346,7 @@ else if (! empty($conf->adherent->enabled)) { $langs->load("members"); - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index d758d9ac3f4..de50799e430 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -318,7 +318,7 @@ class Contacts extends DolibarrApi */ function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { $categories = new Categories(); - return $categories->getListForItem('contact', $sortfield, $sortorder, $limit, $page, $id); + return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'contact', $id); } /** diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index cedd30c5209..f8e96d82e47 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -267,7 +267,7 @@ class Thirdparties extends DolibarrApi */ function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { $categories = new Categories(); - return $categories->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $id); + return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $id); } /** diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 7d1afae725d..652cd8d5d7e 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -69,8 +69,8 @@ class CompanyBankAccount extends Account */ function create(User $user = null, $notrigger=0) { - $now=dol_now(); - + $now = dol_now(); + $error = 0; // Correct default_rib to be sure to have always one default $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".$this->socid." AND default_rib = 1"; $result = $this->db->query($sql); @@ -89,7 +89,29 @@ class CompanyBankAccount extends Account if ($this->db->affected_rows($resql)) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib"); - return 1; + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('COMPANY_RIB_CREATE',$user); + if ($result < 0) $error++; + // End call triggers + + if(! $error ) + { + return 1; + } + else + { + return 0; + } + + } + else + { + return 1; + } + } } else @@ -108,7 +130,9 @@ class CompanyBankAccount extends Account */ function update(User $user = null, $notrigger = 0) { - global $conf; + global $conf; + $error = 0; + if (! $this->id) { @@ -145,12 +169,33 @@ class CompanyBankAccount extends Account $result = $this->db->query($sql); if ($result) { - return 1; + + + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('COMPANY_RIB_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + if(! $error ) + { + return 1; + } + else + { + return -1; + } + } + else + { + return 1; + } + } else { dol_print_error($this->db); - return 0; + return -1; } } @@ -213,24 +258,49 @@ class CompanyBankAccount extends Account /** * Delete a rib from database * - * @param User $user User deleting - * @return int <0 if KO, >0 if OK + * @param User $user User deleting + * @param int $notrigger 1=Disable triggers + * @return int <0 if KO, >0 if OK */ - function delete(User $user = null) + function delete(User $user = null, $notrigger=0) { global $conf; + + $error = 0; + + dol_syslog(get_class($this) . "::delete ".$this->id, LOG_DEBUG); + + $this->db->begin(); + + if (! $error && ! $notrigger) + { + // Call trigger + $result=$this->call_trigger('COMPANY_RIB_DELETE',$user); + if ($result < 0) $error++; + // End call triggers + } - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib"; - $sql.= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $result = $this->db->query($sql); - if ($result) { + if (! $error) + { + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "societe_rib"; + $sql .= " WHERE rowid = " . $this->id; + + if (! $this->db->query($sql)) + { + $error++; + $this->errors[]=$this->db->lasterror(); + } + } + + if (! $error) + { + $this->db->commit(); return 1; } - else { - dol_print_error($this->db); - return -1; + else + { + $this->db->rollback(); + return -1*$error; } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5aac6fdec85..74aef09e7a9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1559,7 +1559,7 @@ class Societe extends CommonObject $note=trim($note); if (! $note) { - $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("Note")); + $this->error=$langs->trans("ErrorFieldRequired",$langs->trans("NoteReason")); return -2; } @@ -1838,23 +1838,41 @@ class Societe extends CommonObject $name=$this->name?$this->name:$this->nom; - if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) - { - if (($this->client) && (! empty ( $this->code_client ))) { - $code = $this->code_client . ' - '; - } - if (($this->fournisseur) && (! empty ( $this->code_fournisseur ))) { - $code .= $this->code_fournisseur . ' - '; - } - $name =$code.' '.$name; - } + if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) + { + if (($this->client) && (! empty ( $this->code_client )) + && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 + || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 + ) + ) + $code = $this->code_client . ' - '; - if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; + if (($this->fournisseur) && (! empty ( $this->code_fournisseur )) + && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 + || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 + ) + ) + $code .= $this->code_fournisseur . ' - '; + + if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1) + $name =$code.' '.$name; + else + $name =$code; + } + + if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; $result=''; $label=''; $linkstart=''; $linkend=''; - $label.= '
    '; + if (! empty($this->logo) && class_exists('Form')) + { + $label.= '
    '; + $label.= Form::showphoto('societe', $this, 80, 0, 0, 'photowithmargin', 'mini'); + $label.= '
    '; + } + + $label.= '
    '; if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') { @@ -1891,7 +1909,7 @@ class Societe extends CommonObject if (empty($linkstart)) { $label.= '' . $langs->trans("ShowCompany") . ''; - $linkstart = '' . $langs->trans('SupplierAccountancyCode') . ': '. $this->code_compta_fournisseur; - if (! empty($this->logo) && class_exists('Form')) - { - $label.= '
    '; - $label.= Form::showphoto('societe', $this, 80, 0, 0, 'photowithmargin', 'mini'); - $label.= '
    '; - } $label.= '
    '; // Add type of canvas diff --git a/htdocs/societe/commerciaux.php b/htdocs/societe/commerciaux.php index dd8802779b8..89bb836d119 100644 --- a/htdocs/societe/commerciaux.php +++ b/htdocs/societe/commerciaux.php @@ -112,7 +112,7 @@ if (! empty($socid)) $head=societe_prepare_head2($object); - dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'salesrepresentative', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; @@ -267,7 +267,7 @@ if (! empty($socid)) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; + print "
    "; + + print ''; print ''; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index d83822c2cd7..a43db2da318 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -98,11 +98,11 @@ if ($object->id) $form=new Form($db); - dol_fiche_head($head, 'document', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company'); // 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/societe/index.php b/htdocs/societe/index.php index 5fa0fd37210..c3508bd0cef 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -219,8 +219,8 @@ if (! empty($conf->categorie->enabled) && ! empty($conf->global->CATEGORY_GRAPHS while ($i < $num) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; $total+=$obj->nb; $i++; } @@ -281,8 +281,8 @@ if ($result) { $objp = $db->fetch_object($result); - $var=!$var; - print ""; + + print ''; // Name print ''; print ''; } @@ -281,7 +288,7 @@ if ($result > 0) $sql.= " WHERE a.rowid = n.fk_action"; $sql.= " AND c.rowid = n.fk_contact"; $sql.= " AND c.fk_soc = ".$object->id; - + $resql=$db->query($sql); if ($resql) { @@ -294,8 +301,7 @@ if ($result > 0) // List of active notifications print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','',''); - $var=true; - + // Line with titles print '
    '. ''. '
    '. ''. diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 757407a6692..28fd3dfadea 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -21,12 +21,14 @@ element == 'product') $productref = $object->ref; $langs->load("productbatch"); - if (empty($id)) $id = $object->id; + + if (empty($id)) $id = $object->id; print ' + + diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 099fb4f7d2b..1078e8bb94a 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -93,7 +93,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/resource/element_resource.php b/htdocs/resource/element_resource.php index a09e9d3db39..a886dcf475b 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -39,6 +39,7 @@ if (! empty($conf->projet->enabled)) { // Load traductions files requiredby by page $langs->load("resource"); $langs->load("other"); +$langs->load("interventions"); /* $sortorder = GETPOST('sortorder','alpha'); @@ -197,7 +198,7 @@ else $head=actions_prepare_head($act); - dol_fiche_head($head, 'resources', $langs->trans("Action"),0,'action'); + dol_fiche_head($head, 'resources', $langs->trans("Action"), -1, 'action'); $linkback =img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); $linkback.= ''.$langs->trans("BackToList").''; @@ -240,8 +241,10 @@ else dol_banner_tab($act, 'element_id', $linkback, ($user->societe_id?0:1), 'id', 'ref', $morehtmlref, '&element='.$element, 0, '', ''); + print '
    '; + print '
    '; - + print ''; // Type @@ -311,6 +314,8 @@ else print '
    '; + print '
    '; + dol_fiche_end(); } } @@ -327,7 +332,7 @@ else require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; $head = societe_prepare_head($socstatic); - dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), 0, 'company'); + dol_fiche_head($head, 'resources', $langs->trans("ThirdParty"), -1, 'company'); dol_banner_tab($socstatic, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '&element='.$element); @@ -363,7 +368,7 @@ else if (is_object($fichinter)) { $head=fichinter_prepare_head($fichinter); - dol_fiche_head($head, 'resource', $langs->trans("InterventionCard"),0,'intervention'); + dol_fiche_head($head, 'resource', $langs->trans("InterventionCard"), -1, 'intervention'); // Intervention card $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 2c97b68f7ed..559dbce4b06 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -194,25 +194,7 @@ $moreforfilter = ''; print '
    '; print ''."\n"; -print ''; -if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); -if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$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); - } - } -} -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); -print "\n"; - -print ''; +print ''; if (! empty($arrayfields['t.ref']['checked'])) { print ''; print "\n"; +print ''; +if (! empty($arrayfields['t.ref']['checked'])) print_liste_field_titre($arrayfields['t.ref']['label'],$_SERVER["PHP_SELF"],"t.ref","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['ty.label']['checked'])) print_liste_field_titre($arrayfields['ty.label']['label'],$_SERVER["PHP_SELF"],"t.code","",$param,"",$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); + } + } +} +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + + if ($ret) { foreach ($object->lines as $resource) { - $var=!$var; + $style=''; if ($resource->id == GETPOST('lineid')) $style='style="background: orange;"'; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 8e7fe40859b..517672d14ed 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -354,7 +354,7 @@ foreach ($dirsociete as $dirroot) if ($modCodeTiers->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; $var = !$var; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -431,7 +431,7 @@ foreach ($dirsociete as $dirroot) $modCodeCompta = new $file; $var = !$var; - print ''; + print ''; print ''; @@ -534,7 +534,7 @@ foreach ($dirsociete as $dirroot) if ($modulequalified) { $var = !$var; - print ''; + print ''; print ''; @@ -722,8 +722,8 @@ print ''."\n"; print ''."\n"; // Utilisation formulaire Ajax sur choix societe -$var=!$var; -print ""; + +print ''; print ''; if (! $conf->use_javascript_ajax) { @@ -746,8 +746,8 @@ else } print ''; -$var=!$var; -print ""; + +print ''; print ''; if (! $conf->use_javascript_ajax) { @@ -771,8 +771,8 @@ else print ''; -$var=!$var; -print ""; + +print ''; print ''; print ''; print ''; print ''; -$var=!$var; -print ""; + +print ''; print ''; print ''; print ''; /* // COMPANY_USE_SEARCH_TO_SELECT -$var=!$var; -print ""; + +print ''; print ''; if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) { diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 644cda92bc4..e1dc1c12671 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -58,7 +58,7 @@ if ($page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortfield) $sortfield='a.datep, a.id'; +if (! $sortfield) $sortfield='a.datep,a.id'; if (! $sortorder) $sortorder='DESC'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array @@ -118,7 +118,7 @@ if ($socid > 0) if (! empty($conf->notification->enabled)) $langs->load("mails"); $head = societe_prepare_head($object); - dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'agenda', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; @@ -190,7 +190,7 @@ if ($socid > 0) $filters=array(); $filters['search_agenda_label']=$search_agenda_label; - // TODO Replace this with smae code then into listactions.php + // TODO Replace this with same code than into listactions.php show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder); } } diff --git a/htdocs/societe/ajax/company.php b/htdocs/societe/ajax/company.php index d2a244f9444..32f57f73c25 100644 --- a/htdocs/societe/ajax/company.php +++ b/htdocs/societe/ajax/company.php @@ -18,8 +18,8 @@ */ /** - * \file htdocs/product/ajax/company.php - * \brief File to return Ajax response on product list request + * \file htdocs/societe/ajax/company.php + * \brief File to return Ajax response on thirdparty list request */ if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal @@ -33,15 +33,11 @@ if (empty($_GET['keysearch']) && ! defined('NOREQUIREHTML')) define('NOREQUIREH require '../../main.inc.php'; $htmlname=GETPOST('htmlname','alpha'); -$socid=GETPOST('socid','int'); -$type=GETPOST('type','int'); -$mode=GETPOST('mode','int'); -$status=((GETPOST('status','int') >= 0) ? GETPOST('status','int') : -1); +$filter=GETPOST('filter','alpha'); $outjson=(GETPOST('outjson','int') ? GETPOST('outjson','int') : 0); -$price_level=GETPOST('price_level','int'); $action=GETPOST('action', 'alpha'); $id=GETPOST('id', 'int'); -$price_by_qty_rowid=GETPOST('pbq', 'int'); + /* * View @@ -49,7 +45,7 @@ $price_by_qty_rowid=GETPOST('pbq', 'int'); //print ''."\n"; -dol_syslog(join(',',$_GET)); +dol_syslog(join(',', $_GET)); //print_r($_GET); if (! empty($action) && $action == 'fetch' && ! empty($id)) @@ -63,8 +59,11 @@ if (! empty($action) && $action == 'fetch' && ! empty($id)) if ($ret > 0) { $outname=$object->name; - - $outjson = array('name'=>$outname); + $outlabel = ''; + $outdesc = ''; + $outtype = $object->type; + + $outjson = array('ref' => $outref,'name' => $outname,'desc' => $outdesc,'type' => $outtype); } echo json_encode($outjson); @@ -73,7 +72,7 @@ else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; - $langs->load("products"); + $langs->load("companies"); $langs->load("main"); top_httphead(); @@ -90,14 +89,7 @@ else $searchkey=(GETPOST($id)?GETPOST($id):(GETPOST($htmlname)?GETPOST($htmlname):'')); $form = new Form($db); - if (empty($mode) || $mode == 'customer') - { - $arrayresult=$form->select_company_html($socid,$htmlname,"client IN (1,3)",0,0,0,null,$searchkey,$outjson); - } - elseif ($mode == 'supplier') - { - $arrayresult=$form->select_company_html($socid,$htmlname,"fournisseur=1",0,0,0,null,$searchkey,$outjson); - } + $arrayresult=$form->select_thirdparty_list(0,$htmlname,$filter,1,0,0,null,$searchkey,$outjson); $db->close(); diff --git a/htdocs/societe/soc.php b/htdocs/societe/card.php similarity index 97% rename from htdocs/societe/soc.php rename to htdocs/societe/card.php index 79a8d9cae94..bb043076157 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/card.php @@ -26,7 +26,7 @@ */ /** - * \file htdocs/societe/soc.php + * \file htdocs/societe/card.php * \ingroup societe * \brief Third party card page */ @@ -123,15 +123,14 @@ if (empty($reshook)) $soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin = new Societe($db); - if ($soc_origin_id < 1) + if ($soc_origin_id <= 0) { $langs->load('errors'); $langs->load('companies'); - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); + setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors'); } else { - if (!$errors && $soc_origin->fetch($soc_origin_id) < 1) { setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); @@ -140,8 +139,44 @@ if (empty($reshook)) if (!$errors) { + // TODO Move the merge function into class of object. + $db->begin(); + // Recopy some data + $object->client = $object->client | $soc_origin->client; + $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; + $listofproperties=array( + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', + 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', + 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', + 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', + 'model_pdf', 'fk_projet' + ); + foreach ($listofproperties as $property) + { + if (empty($object->$property)) $object->$property = $soc_origin->$property; + } + + // Concat some data + $listofproperties=array( + 'note_public', 'note_private' + ); + foreach ($listofproperties as $property) + { + $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); + } + + // Merge extrafields + foreach ($soc_origin->array_options as $key => $val) + { + if (empty($object->array_options[$key])) $object->array_options[$key] = $val; + } + + // TODO Merge categories + $object->update($object->id, $user); + + // Move links $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', 'Societe' => '/societe/class/societe.class.php', @@ -159,6 +194,7 @@ if (empty($reshook)) 'Fichinter' => '/fichinter/class/fichinter.class.php', 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', 'Livraison' => '/livraison/class/livraison.class.php', 'Product' => '/product/class/product.class.php', @@ -451,6 +487,7 @@ if (empty($reshook)) if (empty($object->fournisseur)) $object->code_fournisseur=''; $result = $object->create($user); + if ($result >= 0) { if ($object->particulier) @@ -1506,7 +1543,7 @@ else if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; - dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); print '
    '; @@ -255,11 +237,30 @@ print $searchpitco; print '
    '.$modCodeTiers->name.''.$modCodeTiers->info($langs).''.$modCodeTiers->getExample($langs).'
    '.$modCodeCompta->name."\n"; print $modCodeCompta->info($langs); print '
    '; + print '
    '; print $module->name; print "\n"; if (method_exists($module,'info')) print $module->info($langs); @@ -646,7 +646,7 @@ while ($i < $nbofloop) { $var = !$var; - print '
    '.$profid[$i][0]."\n"; print $profid[$i][1]; print ''.$langs->trans("Value").' 
    '.$form->textwithpicto($langs->trans("DelaiedFullListToSelectCompany"),$langs->trans('UseSearchToSelectCompanyTooltip'),1).'
    '.$form->textwithpicto($langs->trans("DelaiedFullListToSelectContact"),$langs->trans('UseSearchToSelectContactTooltip'),1).'
    '.$langs->trans("AddRefInList").' '; @@ -791,8 +791,8 @@ print '
    '.$langs->trans("AskForPreferredShippingMethod").' '; @@ -813,8 +813,8 @@ print '
    '.$langs->trans("HideClosedThirdpartyComboBox").'
    '; @@ -1514,13 +1551,13 @@ else // Ref/ID if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { - print ''; } // Name - print ''; + print ''; print ''; // Alias names (commercial, trademark or alias names) @@ -1633,7 +1670,7 @@ else // Zip / Town print ''; @@ -1921,7 +1958,7 @@ else $head = societe_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company'); // Confirm delete third party if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) @@ -2244,7 +2281,7 @@ else print '
    '.$langs->trans("ID").''; + print '
    '.$langs->trans("ID").''; print $object->ref; print '
    '.fieldLabel('ThirdPartyName','name',1).'
    '.fieldLabel('ThirdPartyName','name',1).'
    '.fieldLabel('Zip','zipcode').''; - print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); + print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth50onsmartphone'); print ''.fieldLabel('Town','town').''; print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
    '; print $langs->trans('IncotermLabel'); print ''; - if ($user->rights->societe->creer) print ''.img_edit('',1).''; + if ($user->rights->societe->creer) print ''.img_edit('',1).''; else print ' '; print '
    '; print '
    '.$langs->trans("LinkedToDolibarrMember").'
    '.$langs->trans("LinkedToDolibarrMember").''; $adh=new Adherent($db); $result=$adh->fetch('','',$object->id); @@ -2320,7 +2357,7 @@ else } else { - print $langs->trans("ThirdpartyNotLinkedToMember"); + print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } print '
    "; $tmpuser->id=$obj->rowid; $tmpuser->firstname=$obj->firstname; diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index fb154790210..d0f92bb9c14 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -112,7 +112,7 @@ if (empty($socid)) } $head = societe_prepare_head($object); -dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company'); +dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; @@ -407,8 +407,8 @@ if ($sql_select) if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; - $var=!$var; - print "
    '; print $documentstatic->getNomUrl(1); print '
    '.$obj->label.''.$obj->nb.'
    '.$obj->label.''.$obj->nb.'
    '; $thirdparty_static->id=$objp->rowid; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index cc5ab706fb0..1799fadf9bd 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -35,12 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; -$langs->load("companies"); -$langs->load("commercial"); -$langs->load("customers"); -$langs->load("suppliers"); -$langs->load("bills"); -$langs->load("compta"); +$langs->loadLangs(array("companies", "commercial", "customers", "suppliers", "bills", "compta", "commercial")); + +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); // Security check $socid = GETPOST('socid','int'); @@ -80,7 +81,8 @@ $search_stcomm=GETPOST('search_stcomm','int'); $type=GETPOST('type'); $optioncss=GETPOST('optioncss','alpha'); $mode=GETPOST("mode"); -$action=GETPOST('action'); + +$diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id; $limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield=GETPOST("sortfield",'alpha'); @@ -88,7 +90,7 @@ $sortorder=GETPOST("sortorder",'alpha'); $page=GETPOST("page",'int'); if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="s.nom"; -if (empty($page) || $page == -1) { $page = 0 ; } +if (empty($page) || $page == -1) { $page = 0; } $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -147,32 +149,32 @@ $checkedprofid6=0; $checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0); $checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0); $arrayfields=array( - 's.nom'=>array('label'=>$langs->trans("Company"), 'checked'=>1), - 's.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), - 's.code_client'=>array('label'=>$langs->trans("CustomerCodeShort"), 'checked'=>$checkedcustomercode), - 's.code_fournisseur'=>array('label'=>$langs->trans("SupplierCodeShort"), 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), - 's.code_compta'=>array('label'=>$langs->trans("CustomerAccountancyCodeShort"), 'checked'=>$checkedcustomeraccountcode), - 's.code_compta_fournisseur'=>array('label'=>$langs->trans("SupplierAccountancyCodeShort"), 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), - 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), - 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), - 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0), - 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), - 's.email'=>array('label'=>$langs->trans("Email"), 'checked'=>0), - 's.url'=>array('label'=>$langs->trans("Url"), 'checked'=>0), - 's.phone'=>array('label'=>$langs->trans("Phone"), 'checked'=>1), - 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), - 's.siren'=>array('label'=>$langs->trans("ProfId1Short"), 'checked'=>$checkedprofid1), - 's.siret'=>array('label'=>$langs->trans("ProfId2Short"), 'checked'=>$checkedprofid2), - 's.ape'=>array('label'=>$langs->trans("ProfId3Short"), 'checked'=>$checkedprofid3), - 's.idprof4'=>array('label'=>$langs->trans("ProfId4Short"), 'checked'=>$checkedprofid4), - 's.idprof5'=>array('label'=>$langs->trans("ProfId5Short"), 'checked'=>$checkedprofid5), - 's.idprof6'=>array('label'=>$langs->trans("ProfId6Short"), 'checked'=>$checkedprofid6), + 's.nom'=>array('label'=>"Company", 'checked'=>1), + 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), + 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), + 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), + 's.town'=>array('label'=>"Town", 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'checked'=>1), + 'state.nom'=>array('label'=>"State", 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), + 's.email'=>array('label'=>"Email", 'checked'=>0), + 's.url'=>array('label'=>"Url", 'checked'=>0), + 's.phone'=>array('label'=>"Phone", 'checked'=>1), + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), + 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), + 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), + 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), + 's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4), + 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), + 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), - 's.fk_prospectlevel'=>array('label'=>$langs->trans("ProspectLevelShort"), 'checked'=>$checkprospectlevel), - 's.fk_stcomm'=>array('label'=>$langs->trans("StatusProsp"), 'checked'=>$checkstcomm), - 's.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), - 's.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 's.status'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), + 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), + 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), + 's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), + 's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), ); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -230,9 +232,18 @@ if (empty($reshook)) $search_stcomm=''; $search_level_from=''; $search_level_to=''; + $toselect=''; $search_array_options=array(); } + // Mass actions + $objectclass='Societe'; + $objectlabel='ThirdParty'; + $permtoread = $user->rights->societe->lire; + $permtodelete = $user->rights->societe->supprimer; + $uploaddir = $conf->societe->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + if ($action == 'setstcomm') { $object = new Client($db); @@ -457,11 +468,13 @@ 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) && $search_all && $action != 'list') { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/societe/soc.php?socid='.$id); + header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); exit; } @@ -513,6 +526,16 @@ if (GETPOST('delsoc')) setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); } +// List of mass actions available +$arrayofmassactions = array( +// 'presend'=>$langs->trans("SendByMail"), +// 'builddoc'=>$langs->trans("PDFMerge"), +); +//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); +if ($user->rights->societe->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete"); +if ($massaction == 'presend') $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + print ''; if ($optioncss != '') print ''; print ''; @@ -520,7 +543,7 @@ print ''; print ''; -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); $langs->load("other"); $textprofid=array(); @@ -586,60 +609,15 @@ 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); if (empty($arrayfields['customerorsupplier']['checked'])) print ''; print '
    '; print ''."\n"; -print ''; -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.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); -if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$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['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer -if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); -if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$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['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); -print "\n"; - // Fields title search -print ''; +print ''; if (! empty($arrayfields['s.nom']['checked'])) { print ''; print "\n"; -$var=True; +print ''; +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.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$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['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$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['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + + $i = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - $var=!$var; $companystatic->id=$obj->rowid; $companystatic->name=$obj->name; @@ -908,13 +931,13 @@ while ($i < min($num, $limit)) $companystatic->code_compta_client=$obj->code_compta; $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; - $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; - $companystatic->name_alias=$obj->name_alias; + $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; + $companystatic->name_alias=$obj->name_alias; - print ""; + print ''; if (! empty($arrayfields['s.nom']['checked'])) { - print "\n"; } @@ -1101,9 +1124,18 @@ while ($i < min($num, $limit)) { print ''; } - // Action column - print ''; + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + print ''."\n"; $i++; } diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 9ca7f1fcd2a..c713250a0e2 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -71,7 +71,7 @@ if ($id > 0) $head = societe_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'note', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index bc754d8e9a4..d547d9e57dc 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -44,15 +44,16 @@ $actionid=GETPOST('actionid'); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'societe','',''); -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield=GETPOST("sortfield",'alpha'); +$sortorder=GETPOST("sortorder",'alpha'); +$page=GETPOST("page",'int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="n.daten"; +if (empty($page) || $page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; $now=dol_now(); @@ -153,7 +154,7 @@ if ($result > 0) $head = societe_prepare_head($object); - dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"),0,'company'); + dol_fiche_head($head, 'notify', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; @@ -188,12 +189,18 @@ if ($result > 0) print ''; } - print ''; + /*print ''; // Notification for this thirdparty print ''; + $tmparray = $notify->getNotificationsArray('', $object->id, null, 0, array('thirdparty')); + foreach($tmparray as $tmpkey => $tmpval) + { + if (! empty($tmpkey)) $nbofrecipientemails++; + } + print $nbofrecipientemails; + print '';*/ + print '
    '; @@ -883,18 +861,63 @@ if (! empty($arrayfields['s.status']['checked'])) } // Action column print ''; -$searchpitco=$form->showFilterAndCheckAddButtons(0); +$searchpitco=$form->showFilterButtons(); print $searchpitco; print '
    "; + print ''; print $companystatic->getNomUrl(1,'',100); print "'.$companystatic->getLibStatut(3).''; + if ($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($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
    '.$langs->trans("NbOfActiveNotifications").'
    '.$langs->trans("NbOfActiveNotifications").''; + $nbofrecipientemails=0; $notify=new Notify($db); - $tmparray = $notify->getNotificationsArray('', $object->id); - print count($tmparray); - print '
    '; print '
    '; @@ -244,7 +251,7 @@ if ($result > 0) $label=($langs->trans("Notify_".$managedeventfornotification['code'])!="Notify_".$managedeventfornotification['code']?$langs->trans("Notify_".$managedeventfornotification['code']):$managedeventfornotification['label']); $actions[$managedeventfornotification['rowid']]=$label; } - print '
    '; + print '
    '; print $form->selectarray("contactid", $listofemails, '', 0, 0, 0, '', 0, 0, 0, '', 'maxwidthonsmartphone'); print ''; @@ -259,7 +266,7 @@ if ($result > 0) } else { - print '
    '; + print '
    '; print $langs->trans("YouMustCreateContactFirst"); print '
    '; print ''; @@ -316,14 +322,12 @@ if ($result > 0) while ($i < $num) { - $var = !$var; - $obj = $db->fetch_object($resql); $contactstatic->id=$obj->contactid; $contactstatic->lastname=$obj->lastname; $contactstatic->firstname=$obj->firstname; - print ''; print ''; }*/ - if ($user->admin) + + /*if ($user->admin) { $var = ! $var; - print ''; - } + }*/ print '
    '.$contactstatic->getNomUrl(1); + print '
    '.$contactstatic->getNomUrl(1); if ($obj->type == 'email') { if (isValidEmail($obj->email)) @@ -358,7 +362,7 @@ if ($result > 0) { if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; $var = ! $var; - print '
    '; + print '
    '; $listtmp=explode(',',$val); $first=1; foreach($listtmp as $keyemail => $valemail) @@ -394,13 +398,14 @@ if ($result > 0) print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
    '; + print '
    '; print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; print '
    '; @@ -419,6 +424,16 @@ if ($result > 0) $sql.= " AND n.fk_soc = ".$object->id; $sql.= $db->order($sortfield, $sortorder); + // Count total nb of records + $nbtotalofrecords = ''; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } + + $sql.= $db->plimit($limit+1, $offset); + $resql=$db->query($sql); if ($resql) { @@ -429,9 +444,20 @@ if ($result > 0) dol_print_error($db); } - // List of notifications done - print load_fiche_titre($langs->trans("ListOfNotificationsDone").' ('.$num.')','',''); - $var=true; + $param='&socid='.$object->id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + // List of active notifications + print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); // Line with titles print ''; @@ -451,11 +477,9 @@ if ($result > 0) while ($i < $num) { - $var = !$var; - $obj = $db->fetch_object($resql); - print '
    '; + print '
    '; if ($obj->id > 0) { $contactstatic->id=$obj->id; @@ -495,6 +519,8 @@ if ($result > 0) } print '
    '; + + print ''; } else dol_print_error('','RecordNotFound'); diff --git a/htdocs/societe/notify/index.php b/htdocs/societe/notify/index.php index a1042087faf..02125e8fad8 100644 --- a/htdocs/societe/notify/index.php +++ b/htdocs/societe/notify/index.php @@ -90,9 +90,9 @@ if ($result) { $obj = $db->fetch_object($result); - $var=!$var; + - print "
    socid."\">".$obj->name."".dolGetFirstLastname($obj->firstname, $obj->lastname)."".$obj->titre."
    '; print ''; - print ''; + print ''; print ''; - print ''; + print ''; // Show fields of bank account foreach($account->getFieldsToShow(1) as $val) @@ -407,24 +409,24 @@ if ($socid && $action != 'edit' && $action != "create") } print ''; - print ''; + print ''; print ''; } - print '\n"; - print '\n"; - print '\n"; print '
    '.$langs->trans("LabelRIB").''.$account->label.'
    '.$account->label.'
    '.$langs->trans("BankName").''.$account->bank.'
    '.$account->bank.'
    '.$langs->trans($val).''.$content.''.$content.'
    '.$langs->trans("BankAccountDomiciliation").''; + print '
    '.$langs->trans("BankAccountDomiciliation").''; print $account->domiciliation; print "
    '.$langs->trans("BankAccountOwner").''; + print '
    '.$langs->trans("BankAccountOwner").''; print $account->proprio; print "
    '.$langs->trans("BankAccountOwnerAddress").''; + print '
    '.$langs->trans("BankAccountOwnerAddress").''; print $account->owner_address; print "
    '; - + print ''; print '
    '; @@ -458,7 +460,7 @@ if ($socid && $action != 'edit' && $action != "create") foreach ($rib_list as $rib) { - print "
    '.$rib->label.'
    '.$langs->trans("NoBANRecord").'
    '.$langs->trans("NoBANRecord").'
    '; @@ -800,7 +802,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - print '
    '; + print '
    '; print '
    '; print ''; @@ -843,7 +845,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) } print '"; @@ -852,7 +854,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print "\n"; print '"; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 876c383031a..2bda75867dc 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -259,8 +259,8 @@ if ($id > 0 || ! empty($ref)) $companyname=$objp->company; - $var=!$var; - print ""; + + print ''; // Ref print "'; } @@ -1773,7 +1800,6 @@ if ($action == 'create') print ''; } - print "
    \n"; if ($action != 'presend') { @@ -1881,7 +1907,7 @@ if ($action == 'create') $formmail->withtocc = $liste; $formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false); - $formmail->withtopic = $outputlangs->trans('SendAskRef', '__ASKREF__'); + $formmail->withtopic = $outputlangs->trans('SendAskRef', '__SUPPLIERPROPREF__'); $formmail->withfile = 2; $formmail->withbody = 1; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 5d2d5aad783..65efb97f824 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -355,11 +355,12 @@ class SupplierProposal extends CommonObject * @param string $label ??? * @param array $array_option extrafields array * @param string $ref_fourn Supplier price reference + * @param int $fk_unit Id of the unit to use. * @return int >0 if OK, <0 if KO * * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='') + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$array_option=0, $ref_fourn='', $fk_unit='') { global $mysoc; @@ -460,6 +461,7 @@ class SupplierProposal extends CommonObject $this->line->product_type=$type; $this->line->special_code=$special_code; $this->line->fk_parent_line=$fk_parent_line; + $this->line->fk_unit=$fk_unit; $this->line->ref_fourn = $this->db->escape($ref_fourn); @@ -546,9 +548,10 @@ class SupplierProposal extends CommonObject * @param int $type 0/1=Product/service * @param array $array_option extrafields array * @param string $ref_fourn Supplier price reference + * @param int $fk_unit Id of the unit to use. * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='') + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $array_option=0, $ref_fourn='', $fk_unit='') { global $conf,$user,$langs, $mysoc; @@ -634,7 +637,8 @@ class SupplierProposal extends CommonObject $this->line->special_code = $special_code; $this->line->fk_parent_line = $fk_parent_line; $this->line->skip_update_total = $skip_update_total; - $this->line->ref_fourn = $ref_fourn; + $this->line->ref_fourn = $ref_fourn; + $this->line->fk_unit = $fk_unit; // infos marge if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) { @@ -1195,7 +1199,7 @@ class SupplierProposal extends CommonObject $sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,"; $sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,'; $sql.= ' d.ref_fourn as ref_produit_fourn,'; - $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; + $sql.= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc, d.fk_unit'; $sql.= " FROM ".MAIN_DB_PREFIX."supplier_proposaldet as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid"; $sql.= " WHERE d.fk_supplier_proposal = ".$this->id; @@ -1261,6 +1265,7 @@ class SupplierProposal extends CommonObject $line->multicurrency_total_ht = $objp->multicurrency_total_ht; $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $line->fk_unit = $objp->fk_unit; $this->lines[$i] = $line; @@ -2138,7 +2143,7 @@ class SupplierProposal extends CommonObject $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$statut; - $response->img = img_object($langs->trans("SupplierProposals"),"propal"); + $response->img = img_object('',"propal"); // This assignment in condition is not a bug. It allows walking the results. while ($obj=$this->db->fetch_object($resql)) @@ -2429,7 +2434,7 @@ class SupplierProposal extends CommonObject $sql.= ' pt.product_type, pt.rang, pt.fk_parent_line,'; $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,'; $sql.= ' p.description as product_desc, pt.ref_fourn as ref_produit_fourn'; - $sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc'; + $sql.= ' ,pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc, pt.fk_unit'; $sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pt'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid'; $sql.= ' WHERE pt.fk_supplier_proposal = '.$this->id; @@ -2484,6 +2489,7 @@ class SupplierProposal extends CommonObject $this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht; $this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + $this->lines[$i]->fk_unit = $obj->fk_unit; $i++; } @@ -2530,6 +2536,24 @@ class SupplierProposal extends CommonObject return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id + * @param int $dest_id New thirdparty id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'supplier_proposal' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } + } @@ -2537,7 +2561,7 @@ class SupplierProposal extends CommonObject * \class SupplierProposalLine * \brief Class to manage supplier_proposal lines */ -class SupplierProposalLine extends CommonObject +class SupplierProposalLine extends CommonObjectLine { var $db; var $error; @@ -2673,7 +2697,7 @@ class SupplierProposalLine extends CommonObject $sql.= ' pd.localtax1_tx, pd.localtax2_tx, pd.total_localtax1, pd.total_localtax2,'; $sql.= ' p.ref as product_ref, p.label as product_label, p.description as product_desc,'; $sql.= ' pd.product_type, pd.ref_fourn as ref_produit_fourn,'; - $sql.= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc'; + $sql.= ' pd.fk_multicurrency, pd.multicurrency_code, pd.multicurrency_subprice, pd.multicurrency_total_ht, pd.multicurrency_total_tva, pd.multicurrency_total_ttc, pd.fk_unit'; $sql.= ' FROM '.MAIN_DB_PREFIX.'supplier_proposaldet as pd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pd.fk_product = p.rowid'; $sql.= ' WHERE pd.rowid = '.$rowid; @@ -2729,6 +2753,7 @@ class SupplierProposalLine extends CommonObject $this->multicurrency_total_ht = $objp->multicurrency_total_ht; $this->multicurrency_total_tva = $objp->multicurrency_total_tva; $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->fk_unit = $objp->fk_unit; $this->db->free($result); } @@ -2767,7 +2792,8 @@ class SupplierProposalLine extends CommonObject if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0; - + if (empty($this->fk_unit)) $this->fk_unit=0; + if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin @@ -2796,7 +2822,7 @@ class SupplierProposalLine extends CommonObject $sql.= ' info_bits, '; $sql.= ' total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_product_fournisseur_price, buy_price_ht, special_code, rang,'; $sql.= ' ref_fourn'; - $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc)'; + $sql.= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc, fk_unit)'; $sql.= " VALUES (".$this->fk_supplier_proposal.","; $sql.= " ".($this->fk_parent_line>0?"'".$this->fk_parent_line."'":"null").","; $sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").","; @@ -2829,7 +2855,8 @@ class SupplierProposalLine extends CommonObject $sql.= ", ".$this->multicurrency_total_ht; $sql.= ", ".$this->multicurrency_total_tva; $sql.= ", ".$this->multicurrency_total_ttc; - $sql.= ')'; + $sql.= ", ".$this->fk_unit; + $sql.= ')'; dol_syslog(get_class($this).'::insert', LOG_DEBUG); $resql=$this->db->query($sql); @@ -2949,7 +2976,8 @@ class SupplierProposalLine extends CommonObject if (empty($this->special_code)) $this->special_code=0; if (empty($this->fk_parent_line)) $this->fk_parent_line=0; if (empty($this->fk_fournprice)) $this->fk_fournprice=0; - + if (empty($this->fk_unit)) $this->fk_unit=0; + if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin @@ -3003,8 +3031,9 @@ class SupplierProposalLine extends CommonObject $sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht).""; $sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva).""; $sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc).""; + $sql.= " , fk_unit=".$this->fk_unit; - $sql.= " WHERE rowid = ".$this->rowid; + $sql.= " WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 2f49951c844..62ff5e0c71a 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -83,10 +83,10 @@ if ($object->id > 0) $upload_dir = $conf->supplier_proposal->dir_output.'/'.dol_sanitizeFileName($object->ref); $head = supplier_proposal_prepare_head($object); - dol_fiche_head($head, 'document', $langs->trans('CommRequest'), 0, 'supplier_proposal'); + dol_fiche_head($head, 'document', $langs->trans('CommRequest'), -1, 'supplier_proposal'); // 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/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index eec34a02987..1c16d48e086 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -68,7 +68,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; print '
    '.$langs->trans("BankAccountDomiciliation").''; - print '
    '.$langs->trans("BankAccountOwnerAddress").''; - print '
    "; diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 0c3dd0656b8..34a7ce3f4c4 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -3,7 +3,7 @@ print '
    '; print ''; diff --git a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php index ceb86d102bd..8d6d437f466 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposal_extrafields.php @@ -90,8 +90,8 @@ print "\n"; $var=True; foreach($extrafields->attribute_type as $key => $value) { - $var=!$var; - print ""; + + print ''; print "\n"; print "\n"; print "\n"; diff --git a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php index 12e5d2c23e6..2b0a22c51fa 100644 --- a/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php +++ b/htdocs/supplier_proposal/admin/supplier_proposaldet_extrafields.php @@ -94,8 +94,8 @@ print "\n"; $var=True; foreach($extrafields->attribute_type as $key => $value) { - $var=!$var; - print ""; + + print ''; print "\n"; print "\n"; print "\n"; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e02a512f327..0bac6dab14f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -354,7 +354,7 @@ if (empty($reshook)) $array_options = $lines[$i]->array_options; } - $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, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options); + $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, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->ref_fourn, $lines[$i]->fk_unit); if ($result > 0) { $lineid = $result; @@ -633,7 +633,8 @@ if (empty($reshook)) $buyingprice, $label, $array_options, - $ref_fourn + $ref_fourn, + $fk_unit ); //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; } @@ -683,7 +684,7 @@ if (empty($reshook)) $price_base_type = 'HT'; } - $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn); + $result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $array_options, $ref_fourn, $fk_unit); //$result = $object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit); } @@ -826,7 +827,8 @@ if (empty($reshook)) if (! $error) { $db->begin(); $ref_fourn = GETPOST('fourn_ref'); - $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn); + $fk_unit = GETPOST('units'); + $result = $object->updateline(GETPOST('lineid'), $pu_ht, GETPOST('qty'), GETPOST('remise_percent'), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $array_options, $ref_fourn, $fk_unit); if ($result >= 0) { $db->commit(); @@ -1040,6 +1042,17 @@ if ($action == 'create') $objectsrc->fetch_optionals($originid); $object->array_options = $objectsrc->array_options; + if (!empty($conf->multicurrency->enabled)) + { + if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; + if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; + } + } + else + { + $cond_reglement_id = $soc->cond_reglement_supplier_id; + $mode_reglement_id = $soc->mode_reglement_supplier_id; + if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } $object = new SupplierProposal($db); @@ -1076,12 +1089,12 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment print ''; // Bank Account @@ -1149,7 +1162,6 @@ if ($action == 'create') print ''; print ''; print ''; } @@ -1196,6 +1208,13 @@ if ($action == 'create') print '"; } print '"; + + if (!empty($conf->multicurrency->enabled)) + { + print ''; + print '"; + print '"; + } } print "
    '; print $langs->trans('SalesRepresentatives'); - print ''; + print ''; if ($user->rights->societe->creer && $user->rights->societe->client->voir) print ''.img_edit('',1).''; else @@ -37,5 +37,5 @@ if ($i < $nbofsalesrepresentative) print ', '; } } - else print $langs->trans("NoSalesRepresentativeAffected"); + else print ''.$langs->trans("NoSalesRepresentativeAffected").''; print '
    ".$extrafields->attribute_pos[$key]."".$extrafields->attribute_label[$key]."".$key."
    ".$extrafields->attribute_label[$key]."".$key."".$type2label[$extrafields->attribute_type[$key]]."
    ' . $langs->trans('PaymentConditionsShort') . ''; - $form->select_conditions_paiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $cond_reglement_id, 'cond_reglement_id', -1, 1); print '
    ' . $langs->trans('PaymentMode') . ''; - $form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $soc->mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $mode_reglement_id, 'mode_reglement_id'); print '
    '.fieldLabel('Currency','multicurrency_code').''; - $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print '
    ' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($objectsrc->total_localtax2) . "
    ' . $langs->trans('TotalTTC') . '' . price($objectsrc->total_ttc) . "
    ' . $langs->trans('MulticurrencyTotalHT') . '' . price($objectsrc->multicurrency_total_ht) . '
    ' . $langs->trans('MulticurrencyTotalVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
    ' . $langs->trans('MulticurrencyTotalTTC') . '' . price($objectsrc->multicurrency_total_ttc) . "
    \n"; @@ -1283,7 +1302,7 @@ if ($action == 'create') $soc->fetch($object->socid); $head = supplier_proposal_prepare_head($object); - dol_fiche_head($head, 'comm', $langs->trans('CommRequest'), 0, 'supplier_proposal'); + dol_fiche_head($head, 'comm', $langs->trans('CommRequest'), -1, 'supplier_proposal'); $formconfirm = ''; @@ -1491,14 +1510,22 @@ if ($action == 'create') print ''; - if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon)) + 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') { - $form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code); + 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); + $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 ''; print "
    '.$langs->trans("Search").'
    '; + print '
    '; print $langs->trans("SupplierProposal").':

    \n"; @@ -117,7 +117,7 @@ if ($resql) $db->free($resql); print ''; - print ''."\n"; + print ''."\n"; $var=true; $listofstatus=array(0,1,2,3,4); foreach ($listofstatus as $status) @@ -125,8 +125,8 @@ if ($resql) $dataseries[]=array('label'=>$supplier_proposalstatic->LibStatut($status,1),'data'=>(isset($vals[$status])?(int) $vals[$status]:0)); if (! $conf->use_javascript_ajax) { - $var=!$var; - print ""; + + print ''; print ''; print ''; print "\n"; @@ -169,7 +169,7 @@ if (! empty($conf->supplier_proposal->enabled)) { print '
    '.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'
    '.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'
    '.$supplier_proposalstatic->LibStatut($status,0).''.(isset($vals[$status])?$vals[$status]:0).'
    '; print ''; - print ''; + print ''; $langs->load("supplier_proposal"); $num = $db->num_rows($resql); if ($num) @@ -178,9 +178,9 @@ if (! empty($conf->supplier_proposal->enabled)) $var = True; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; $supplier_proposalstatic->id=$obj->rowid; $supplier_proposalstatic->ref=$obj->ref; @@ -227,7 +227,7 @@ if ($resql) { print '
    '.$langs->trans("DraftRequests").'
    '.$langs->trans("DraftRequests").'
    '; print ''; - print ''; + print ''; $num = $db->num_rows($resql); if ($num) @@ -236,10 +236,10 @@ if ($resql) $var = True; while ($i < $num) { - $var=!$var; + $obj = $db->fetch_object($resql); - print ""; + print ''; print '"; + print ''; print '"; + print ''; print '';*/ + + print '
    '.$langs->trans("LastModifiedRequests",$max).'
    '.$langs->trans("LastModifiedRequests",$max).'
    '; $supplier_proposalstatic->id=$obj->rowid; @@ -311,14 +311,14 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos $var=true; print ''; - print ''; + print ''; $nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) { $obj = $db->fetch_object($result); - $var=!$var; - print ''; + + print ''; // Ref print '"; + print ''; print ''; -print_liste_field_titre($langs->trans("HierarchicView")); -print ''; -print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"",'',"",'align="right"'); -print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','','','','maxwidthsearch '); -print ''; -print ''; +print ''; print ''; print ''; // Status @@ -165,6 +158,14 @@ print $searchpitco; print ''; print ''; +print ''; +print_liste_field_titre($langs->trans("HierarchicView")); +print_liste_field_titre('',$_SERVER['PHP_SELF'],"",'',"",'align="center"'); +print_liste_field_titre($langs->trans("Status"),$_SERVER['PHP_SELF'],"",'',"",'align="right"'); +print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','','','','maxwidthsearch '); +print ''; + + $nbofentries=(count($data) - 1); if ($nbofentries > 0) diff --git a/htdocs/user/home.php b/htdocs/user/home.php index a5e9db67867..66a4448491e 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -62,22 +62,21 @@ print '
    '; // Search User -$var=false; print ''; print ''; print '
    '.$langs->trans("RequestsOpened").' '.$num.'
    '.$langs->trans("RequestsOpened").' '.$num.'
    '; diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php index de98ed5be65..718b79ce4ae 100644 --- a/htdocs/supplier_proposal/info.php +++ b/htdocs/supplier_proposal/info.php @@ -53,7 +53,7 @@ $object->info($object->id); $head = supplier_proposal_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'supplier_proposal'); +dol_fiche_head($head, 'info', $langs->trans('CommRequest'), -1, 'supplier_proposal'); // Supplier proposal card $linkback = '' . $langs->trans("BackToList") . ''; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index caf79597e53..c0e9611e6b6 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2013 Regis Houssin @@ -316,11 +316,11 @@ if ($result) { $soc = new Societe($db); $soc->fetch($socid); - $title = $langs->trans('ListOfProposals') . ' - '.$soc->name; + $title = $langs->trans('ListOfSupplierProposals') . ' - '.$soc->name; } else { - $title = $langs->trans('ListOfProposals'); + $title = $langs->trans('ListOfSupplierProposals'); } $num = $db->num_rows($result); @@ -509,23 +509,12 @@ if ($result) $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 ''; - // Fields title - print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'sp.ref','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'sp.date_valid','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'sp.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'sp.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'sp.fk_statut','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - print ''; + print ''; print ''; @@ -564,12 +553,24 @@ if ($result) print ''; // Check boxes print ''; print "\n"; + // Fields title + print ''; + print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'sp.ref','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Supplier'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'sp.date_valid','',$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('SupplierProposalDate'),$_SERVER["PHP_SELF"],'sp.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'sp.total_ht','',$param, 'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'sp.fk_statut','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + $now = dol_now(); $var=true; $total=0; @@ -578,12 +579,12 @@ if ($result) while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; + $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; - print ''; + print ''; print '"; + print ''; print '
    '; print ''; print ''; - $searchpitco=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); + $searchpitco=$form->showFilterButtons(); print $searchpitco; print '
    '; print ''; @@ -670,14 +671,14 @@ if ($result) if ($total>0) { if($num<$limit){ - $var=!$var; + print ''; print ''; print ''; } else { - $var=!$var; + print ''; print ''; print ''; @@ -705,10 +706,10 @@ if ($result) $urlsource.=str_replace('&','&',$param); $filedir=$diroutputmassaction; - $genallowed=$user->rights->propal->lire; - $delallowed=$user->rights->propal->lire; + $genallowed=$user->rights->supplier_proposal->lire; + $delallowed=$user->rights->supplier_proposal->lire; - print $formfile->showdocuments('massfilesarea_proposals','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'',''); + print $formfile->showdocuments('massfilesarea_supplier_proposal','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,'',''); } else { diff --git a/htdocs/supplier_proposal/note.php b/htdocs/supplier_proposal/note.php index b764372848d..10a9668382c 100644 --- a/htdocs/supplier_proposal/note.php +++ b/htdocs/supplier_proposal/note.php @@ -76,7 +76,7 @@ if ($id > 0 || ! empty($ref)) if ( $societe->fetch($object->socid) ) { $head = supplier_proposal_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'supplier_proposal'); + dol_fiche_head($head, 'note', $langs->trans('CommRequest'), -1, 'supplier_proposal'); // Supplier proposal card diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index 8ba1f958918..d313eca10bd 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/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/theme/eldy/ckeditor/config.js b/htdocs/theme/eldy/ckeditor/config.js index a1bb5fdcf0b..eabd0c58bd3 100644 --- a/htdocs/theme/eldy/ckeditor/config.js +++ b/htdocs/theme/eldy/ckeditor/config.js @@ -31,7 +31,7 @@ CKEDITOR.editorConfig = function( config ) ['Templates','NewPage'], ['Save'], ['Source','Maximize','Preview'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['CreateDiv','ShowBlocks'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], @@ -42,14 +42,14 @@ CKEDITOR.editorConfig = function( config ) ['Link','Unlink','Anchor'], ['Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], + ['TextColor','BGColor'] ]; // Used for mailing fields config.toolbar_dolibarr_mailings = [ ['Source','Maximize','Preview'], - ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], + ['SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace'], ['CreateDiv','ShowBlocks'], ['Format','Font','FontSize'], @@ -63,7 +63,7 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_dolibarr_notes = [ ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], + ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Undo','Redo','-','Find','Replace'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], @@ -76,9 +76,9 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_dolibarr_details = [ ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], + ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Format','Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], // ,'Subscript','Superscript' useless ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','SpecialChar'] diff --git a/htdocs/theme/eldy/graph-color.php b/htdocs/theme/eldy/graph-color.php index 4346d007158..5995303c34a 100644 --- a/htdocs/theme/eldy/graph-color.php +++ b/htdocs/theme/eldy/graph-color.php @@ -28,7 +28,7 @@ global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; $theme_bordercolor = array(235,235,224); -$theme_datacolor = array(array(140,140,220), array(190,120,120), array(0,160,140), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); +$theme_datacolor = array(array(136,102,136), array(140,140,220), array(190,120,120), array(0,160,140), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); diff --git a/htdocs/theme/eldy/img/object_bookmark.png b/htdocs/theme/eldy/img/object_bookmark.png index 39109ef5ee6..42f702a584c 100644 Binary files a/htdocs/theme/eldy/img/object_bookmark.png and b/htdocs/theme/eldy/img/object_bookmark.png differ diff --git a/htdocs/theme/eldy/img/refresh.png b/htdocs/theme/eldy/img/refresh.png index 9994475cdfe..a4fac077e7a 100644 Binary files a/htdocs/theme/eldy/img/refresh.png and b/htdocs/theme/eldy/img/refresh.png differ diff --git a/htdocs/theme/eldy/img/reload.png b/htdocs/theme/eldy/img/reload.png deleted file mode 100644 index a4029f119de..00000000000 Binary files a/htdocs/theme/eldy/img/reload.png and /dev/null differ diff --git a/htdocs/theme/eldy/img/statut3.png b/htdocs/theme/eldy/img/statut3.png index bf4f7b8e854..158c640bb60 100644 Binary files a/htdocs/theme/eldy/img/statut3.png and b/htdocs/theme/eldy/img/statut3.png differ diff --git a/htdocs/theme/eldy/img/statut4.png b/htdocs/theme/eldy/img/statut4.png index 7a680ad2b2d..d0df7e40aef 100644 Binary files a/htdocs/theme/eldy/img/statut4.png and b/htdocs/theme/eldy/img/statut4.png differ diff --git a/htdocs/theme/eldy/img/warning_white.png b/htdocs/theme/eldy/img/warning_white.png new file mode 100644 index 00000000000..56ea847427b Binary files /dev/null and b/htdocs/theme/eldy/img/warning_white.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 347ba88ea32..47d549e3986 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -65,6 +65,7 @@ if (! empty($conf->global->MAIN_OVERWRITE_THEME_RES)) { $path='/'.$conf->global- // Define image path files and other constants $fontlist='roboto,arial,tahoma,verdana,helvetica'; //$fontlist='helvetica, verdana, arial, sans-serif'; +//$fontlist='"open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;'; $img_head=''; $img_button=dol_buildpath($path.'/theme/'.$theme.'/img/button_bg.png',1); $dol_hide_topmenu=$conf->dol_hide_topmenu; @@ -72,16 +73,15 @@ $dol_hide_leftmenu=$conf->dol_hide_leftmenu; $dol_optimize_smallscreen=$conf->dol_optimize_smallscreen; $dol_no_mouse_hover=$conf->dol_no_mouse_hover; - //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; //var_dump($user->conf->THEME_ELDY_RGB); // Colors -$colorbackhmenu1='110,120,160'; // topmenu +$colorbackhmenu1='80,90,120'; // topmenu $colorbackvmenu1='255,255,255'; // vmenu $colortopbordertitle1='120,120,120'; // top border of title -$colorbacktitle1='230,230,230'; // title of tables,list +$colorbacktitle1='240,240,240'; // title of tables,list $colorbacktabcard1='255,255,255'; // card $colorbacktabactive='234,234,234'; $colorbacklineimpair1='255,255,255'; // line impair @@ -95,12 +95,9 @@ $colortexttitle='0,0,0'; $colortext='0,0,0'; $colortextlink='0,0,120'; $fontsize='13'; -$fontsizesmaller='11'; -$usegradienttop=(isset($conf->global->THEME_ELDY_TOPMENU_BACK1)?0:1); -$usegradienttitle=(isset($conf->global->THEME_ELDY_BACKTITLE1)?0:1); +$fontsizesmaller='12'; $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); $borderwith=2; -$noborderline=0; // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; @@ -123,10 +120,10 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_LINEPAIRHOVER='238,246,252'; $conf->global->THEME_ELDY_TEXT='0,0,0'; $conf->global->THEME_ELDY_FONT_SIZE1='13'; - $conf->global->THEME_ELDY_FONT_SIZE2='11'; + $conf->global->THEME_ELDY_FONT_SIZE2='12'; } - + // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); $colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1); @@ -138,7 +135,6 @@ $colorbacklineimpair1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( $colorbacklineimpair2=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEIMPAIR2) ?$colorbacklineimpair2:$conf->global->THEME_ELDY_LINEIMPAIR2):(empty($user->conf->THEME_ELDY_LINEIMPAIR2)?$colorbacklineimpair2:$user->conf->THEME_ELDY_LINEIMPAIR2); $colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR1) ?$colorbacklinepair1:$conf->global->THEME_ELDY_LINEPAIR1) :(empty($user->conf->THEME_ELDY_LINEPAIR1)?$colorbacklinepair1:$user->conf->THEME_ELDY_LINEPAIR1); $colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); -$colorbacklinepairhover=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIRHOVER) ?$colorbacklinepairhover:$conf->global->THEME_ELDY_LINEPAIRHOVER) :(empty($user->conf->THEME_ELDY_LINEPAIRHOVER)?$colorbacklinepairhover:$user->conf->THEME_ELDY_LINEPAIRHOVER); $colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); $colortexttitlenotab =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$conf->global->THEME_ELDY_TEXTTITLENOTAB) :(empty($user->conf->THEME_ELDY_TEXTTITLENOTAB)?$colortexttitlenotab:$user->conf->THEME_ELDY_TEXTTITLENOTAB); $colortexttitle =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTTITLE) ?$colortexttitle:$conf->global->THEME_ELDY_TEXTTITLE) :(empty($user->conf->THEME_ELDY_TEXTTITLE)?$colortexttitle:$user->conf->THEME_ELDY_TEXTTITLE); @@ -146,6 +142,7 @@ $colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( $colortextlink =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXTLINK) ?$colortextlink:$conf->global->THEME_ELDY_TEXTLINK) :(empty($user->conf->THEME_ELDY_TEXTLINK)?$colortextlink:$user->conf->THEME_ELDY_TEXTLINK); $fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1); $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2); + // Hover color $colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) @@ -241,7 +238,7 @@ body { color: rgb(); font-size: px; - line-height: 130%; + line-height: 1.4; font-family: ; margin-top: 0; margin-bottom: 0; @@ -261,6 +258,49 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla background-color: #FFF; } +input.select2-input { + border-bottom: none ! important; +} +.select2-choice { + border: none; + border-bottom: solid 1px rgba(0,0,0,.2) !important; /* required to avoid to lose bottom line when focus is lost on select2. */ +} + +.liste_titre input[name=monthvalid], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim] { + margin-right: 4px; +} +input[type=submit] { + margin-left: 5px; +} +input, input.flat, form.flat select, select, select.flat, .dataTables_length label select { + global->THEME_ELDY_SHOW_BORDER_INPUT)) + print "border: none;" + ?> +} +input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { + font-size: px; + font-family: ; + outline: none; + margin: 0px 0px 0px 0px; + border-bottom: solid 1px rgba(0,0,0,.2); +} + +input { + line-height: 17px; + padding: 4px; + padding-left: 5px; +} +select { + padding: 4px; + padding-left: 2px; +} +input, select { + margin-left:0px; + margin-bottom:1px; + margin-top:1px; +} + +/* Focus definitions must be after standard definition */ textarea:focus, button:focus { /* v6 box-shadow: 0 0 4px #8091BF; */ border: 1px solid #aaa !important; @@ -268,46 +308,19 @@ textarea:focus, button:focus { input:focus, select:focus { border-bottom: 1px solid #666; } -input.select2-input { - border-bottom: none ! important; -} -.select2-choice { - border: none; - border-bottom: 1px solid #aaa !important; -} - textarea.cke_source:focus { box-shadow: none; } -.liste_titre input[name=month], .liste_titre input[name=month_lim] { - margin-right: 4px; +select { + /* padding: 4px 4px 2px 1px; */ } -input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { - font-size: px; - font-family: ; - - border: none; - border-bottom: 1px solid #C0C0C0; - outline: none; - margin: 0px 0px 0px 0px; -} -input { - line-height: 17px; -} -input, select { - border-bottom: solid 1px rgba(0,0,0,.2); - - padding:4px; - margin-left:0px; - margin-bottom:1px; - margin-top:1px; - } textarea { border-radius: 0; - border: solid 1px rgba(0,0,0,.3); - border-top:solid 1px rgba(0,0,0,.3); + border-top:solid 1px rgba(0,0,0,.2); + border-left:solid 1px rgba(0,0,0,.2); + border-right:solid 1px rgba(0,0,0,.2); border-bottom:solid 1px rgba(0,0,0,.2); padding:4px; @@ -336,6 +349,12 @@ span.timesheetalreadyrecorded input { select.flat, form.flat select { font-weight: normal; } +.optionblue { + color: rgb() !important; +} +.select2-results .select2-highlighted.optionblue { + color: #FFF !important; +} .optiongrey, .opacitymedium { opacity: 0.5; } @@ -375,21 +394,23 @@ input:-webkit-autofill { ::-moz-placeholder { color:#bbb; } /* firefox 19+ */ :-ms-input-placeholder { color:#ccc; } /* ie */ input:-moz-placeholder { color:#ccc; } - +input[name=weight], input[name=volume], input[name=surface], input[name=sizeheight] { margin-right: 6px; } +input[name=surface] { margin-right: 4px; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } +hr { border: 0; border-top: 1px solid #ccc; } + .button, .buttonDelete, input[name="sbmtConnexion"] { font-family: ; border-color: #c5c5c5; border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); display: inline-block; - padding: 4px 14px; + padding: 3px 14px; margin-bottom: 0; margin-top: 0; text-align: center; cursor: pointer; - color: #333333 !important; text-decoration: none !important; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); background-color: #f5f5f5; @@ -408,9 +429,6 @@ fieldset { border: 1px solid #AAAAAA !important; } -webkit-border-radius: 2px; -moz-border-radius: 2px; border-radius: 2px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); } .button:focus, .buttonDelete:focus { -moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 60, 0.2), 0px 0px 0px rgba(60,60,60,0.1); @@ -476,6 +494,9 @@ th .button { .valignbottom { vertical-align: bottom; } +.valigntextbottom { + vertical-align: text-bottom; +} .centpercent { width: 100%; } @@ -501,15 +522,27 @@ textarea.centpercent { .nowrap { white-space: ; } +.nowraponall { + white-space: nowrap; +} .nobold { font-weight: normal !important; } .nounderline { text-decoration: none; } +.paddingleft { + padding-: 4px; +} +.paddingright { + padding-: 4px; +} .cursorpointer { cursor: pointer; } +.cursormove { + cursor: move; +} .badge { display: inline-block; min-width: 10px; @@ -524,9 +557,6 @@ textarea.centpercent { background-color: #777; border-radius: 10px; } -.movable { - cursor: move; -} .borderrightlight { border-right: 1px solid #DDD; @@ -560,9 +590,10 @@ div.myavailability { padding-bottom: 4px; } .checkallactions { - vertical-align: top; - margin-top: 6px; - margin-left: 4px; + /* vertical-align: text-bottom; + margin-top: 6px; */ + margin-left: 2px; /* left must be same than right to keep checkbox centered */ + margin-right: 2px; /* left must be same than right to keep checkbox centered */ } .selectlimit, .marginrightonly { margin-right: 10px !important; @@ -576,6 +607,9 @@ div.myavailability { .strikefordisabled { text-decoration: line-through; } +.widthdate { + width: 130px; +} /* using a tdoverflowxxx make the min-width not working */ .tdoverflow { max-width: 0; @@ -583,13 +617,19 @@ div.myavailability { text-overflow: ellipsis; white-space: nowrap; } -.tdoverflowmax100 { +.tdoverflowmax100 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } -.tdoverflowmax300 { +.tdoverflowmax200 { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 200px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.tdoverflowmax300 { /* For tdoverflow, the max-midth become a minimum ! */ max-width: 300px; overflow: hidden; text-overflow: ellipsis; @@ -620,6 +660,13 @@ div.myavailability { margin-bottom: 12px; } +/* For the long description of module */ +.moduledesclong p img, .moduledesclong p a img { + max-width: 90% !important; + height: auto !important; +} + + /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { width: calc(100% - 330px); @@ -640,7 +687,7 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive overflow-x: auto; } div.fiche>form>div.div-table-responsive { - min-height: 350px; + min-height: 390px; } .flexcontainer { @@ -649,7 +696,12 @@ div.fiche>form>div.div-table-responsive { justify-content: flex-start; } .thumbstat { - flex: 1 1 120px; + flex: 1 1 114px; +} +.thumbstat150 { + flex: 1 1 170px; +} +.thumbstat, thumbstat150 { /* flex-grow: 1; */ /* flex-shrink: 1; */ /* flex-basis: 140px; */ @@ -668,18 +720,25 @@ div.fiche>form>div.div-table-responsive { /* rule for not too small screen only */ @media only screen and (min-width: px) { + .width50 { width: 50px; } + .width100 { width: 100px; } + .width200 { width: 200px; } .minwidth100 { min-width: 100px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } .minwidth500 { min-width: 500px; } .minwidth50imp { min-width: 50px !important; } + .minwidth75imp { min-width: 75px !important; } .minwidth100imp { min-width: 100px !important; } .minwidth200imp { min-width: 200px !important; } .minwidth300imp { min-width: 300px !important; } .minwidth400imp { min-width: 400px !important; } .minwidth500imp { min-width: 500px !important; } } +.width50 { width: 50px; } +.width100 { width: 100px; } +.width200 { width: 200px; } .maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } @@ -690,6 +749,7 @@ div.fiche>form>div.div-table-responsive { .maxwidth400 { max-width: 400px; } .maxwidth500 { max-width: 500px; } .maxwidth50imp { max-width: 50px !important; } +.maxwidth75imp { max-width: 75px !important; } .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } @@ -703,6 +763,7 @@ div.fiche>form>div.div-table-responsive { .titlefield { width: 30% !important; } .titlefieldcreate { width: 30% !important; } .minwidth50imp { min-width: 50px !important; } + .minwidth75imp { min-width: 75px !important; } .minwidth100imp { min-width: 100px !important; } .minwidth200imp { min-width: 200px !important; } .minwidth300imp { min-width: 300px !important; } @@ -715,11 +776,12 @@ div.fiche>form>div.div-table-responsive { { .maxwidthonsmartphone { max-width: 100px; } .minwidth50imp { min-width: 50px !important; } - .minwidth100imp { min-width: 50px !important; } + .minwidth75imp { min-width: 70px !important; } + .minwidth100imp { min-width: 80px !important; } .minwidth200imp { min-width: 100px !important; } .minwidth300imp { min-width: 100px !important; } - .minwidth400imp { min-width: 100px !important; } - .minwidth500imp { min-width: 100px !important; } + .minwidth400imp { min-width: 150px !important; } + .minwidth500imp { min-width: 250px !important; } } /* Force values for small screen 570 */ @@ -749,8 +811,8 @@ div.fiche>form>div.div-table-responsive { min-width: 20px; min-height: 1.4em; line-height: 1.4em; - padding: .4em .1em; - border: 1px solid #BBB; + /* padding: .4em .1em; */ + /* border-bottom: 1px solid #BBB; */ /* max-width: inherit; why this ? */ } @@ -766,11 +828,12 @@ div.fiche>form>div.div-table-responsive { .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } - .minwidth100imp { min-width: 50px !important; } - .minwidth200imp { min-width: 50px !important; } - .minwidth300imp { min-width: 50px !important; } - .minwidth400imp { min-width: 50px !important; } - .minwidth500imp { min-width: 50px !important; } + .minwidth75imp { min-width: 60px !important; } + .minwidth100imp { min-width: 60px !important; } + .minwidth200imp { min-width: 60px !important; } + .minwidth300imp { min-width: 100px !important; } + .minwidth400imp { min-width: 150px !important; } + .minwidth500imp { min-width: 250px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } @@ -835,14 +898,15 @@ td.showDragHandle { } #id-right, #id-left { padding-top: 16px; - padding-bottom: 8px; - + padding-bottom: 16px; + display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ float: none; vertical-align: top; } #id-right { /* This must stay id-right and not be replaced with echo $right */ width: 100%; + background: rgb(); } #id-left { /* background-color: #fff; @@ -859,14 +923,14 @@ div.blockvmenulogo { border-bottom: 0 !important; } -div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks { +div.blockvmenupair, div.blockvmenuimpair { border-top: none !important; border-left: none !important; border-right: none !important; border-bottom: 1px solid #e0e0e0; padding-left: 0 !important; } -div.blockvmenuend { +div.blockvmenuend, div.blockvmenubookmarks { border: none !important; padding-left: 0 !important; } @@ -877,7 +941,7 @@ div.vmenu, td.vmenu { /* For smartphone (testmenuhider is on) */ -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout == 'phone' && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> #id-container { width: 100%; } @@ -919,8 +983,8 @@ div.fiche { div.fiche { - margin-: px; - margin-: dol_optimize_smallscreen)?'12':'6')); ?>px; + margin-: px; + margin-: dol_optimize_smallscreen)?'16':'6')); ?>px; dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> dol_hide_leftmenu)) print 'margin-bottom: 12px;'."\n"; ?> } @@ -1021,6 +1085,9 @@ div.nopadding { .pictowarning, .pictopreview { padding-: 3px; } +.pictoedit, .pictowarning, .pictodelete { + vertical-align: text-bottom; +} .colorthumb { padding-left: 1px !important; padding-right: 1px; @@ -1029,7 +1096,7 @@ div.nopadding { width: 44px; } div.attacharea { - padding-top: 10px; + padding-top: 18px; padding-bottom: 10px; } @@ -1055,6 +1122,9 @@ div.statusref { margin-bottom: 10px; clear: both; } +div.statusref img { + padding-left: 8px; +} img.photoref, div.photoref { border: 1px solid #CCC; -moz-box-shadow: 3px 3px 4px #DDD; @@ -1078,7 +1148,8 @@ img.photorefnoborder { height: 48px; width: 48px; object-fit: contain; - border: 1px solid #CCC; + border: 1px solid #AAA; + border-radius: 100px; } .underrefbanner { } @@ -1110,14 +1181,14 @@ div#id-top { background: rgb(); /*-webkit-box-shadow: 0 0 6px rgba(0,0,0,0.4); box-shadow: 0 0 6px rgba(0,0,0,0.4); */ - + /* background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) ); - + */ /* height: 34px; @@ -1194,15 +1265,15 @@ ul.tmenu { /* t r b l */ display: table; } ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */ -/* background: rgb(); - + /* background: rgb(); + /* background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) ); - */ + */ } li.tmenu, li.tmenusel { @@ -1247,7 +1318,7 @@ div.tmenuleft div.tmenucenter { padding-left: 0px; - padding-right: 0px; + padding-right: 3px; padding-top: 8px; height: 26px; @@ -1289,7 +1360,7 @@ div.mainmenu { position : relative; background-repeat:no-repeat; background-position:center top; - height: px; + height: px; margin-left: 0px; min-width: 40px; } @@ -1444,21 +1515,28 @@ foreach($mainmenuusedarray as $val) .bodylogin { background: #f0f0f0; - /* background: linear-gradient(to left top, rgb(255,255,255), rgb(240,240,240)) fixed; */ + display: table; + position: absolute; + height: 100%; + width: 100%; +} +.login_center { + display: table-cell; + vertical-align: middle; } .login_vertical_align { padding: 10px; } form#login { - margin-top: px; - margin-bottom: 30px; + padding-bottom: 30px; font-size: 13px; vertical-align: middle; } .login_table_title { max-width: 530px; - color: #888888 !important; - text-shadow: 1px 1px 1px #FFF; + color: #aaa !important; + padding-top: 30px; + /* text-shadow: 1px 1px 1px #FFF; */ } .login_table label { text-shadow: 1px 1px 1px #FFF; @@ -1473,13 +1551,9 @@ form#login { background-color: #FFFFFF; - -moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); - -webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); - box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); - - /*-moz-box-shadow: 3px 2px 20px #CCC; - -webkit-box-shadow: 3px 2px 20px #CCC; - box-shadow: 3px 2px 20px #CCC;*/ + -moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); + -webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); + box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); border-radius: 5px; /*border-top:solid 1px rgba(180,180,180,.4); @@ -1546,7 +1620,7 @@ div.login_block { position: absolute; text-align: ; : 5px; - top: 3px; + top: 4px; font-weight: bold; max-width: px; @@ -1600,6 +1674,10 @@ div.login_block_other { padding-top: 3px; text-align: right; } .alogin:hover, .atoplogin:hover { text-decoration:underline !important; } +span.fa.atoplogin, span.fa.atoplogin:hover { + font-size: 16px; + text-decoration: none !important; +} img.login, img.printer, img.entity { /* padding: 0px 0px 0px 4px; */ /* margin: 0px 0px 0px 8px; */ @@ -1607,10 +1685,26 @@ img.login, img.printer, img.entity { color: white; font-weight: bold; } -img.loginphoto { - border-radius: 2px; +.userimgatoplogin img.userphoto { /* size for user photo in login bar */ width: 16px; height: 16px; + border-radius: 8px; + background-size: contain; + background-size: contain; +} +img.userphoto { /* size for user photo in lists */ + border-radius: 9px; + width: 18px; + height: 18px; + background-size: contain; + vertical-align: middle; +} +img.userphotosmall { /* size for user photo in lists */ + border-radius: 6px; + width: 12px; + height: 12px; + background-size: contain; + vertical-align: middle; } .span-icon-user { background-image: url(); @@ -1641,14 +1735,19 @@ div.vmenu, td.vmenu { } .vmenu { + width: 190px; margin-left: 4px; display: none; } +/* Force vmenusearchselectcombo with type=text differently than without because beautify with select2 affect vmenusearchselectcombo differently */ +input.vmenusearchselectcombo[type=text] { + width: 180px !important; +} .vmenusearchselectcombo { - width: 188px; + width: 188px; } .menu_contenu { @@ -1660,7 +1759,7 @@ div.vmenu, td.vmenu { } #menu_contenu_logo { padding-top: 0; } .companylogo { } -.searchform { padding-top: 4px; } +.searchform { padding-top: 10px; } a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } @@ -1680,10 +1779,6 @@ a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size: a.vsmenu.addbookmarkpicto { padding-right: 10px; } -.vmenu div.blockvmenubookmarks, .vmenu div.blockvmenuend, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone -{ -/* border-bottom: 1px solid #BBB; */ -} div.blockvmenusearchphone { border-bottom: none !important; @@ -1694,7 +1789,7 @@ div.blockvmenusearchphone } .vmenu div.blockvmenusearch { - padding-bottom: 14px; + padding-bottom: 4px; /* border-bottom: 1px solid #e0e0e0; */ } .vmenu div.blockvmenuend @@ -1708,7 +1803,7 @@ div.blockvmenusearchphone } div.blockvmenubookmarks { - padding-bottom: 6px !important; + padding-bottom: 16px !important; } div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmenuend { @@ -1870,20 +1965,21 @@ div.tabBar { color: #; padding-top: 16px; padding-left: 0px; padding-right: 0px; - padding-bottom: 14px; - margin: 0px 0px 14px 0px; + padding-bottom: 2px; + margin: 0px 0px 16px 0px; border-top: 1px solid #BBB; - border-bottom: 1px solid #AAA; + /* border-bottom: 1px solid #AAA; */ width: auto; - background: rgb(); - - /* - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; - */ } +div.tabBarWithBottom { + padding-bottom: 18px; + border-bottom: 1px solid #aaa; +} +div.tabBar table.tableforservicepart2:last-child { + border-bottom: 1px solid #aaa; +} + div.popuptabset { padding: 6px; background: #fff; @@ -1896,7 +1992,7 @@ div.popuptab { padding-right: 5px; } div.tabsAction { - margin: 20px 0em 10px 0em; + margin: 20px 0em 20px 0em; padding: 0em 0em; text-align: right; } @@ -2004,82 +2100,33 @@ span.butAction, span.butActionDelete { margin: 0em em; padding: 0.6em em; font-family: ; -/* for bootstrap look - color: #fff; - background-color: #337ab7; - border-color: #2e6da4; - display: inline-block; - padding: 6px 12px; - margin-bottom: 0; - font-weight: normal; - line-height: 1.42857143; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -ms-touch-action: manipulation; - touch-action: manipulation; - cursor: pointer; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-image: none; - border: 1px solid transparent; - border-radius: 4px; - */ - - font-weight: normal; - border-color: #c5c5c5; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); - display: inline-block; - text-align: center; - cursor: pointer; - color: #fff; - background: rgb(); - background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); - background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); - background-image: -moz-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); - background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); - background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); - - color: #333333; - text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); - background-color: #f5f5f5; - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); - - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); - border-color: #e6e6e6 #e6e6e6 #bfbfbf; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); - border: 1px solid #bbbbbb; - border-bottom-color: #a2a2a2; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); + font-weight: normal; + border-color: #c5c5c5; + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); + display: inline-block; + text-align: center; + cursor: pointer; + color: #fff; + background: rgb(); + border: 1px solid rgb(); } .butAction:hover { - -moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); - -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); - box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); + -moz-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); } .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete { - color: #800 !important; + background: #633; + border: 1px solid #633; + color: #FFF; } .butActionDelete:hover { - -moz-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); - -webkit-box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); - box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.2), 0px 0px 0px rgba(60,60,60,0.1); + -moz-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); } .butActionRefused { @@ -2089,130 +2136,14 @@ span.butAction, span.butActionDelete { margin: 0em em; padding: 0.6em em; font-family: !important; -/* for bootstrap look - color: #333; - background-color: #e6e6e6; - border-color: #adadad; - display: inline-block; - margin-bottom: 0; - font-weight: normal !important; - line-height: 1.42857143; - text-align: center; - white-space: nowrap; - vertical-align: middle; - -ms-touch-action: manipulation; - touch-action: manipulation; - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - background-image: none; - border: 1px solid transparent; - border-radius: 4px; -*/ - - font-weight: normal !important; - border-color: #c5c5c5; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); - display: inline-block; - margin: 0em em; - padding: 0.6em em; - text-align: center; - cursor: pointer; - color: #999 !important; - text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); - background-color: #f5f5f5; - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); - border-color: #e6e6e6 #e6e6e6 #bfbfbf; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); - border: 1px solid #bbbbbb; - border-bottom-color: #a2a2a2; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - + font-weight: normal !important; + display: inline-block; + text-align: center; + cursor: pointer; + color: #999 !important; + border: 1px solid #bbb; } -/* Prepare for bootstrap look -.butAction, .butActionDelete, .butActionRefused { - border-color: #c5c5c5; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); - display: inline-block; - padding: 4px 14px; - margin-bottom: 0; - line-height: 20px; - text-align: center; - vertical-align: middle; - cursor: pointer; - color: #333333; - text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75); - background-color: #f5f5f5; - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0); - border-color: #e6e6e6 #e6e6e6 #bfbfbf; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); - border: 1px solid #bbbbbb; - border-bottom-color: #a2a2a2; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05); -} - -.butAction { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #006dcc; - background-image: -moz-linear-gradient(top, #0088cc, #0044cc); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc)); - background-image: -webkit-linear-gradient(top, #0088cc, #0044cc); - background-image: -o-linear-gradient(top, #0088cc, #0044cc); - background-image: linear-gradient(to bottom, #0088cc, #0044cc); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0044cc', GradientType=0); - border-color: #0044cc #0044cc #002a80; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -} - -.butActionDelete { - color: #ffffff; - text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); - background-color: #cc6d00; - background-image: -moz-linear-gradient(top, #cc8800, #cc4400); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#cc8800), to(#cc4400)); - background-image: -webkit-linear-gradient(top, #cc8800, #cc4400); - background-image: -o-linear-gradient(top, #cc8800, #cc4400); - background-image: linear-gradient(to bottom, #cc8800, #cc4400); - background-repeat: repeat-x; - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffcc8800', endColorstr='#ffcc4400', GradientType=0); - border-color: #cc4400 #cc4400 #802a00; - border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); - filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); -} -a.butAction:link, a.butAction:visited, a.butAction:hover, a.butAction:active { - color: #FFFFFF; -} -End bootstrap */ - global->MAIN_BUTTON_HIDE_UNAUTHORIZED) && (! $user->admin)) { ?> .butActionRefused { display: none; @@ -2273,9 +2204,6 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { - - border: 1px solid #E0E0E0; - border-collapse: collapse !important; padding: 1px 2px 1px 3px; /* t r b l */ } @@ -2283,7 +2211,7 @@ table.borderplus { border: 1px solid #BBB; } .border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 20px; + height: 22px; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { vertical-align: middle; @@ -2295,18 +2223,14 @@ div .tdtop { } table.border td, div.border div div.tagtd { - - padding: 2px 2px 2px 2px; - border: 1px solid #E0E0E0; - padding: 3px 2px 3px 2px; - border-bottom: 1px solid #E0E0E0; - - padding: 3px 2px 3px 2px; - /* border: 1px solid #E0E0E0; */ - border-collapse: collapse; } +div.tabBar .fichecenter table.border>tbody>tr>td, div.tabBar .fichecenter div.border div div.tagtd, div.tabBar div.border div div.tagtd +{ + padding-top: 4px; + border-bottom: 1px solid #E0E0E0; +} td.border, div.tagtable div div.border { border-top: 1px solid #000000; @@ -2324,6 +2248,9 @@ td.border, div.tagtable div div.border { /* Main boxes */ +.noborderbottom { + border-bottom: none !important; +} .ficheaddleft table.noborder { margin: 0px 0px 0px 0px; } @@ -2343,10 +2270,29 @@ table.liste, table.noborder, table.formdoc, div.noborder { margin: 0px 0px 5px 0px; } +div.tabBar div.ficheaddleft table.noborder:last-of-type { + border-bottom: 1px solid #aaa; +} +div.tabBar div.ficheaddleft table.noborder { + border-bottom: none; +} + table.paddingtopbottomonly tr td { padding-top: 1px; padding-bottom: 2px; } +.liste_titre_filter { + background: rgb() !important; +} +tr.liste_titre_filter td.liste_titre { + border-bottom: 1px solid #ddd; +} +.liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd +{ + /*border-top-width: 1px; + border-top-color: rgb(); + border-top-style: solid;*/ +} .liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { border-top-width: 2px; @@ -2368,23 +2314,23 @@ div.liste_titre_bydiv .divsearchfield { } tr.box_titre .nobordernopadding td { - padding: 0px ! important; + padding: 0 ! important; } table.nobordernopadding { border-collapse: collapse !important; - border: 0px; + border: 0; } table.nobordernopadding tr { - border: 0px !important; - padding: 0px 0px !important; + border: 0 !important; + padding: 0 0 !important; } table.nobordernopadding tr td { - border: 0px; + border: 0 !important; padding: 0 3px 0 0; } table.border tr td table.nobordernopadding tr td { - padding-top: 0px; - padding-bottom: 0px; + padding-top: 0; + padding-bottom: 0; } td.borderright { border: none; /* to erase value for table.nobordernopadding td */ @@ -2411,11 +2357,11 @@ div.refidpadding { } div.refid { font-weight: bold; - color: #866; + color: #868; font-size: 160%; } div.refidno { - padding-top: 2px; + padding-top: 3px; font-weight: normal; color: #444; font-size: px; @@ -2454,7 +2400,6 @@ div.pagination li { div.pagination li.pagination a, div.pagination li.pagination span { padding: 6px 12px; - margin-left: -1px; line-height: 1.42857143; color: #000; text-decoration: none; @@ -2464,14 +2409,12 @@ div.pagination li.pagination span.inactive { cursor: default; color: #ccc; } +li.noborder.litext, li.noborder.litext a, div.pagination li a.inactive:hover, div.pagination li span.inactive:hover { - background-color: #f5f5f5; - background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6)); - background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6); - background-image: -o-linear-gradient(top, #ffffff, #e6e6e6); - background-image: linear-gradient(to bottom, #ffffff, #e6e6e6); + -moz-box-shadow: none !important; + -webkit-box-shadow: none !important; + box-shadow: none !important; } /*div.pagination li.litext { padding-top: 8px; @@ -2496,7 +2439,7 @@ div.pagination li.noborder a:hover { } div.pagination li a, div.pagination li span { - background-color: #fff; + /* background-color: #fff; */ /* border: 1px solid #ddd; */ } div.pagination li:first-child a, @@ -2514,17 +2457,10 @@ div.pagination li a:hover, div.pagination li span:hover, div.pagination li a:focus, div.pagination li span:focus { - color: #000; - background-color: #eee; - border-color: #ccc; - - background-image: -moz-linear-gradient(top, #eee, #ddd); - background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#eee), to(#ddd)); - background-image: -webkit-linear-gradient(top, #eee, #ddd); - background-image: -o-linear-gradient(top, #eee, #ddd); - background-image: linear-gradient(to bottom, #eee, #ddd); - background-repeat: repeat-x; - + -moz-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + -webkit-box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + box-shadow: 0px 0px 6px 1px rgba(50, 50, 50, 0.4), 0px 0px 0px rgba(60,60,60,0.1); + padding-top: 8px; } div.pagination li .active a, div.pagination li .active span, @@ -2551,6 +2487,7 @@ div.pagination .disabled a:focus { } div.pagination li.pagination .active { text-decoration: underline; + box-shadow: none; } div.pagination li.paginationafterarrows { margin-left: 10px; @@ -2559,74 +2496,56 @@ div.pagination li.paginationafterarrows { margin-top: 9px; } -/* Prepare to remove class pair - impair -.noborder > tbody > tr:nth-child(even) td { - background: linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - font-family: ; - border: 0px; - margin-bottom: 1px; - color: #202020; - min-height: 18px; -} -.noborder > tbody > tr:nth-child(odd) td { - background: linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - font-family: ; - border: 0px; - margin-bottom: 1px; - color: #202020; -} -*/ + /* Set the color for hover lines */ -.odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover, .box_pair:hover, .box_impair:hover +.oddeven:hover, .odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, +table.dataTable tr.even:hover, table.dataTable tr.odd:hover { - background: rgb() !important; + background: rgb() !important; /* Must be background to be stronger than background of odd or even */ } -.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover, tr.box_pair td.nohover, tr.box_impair td.nohover +.oddeven, .odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover { font-family: ; margin-bottom: 1px; color: #202020; - min-height: 18px; /* seems to not be used */ - +} +.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover +{ background: #; } #GanttChartDIV { - background: #; + background-color: #; } -.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { +.oddeven, .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { font-family: ; margin-bottom: 1px; color: #202020; - +} +.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { background-color: #; } -table.dataTable tr.odd { +table.dataTable tr.odd, table.dataTable tr.oddeven { background-color: # !important; } /* For no hover style */ -table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td { +td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover { background-color: # !important; + background: # !important; } tr.nohoverpair td { background-color: # !important; + background: # !important; } + table.dataTable td { padding: 5px 2px 5px 3px !important; } @@ -2679,25 +2598,21 @@ tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, tabl } div.liste_titre_bydiv, .liste_titre div.tagtr, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.liste_titre_sel, table.dataTable thead tr { - - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background: rgb(); - font-weight: ; - + border-bottom: 1px solid #ddd; + color: rgb(); font-family: ; - border-bottom: 1px solid #FDFFFF; text-align: ; } tr.liste_titre th, tr.liste_titre td, th.liste_titre { - border-bottom: 1px solid #; +/* border-bottom: 1px solid #; */ + border-bottom: 1px solid #888; +} +tr.liste_titre:first-child th, tr:first-child th.liste_titre { + border-bottom: 1px solid #ddd ! important; } tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div { @@ -2723,10 +2638,11 @@ tr.liste_titre_topborder td { .liste_titre td a.notasortlink:hover { background: transparent; } -tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel, form.liste_titre div.tagtd { /* For last line of table headers only */ - border-bottom: 1px solid rgb(); +tr.liste_titre:last-child th.liste_titre, tr.liste_titre:last-child th.liste_titre_sel, tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel, form.liste_titre div.tagtd { /* For last line of table headers only */ + border-bottom: 1px solid #ddd; } + tr.liste_titre_sel th, th.liste_titre_sel, tr.liste_titre_sel td, td.liste_titre_sel, form.liste_titre_sel div { font-family: ; @@ -2796,6 +2712,32 @@ div.tabBar .noborder { } +/* Prepare to remove class pair - impair */ + +.noborder > tbody > tr:nth-child(even):not(.liste_titre), .liste > tbody > tr:nth-child(even):not(.liste_titre) { + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); +} +.noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre) { + border-bottom: 1px solid #ddd; +} + +.noborder > tbody > tr:nth-child(odd):not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(.liste_titre) { + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); +} +.noborder > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre) { + border-bottom: 1px solid #ddd; +} + + + /* * Boxes */ @@ -2803,23 +2745,48 @@ div.tabBar .noborder { .ficheaddleft div.boxstats { border: none; } -.boxstats { +.boxstatsborder { + border: 1px solid #CCC !important; +} +.boxstats, .boxstats130 { display: inline-block; margin: 3px; - padding: 3px; - /*-moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; - margin-bottom: 8px !important;*/ border: 1px solid #CCC; text-align: center; border-radius: 2px; - +} +.boxstats, .boxstats130, .boxstatscontent { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; +} +.boxstats { + padding: 3px; width: 105px; } +.boxstats130 { + width: 160px; + height: 48px; + padding: 3px +} +.boxstatscontent { + padding: 3px; +} + +@media only screen and (max-width: 767px) +{ + .thumbstat150 { + flex: 1 1 110px; + } + .boxstats, .boxstats130 { + width: 90px; + } + .dashboardlineindicator { + float: left; + padding-left: 5px; + } +} + .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } @@ -2830,24 +2797,60 @@ span.boxstatstext { span.boxstatsindicator { font-size: 130%; font-weight: normal; + line-height: 29px; } span.dashboardlineindicator, span.dashboardlineindicatorlate { - font-size: 120%; + font-size: 130%; font-weight: normal; } +.dashboardlineindicatorlate img { + width: 16px; +} span.dashboardlineok { color: #008800; } span.dashboardlineko { - color: #880000; - font-weight: bold; + color: #FFF; + /*color: #8c4446 ! important; + padding-left: 1px;*/ + + font-size: 80%; +} +.dashboardlinelatecoin { + float: right; + position: relative; + text-align: right; + top: -24px; + padding: 1px 2px 1px 2px; + border-radius: .25em; + + background-color: #af4705; + padding: 0px 5px 0px 5px; + top: -26px; +} +.imglatecoin { + padding: 1px 3px 1px 1px; + margin-left: 4px; + margin-right: 2px; + background-color: #8c4446; + color: #FFFFFF ! important; + border-radius: .25em; + display: inline-block; + vertical-align: middle; } .boxtable { margin-bottom: 8px !important; + border-bottom-width: 1px; +} +.boxtablenobottom { + border-bottom-width: 0 !important; } .tdboxstats { text-align: center; } +a.valignmiddle.dashboardlineindicator { + line-height: 30px; +} .box { padding-right: 0px; @@ -2863,16 +2866,7 @@ tr.box_titre { color: #000 !important;*/ /* TO MATCH ELDY */ - - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); - - background: rgb(); - - + background: rgb() color: rgb(); font-family: , sans-serif; font-weight: ; @@ -2883,30 +2877,10 @@ tr.box_titre { tr.box_titre td.boxclose { width: 30px; } - -tr.box_impair { - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: linear-gradient(bottom, rgb() 85%, rgb() 100%); - - font-family: ; +img.boxhandle, img.boxclose { + padding-left: 5px; } - -tr.box_pair { - font-family: ; - - background-color: #f9f9f9; -} - -tr.box_pair td, tr.box_impair td { - /* padding: 4px; */ -} -tr.box_pair:not(:last-child) td, tr.box_impair:not(:last-child) td { - border-bottom: 1px solid #ddd; -} .noborderbottom { border-bottom: none !important; } @@ -3019,15 +2993,13 @@ td.legendLabel { padding: 2px 2px 2px 0 !important; } margin-bottom: 2px; margin-top: 10px; } -.photowithmargin { -/* -webkit-box-shadow: 0px 0px 3px #777; - -moz-box-shadow: 0px 0px 3px #777; - box-shadow: 0px 0px 3px #777;*/ -} -.photointoolitp { +.photointooltip { margin-top: 6px; - float: left; - /*text-align: center; */ + margin-bottom: 6px; + text-align: center; + /*-moz-box-shadow: 3px 3px 4px #DDD; + -webkit-box-shadow: 3px 3px 4px #DDD; + box-shadow: 3px 3px 4px #DDD;*/ } .photodelete { margin-top: 6px !important; @@ -3326,6 +3298,7 @@ a.websitebuttonsitepreview img { /* Module agenda */ /* ============================================================================== */ +.agendacell { height: 60px; } table.cal_month { border-spacing: 0px; } table.cal_month td:first-child { border-left: 0px; } table.cal_month td:last-child { border-right: 0px; } @@ -3336,8 +3309,8 @@ table.cal_month td:last-child { border-right: 0px; } .cal_other_month_peruserleft { border-top: 0; border-left: solid 2px #6C7C7B !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } -.cal_other_month { opacity: 0.6; background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_other_month { /* opacity: 0.6; */ background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_past_month { /* opacity: 0.6; */ background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FDFDF0; border-left: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } @@ -3349,18 +3322,10 @@ table.cal_month td:last-child { border-right: 0px; } .cal_today_peruser_impair { background: #F8F8F0; } .peruser_busy { background: #CC8888; } .peruser_notbusy { background: #EEDDDD; opacity: 0.5; } -table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); - moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); - background: -webkit-gradient(linear, left top, left bottom, from(#006aac), to(#00438d)); - min-height: 20px; - } +table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 6px; border-radius: 6px; min-height: 20px; } table.cal_event td { border: none; padding-: 2px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } table.cal_event td.cal_event { padding: 4px 4px !important; } table.cal_event td.cal_event_right { padding: 4px 4px !important; } -ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -moz-padding-start: 0px; -webkit-padding-start: 0px; } -li.cal_event { border: none; list-style-type: none; } .cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } @@ -3923,11 +3888,19 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-default { + color: #999 !important; + /*opacity: 0.2;*/ +} +.select2-choice, .select2-container .select2-choice { + border-bottom: solid 1px rgba(0,0,0,.4); +} .select2-container .select2-choice > .select2-chosen { margin-right: 23px; } .select2-container .select2-choice .select2-arrow { border-radius: 0; + background: transparent; } .select2-container-multi .select2-choices { background-image: none; @@ -3949,13 +3922,13 @@ div.dataTables_length select { border-top: none !important; border-left: none !important; border-right: none !important; - border-bottom: 1px solid #aaa; } .select2-drop.select2-drop-above { box-shadow: none !important; } .select2-drop.select2-drop-above.select2-drop-active { border-top: 1px solid #ccc; + border-bottom: solid 1px rgba(0,0,0,.2); } .select2-container-active .select2-choice, .select2-container-active .select2-choices { @@ -3991,8 +3964,6 @@ div.dataTables_length select { } .select2-dropdown-open.select2-drop-above .select2-choice, .select2-dropdown-open.select2-drop-above .select2-choices { background-image: none; - border-left: 1px solid #ccc !important; - border-right: 1px solid #ccc !important; border-radius: 0 !important; } div.select2-drop-above @@ -4015,7 +3986,7 @@ a span.select2-chosen } .select2-container .select2-choice { background-image: none; - line-height: 24px; + /* line-height: 24px; */ } .select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit { @@ -4036,6 +4007,33 @@ a span.select2-chosen .select2-container-multi .select2-choices .select2-search-choice { margin-bottom: 3px; } +.select2-dropdown-open.select2-drop-above .select2-choice, .select2-dropdown-open.select2-drop-above .select2-choices, .select2-container-multi .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border-bottom: 1px solid #ccc; + border-right: none; + border-top: none; + border-left: none; + +} + + +/* Special case for the select2 add widget */ +#addbox .select2-container .select2-choice > .select2-chosen, #actionbookmark .select2-container .select2-choice > .select2-chosen { + text-align: left; + opacity: 0.4; +} +/* Style used before the select2 js is executed on boxcombo */ +#boxbookmark.boxcombo, #boxcombo.boxcombo { + text-align: left; + opacity: 0.4; + border-bottom: solid 1px rgba(0,0,0,.4) !important; + height: 26px; + line-height: 24px; + padding: 0 0 2px 0; + vertical-align: top; +} + /* To emulate select 2 style */ .select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { padding: 2px 5px 1px 5px; @@ -4114,8 +4112,10 @@ ul.ulselectedfields { } dl.dropdown { margin:0px; + margin-left: 2px; + margin-right: 2px; padding:0px; - vertical-align: middle; + vertical-align: text-bottom; display: inline-block; } .dropdown dd, .dropdown dt { @@ -4339,6 +4339,7 @@ ul.ulmenu { } .alilevel0 { color: rgb() !important; + background: #f8f8f8 } .ulmenu { box-shadow: none !important; @@ -4362,24 +4363,9 @@ ul.ulmenu { color: # !important; text-shadow: none !important; } -/* -.ui-btn-up-c { - background: transparent; -} -*/ div.tabsElem a.tab { background: transparent; } - -/*.ui-controlgroup-horizontal .ui-btn.ui-first-child { --webkit-border-top-left-radius: 6px; -border-top-left-radius: 6px; -} -.ui-controlgroup-horizontal .ui-btn.ui-last-child { --webkit-border-top-right-radius: 6px; -border-top-right-radius: 6px; -}*/ - .alilevel1 { color: rgb() !important; } @@ -4519,10 +4505,10 @@ border-top-right-radius: 6px; /* nboftopmenuentries = , fontsize= */ /* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) /* reduction 1 */ { div.tmenucenter { - max-width: px; /* size of viewport */ + width: px; /* size of viewport */ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -4548,7 +4534,7 @@ border-top-right-radius: 6px; } } /* rule to reduce top menu - 2nd reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) /* reduction 2 */ { div.mainmenu { height: 23px; @@ -4557,6 +4543,9 @@ border-top-right-radius: 6px; max-width: px; /* size of viewport */ text-overflow: clip; } + span.mainmenuaspan { + margin-left: 1px; + } .mainmenuaspan { /*display: none;*/ font-size: 10px; @@ -4564,15 +4553,23 @@ border-top-right-radius: 6px; .topmenuimage { background-size: 20px auto; margin-top: 2px; + left: 4px; } } /* rule to reduce top menu - 3rd reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) /* reduction 3 */ { - /* Reduce login top right info */ - .usertextatoplogin { - display: none; + .side-nav { + z-index: 200; + background: #FFF; + padding-top: 70px; + } + #id-left { + z-index: 201; + background: #FFF; } + + /* Reduce login top right info */ .help { display: none; @@ -4582,19 +4579,40 @@ border-top-right-radius: 6px; display:none; - padding-: 78px; + padding-: 0; } div.login_block_user { min-width: 0; + width: 100%; } div.login_block { - top: 2px; - - max-width: 100px; + browser->layout == 'phone' && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> + display: none; + padding-top: 20px; + padding-left: 20px; + padding-right: 20px; - max-width: 82px; - + padding-top: 10px; + padding-left: 5px; + padding-right: 5px; + + top: inherit !important; + left: 0 !important; + text-align: center; + vertical-align: middle; + background: #FFF; + height: 42px; + + z-index: 202; + min-width: 190px; + max-width: 190px; + width: 190px; + } + div.login_block_user, div.login_block_other { clear: both; } + .atoplogin, .atoplogin:hover + { + color: #000 !important; } .login_block_elem { padding: 0 !important; @@ -4611,6 +4629,7 @@ border-top-right-radius: 6px; .topmenuimage { background-size: 20px auto; margin-top: 2px !important; + left: 2px; } div.mainmenu { min-width: 20px; diff --git a/htdocs/theme/md/ckeditor/config.js b/htdocs/theme/md/ckeditor/config.js index eb88af48a04..6f1bbe7fb30 100644 --- a/htdocs/theme/md/ckeditor/config.js +++ b/htdocs/theme/md/ckeditor/config.js @@ -31,25 +31,25 @@ CKEDITOR.editorConfig = function( config ) ['Templates','NewPage'], ['Save'], ['Source','Maximize','Preview'], - ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], + ['PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], + ['CreateDiv','ShowBlocks'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'], ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], - ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'], + ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['BidiLtr', 'BidiRtl'], ['Link','Unlink','Anchor'], ['Image','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'], ['Styles','Format','Font','FontSize'], - ['TextColor','BGColor'], - ['Maximize', 'ShowBlocks'] + ['TextColor','BGColor'] ]; // Used for mailing fields config.toolbar_dolibarr_mailings = [ ['Source','Maximize','Preview'], - ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], + ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Undo','Redo','-','Find','Replace'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], @@ -62,7 +62,7 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_dolibarr_notes = [ ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], + ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Undo','Redo','-','Find','Replace'], ['Format','Font','FontSize'], ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], @@ -75,9 +75,9 @@ CKEDITOR.editorConfig = function( config ) config.toolbar_dolibarr_details = [ ['Source','Maximize'], - ['Cut','Copy','Paste','-','SpellChecker', 'Scayt'], + ['SpellChecker', 'Scayt'], // 'Cut','Copy','Paste','-', are useless, can be done with right click, even on smarpthone ['Format','Font','FontSize'], - ['Bold','Italic','Underline','Strike','Subscript','Superscript','-','TextColor','RemoveFormat'], + ['Bold','Italic','Underline','Strike','-','TextColor','RemoveFormat'], // ,'Subscript','Superscript' useless ['NumberedList','BulletedList','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','SpecialChar'] diff --git a/htdocs/theme/md/img/edit.png b/htdocs/theme/md/img/edit.png index 7012f52be5a..6334689a36e 100644 Binary files a/htdocs/theme/md/img/edit.png and b/htdocs/theme/md/img/edit.png differ diff --git a/htdocs/theme/md/img/object_bookmark.png b/htdocs/theme/md/img/object_bookmark.png index 39109ef5ee6..42f702a584c 100644 Binary files a/htdocs/theme/md/img/object_bookmark.png and b/htdocs/theme/md/img/object_bookmark.png differ diff --git a/htdocs/theme/md/img/object_multicurrency.png b/htdocs/theme/md/img/object_multicurrency.png new file mode 100644 index 00000000000..51896a4c051 Binary files /dev/null and b/htdocs/theme/md/img/object_multicurrency.png differ diff --git a/htdocs/theme/md/img/reload.png b/htdocs/theme/md/img/reload.png deleted file mode 100644 index a4fac077e7a..00000000000 Binary files a/htdocs/theme/md/img/reload.png and /dev/null differ diff --git a/htdocs/theme/md/img/warning_white.png b/htdocs/theme/md/img/warning_white.png new file mode 100644 index 00000000000..56ea847427b Binary files /dev/null and b/htdocs/theme/md/img/warning_white.png differ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 9dc11fd8e41..a1b63b9c49b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -82,7 +82,7 @@ $dol_no_mouse_hover=$conf->dol_no_mouse_hover; $colorbackhmenu1='90,50,120'; // topmenu $colorbackvmenu1='255,255,255'; // vmenu $colortopbordertitle1=''; // top border of tables-lists title. not defined = default to colorbackhmenu1 -$colorbacktitle1='230,230,230'; // title of tables-lists +$colorbacktitle1='240,240,240'; // title of tables-lists $colorbacktabcard1='255,255,255'; // card $colorbacktabactive='234,234,234'; $colorbacklineimpair1='255,255,255'; // line impair @@ -90,7 +90,7 @@ $colorbacklineimpair2='255,255,255'; // line impair $colorbacklinepair1='250,250,250'; // line pair $colorbacklinepair2='248,248,248'; // line pair $colorbacklinepairhover='244,244,244'; // line pair -$colorbackbody='248,248,248'; +$colorbackbody='240,240,240'; $colortexttitlenotab='90,90,90'; $colortexttitle='20,20,20'; $colortext='0,0,0'; @@ -273,7 +273,7 @@ input.select2-input { } .select2-choice { border: none; - border-bottom: 1px solid #aaa !important; + border-bottom: 1px solid #ccc !important; } textarea.cke_source:focus @@ -281,31 +281,42 @@ textarea.cke_source:focus box-shadow: none; } -.liste_titre input[name=month], .liste_titre input[name=month_lim] { +.liste_titre input[name=monthvalid], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim] { margin-right: 4px; } input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select { font-size: px; font-family: ; border: none; - border-bottom: 1px solid #C0C0C0; + border-bottom: solid 1px rgba(0,0,0,.1); outline: none; margin: 0px 0px 0px 0px; } +input { + line-height: 17px; + padding: 4px; + padding-left: 5px; +} +select { + padding: 4px; + padding-left: 2px; +} input, select { - border-bottom: solid 1px rgba(0,0,0,.2); - - padding:4px; margin-left:0px; margin-bottom:1px; margin-top:1px; - } +} + +input, select { + border-bottom: solid 1px rgba(0,0,0,.1); +} textarea { border-radius: 0; - border: solid 1px rgba(0,0,0,.3); - border-top:solid 1px rgba(0,0,0,.3); + border-top:solid 1px rgba(0,0,0,.1); + border-left:solid 1px rgba(0,0,0,.1); + border-right:solid 1px rgba(0,0,0,.1); border-bottom:solid 1px rgba(0,0,0,.2); background-color: #FFF; @@ -335,6 +346,12 @@ span.timesheetalreadyrecorded input { select.flat, form.flat select { font-weight: normal; } +.optionblue { + color: rgb() !important; +} +.select2-results .select2-highlighted.optionblue { + color: #FFF !important; +} .optiongrey, .opacitymedium { opacity: 0.5; } @@ -382,6 +399,7 @@ input:-moz-placeholder { color:#ccc; } fieldset { border: 1px solid #AAAAAA !important; } .legendforfieldsetstep { padding-bottom: 10px; } +hr { border: 0; border-top: 1px solid #ccc; } .button, .buttonDelete, input[name="sbmtConnexion"] { font-family: ; @@ -481,6 +499,9 @@ th .button { .valignbottom { vertical-align: bottom; } +.valigntextbottom { + vertical-align: text-bottom; +} .centpercent { width: 100%; } @@ -506,15 +527,27 @@ textarea.centpercent { .nowrap { white-space: ; } +.nowraponall { + white-space: nowrap; +} .nobold { font-weight: normal !important; } .nounderline { text-decoration: none; } +.paddingleft { + padding-: 4px; +} +.paddingright { + padding-: 4px; +} .cursorpointer { cursor: pointer; } +.cusormove { + cursor: move; +} .badge { display: inline-block; min-width: 10px; @@ -529,9 +562,6 @@ textarea.centpercent { background-color: #777; border-radius: 10px; } -.movable { - cursor: move; -} .borderrightlight { @@ -566,9 +596,10 @@ div.myavailability { padding-bottom: 4px; } .checkallactions { - vertical-align: top; - margin-top: 6px; - margin-left: 4px; + /*vertical-align: text-bottom; + margin-top: 6px;*/ + margin-left: 2px; /* left must be same than right to keep checkbox centered */ + margin-right: 2px; /* left must be same than right to keep checkbox centered */ } .selectlimit, .marginrightonly { margin-right: 10px !important; @@ -582,6 +613,9 @@ div.myavailability { .strikefordisabled { text-decoration: line-through; } +.widthdate { + width: 130px; +} /* using a tdoverflowxxx make the min-width not working */ .tdoverflow { max-width: 0; @@ -595,6 +629,12 @@ div.myavailability { text-overflow: ellipsis; white-space: nowrap; } +.tdoverflowmax200 { /* For tdoverflow, the max-midth become a minimum ! */ + max-width: 200px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .tdoverflowmax300 { max-width: 300px; overflow: hidden; @@ -626,6 +666,13 @@ div.myavailability { margin-bottom: 12px; } +/* For the long description of module */ +.moduledesclong p img,.moduledesclong p a img { + max-width: 90% !important; + height: auto !important; +} + + /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { width: calc(100% - 330px); @@ -646,7 +693,7 @@ div.fiche>form>div.div-table-responsive, div.fiche>form>div.div-table-responsive overflow-x: auto; } div.fiche>form>div.div-table-responsive { - min-height: 350px; + min-height: 390px; } .flexcontainer { @@ -655,7 +702,12 @@ div.fiche>form>div.div-table-responsive { justify-content: flex-start; } .thumbstat { - flex: 1 1 120px; + flex: 1 1 114px; +} +.thumbstat150 { + flex: 1 1 150px; +} +.thumbstat, thumbstat150 { /* flex-grow: 1; */ /* flex-shrink: 1; */ /* flex-basis: 140px; */ @@ -675,18 +727,25 @@ div.fiche>form>div.div-table-responsive { /* rule for not too small screen only */ @media only screen and (min-width: px) { + .width50 { width: 50px; } + .width100 { width: 100px; } + .width200 { width: 200px; } .minwidth100 { min-width: 100px; } .minwidth200 { min-width: 200px; } .minwidth300 { min-width: 300px; } .minwidth400 { min-width: 400px; } .minwidth500 { min-width: 500px; } .minwidth50imp { min-width: 50px !important; } + .minwidth75imp { min-width: 75px !important; } .minwidth100imp { min-width: 100px !important; } .minwidth200imp { min-width: 200px !important; } .minwidth300imp { min-width: 300px !important; } .minwidth400imp { min-width: 400px !important; } .minwidth500imp { min-width: 500px !important; } } +.width50 { width: 50px; } +.width100 { width: 100px; } +.width200 { width: 200px; } .maxwidth25 { max-width: 25px; } .maxwidth50 { max-width: 50px; } .maxwidth75 { max-width: 75px; } @@ -697,6 +756,7 @@ div.fiche>form>div.div-table-responsive { .maxwidth400 { max-width: 400px; } .maxwidth500 { max-width: 500px; } .maxwidth50imp { max-width: 50px !important; } +.maxwidth75imp { max-width: 75px !important; } .minheight20 { min-height: 20px; } .minheight40 { min-height: 40px; } .titlefieldcreate { width: 20%; } @@ -711,6 +771,7 @@ div.fiche>form>div.div-table-responsive { .titlefield { width: 30% !important; } .titlefieldcreate { width: 30% !important; } .minwidth50imp { min-width: 50px !important; } + .minwidth75imp { min-width: 75px !important; } .minwidth100imp { min-width: 100px !important; } .minwidth200imp { min-width: 200px !important; } .minwidth300imp { min-width: 300px !important; } @@ -723,7 +784,8 @@ div.fiche>form>div.div-table-responsive { { .maxwidthonsmartphone { max-width: 100px; } .minwidth50imp { min-width: 50px !important; } - .minwidth100imp { min-width: 50px !important; } + .minwidth75imp { min-width: 70px !important; } + .minwidth100imp { min-width: 80px !important; } .minwidth200imp { min-width: 100px !important; } .minwidth300imp { min-width: 100px !important; } .minwidth400imp { min-width: 100px !important; } @@ -757,8 +819,8 @@ div.fiche>form>div.div-table-responsive { min-width: 20px; min-height: 1.4em; line-height: 1.4em; - padding: .4em .1em; - border: 1px solid #BBB; + /* padding: .4em .1em; */ + /* border-bottom: 1px solid #BBB; */ /* max-width: inherit; why this */ } @@ -773,11 +835,12 @@ div.fiche>form>div.div-table-responsive { .maxwidth300onsmartphone { max-width: 300px; } .maxwidth400onsmartphone { max-width: 400px; } .minwidth50imp { min-width: 50px !important; } - .minwidth100imp { min-width: 50px !important; } - .minwidth200imp { min-width: 50px !important; } - .minwidth300imp { min-width: 50px !important; } - .minwidth400imp { min-width: 50px !important; } - .minwidth500imp { min-width: 50px !important; } + .minwidth75imp { min-width: 60px !important; } + .minwidth100imp { min-width: 60px !important; } + .minwidth200imp { min-width: 60px !important; } + .minwidth300imp { min-width: 60px !important; } + .minwidth400imp { min-width: 60px !important; } + .minwidth500imp { min-width: 60px !important; } .titlefield { width: auto; } .titlefieldcreate { width: auto; } @@ -876,7 +939,7 @@ td.showDragHandle { display: block; font-family: "RobotoDraft","Roboto",sans-serif; left: 0; -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> position: fixed; top: 50px; @@ -905,7 +968,7 @@ td.showDragHandle { -moz-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); -webkit-overflow-scrolling: touch; -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> overflow-x: hidden; overflow-y: auto; @@ -917,7 +980,7 @@ td.showDragHandle { } /* For smartphone (testmenuhider is on) */ -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> #id-container { width: 100%; } @@ -929,7 +992,7 @@ div.login_block { top: inherit !important; } .side-nav { -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> overflow-x: initial !important; overflow-y: scroll; @@ -951,7 +1014,7 @@ div.login_block { z-index: 201; background: #FFF; border-right: 1px solid rgba(0,0,0,0.3); -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> top: 50px ! important; top: 60px ! important; @@ -1071,6 +1134,9 @@ table.noborder tr.liste_titre td { .pictowarning, .pictopreview { padding-: 3px; } +.pictoedit, .pictowarning, .pictodelete { + vertical-align: text-bottom; +} .colorthumb { padding-left: 1px !important; padding-right: 1px; @@ -1079,7 +1145,7 @@ table.noborder tr.liste_titre td { width: 44px; } div.attacharea { - padding-top: 10px; + padding-top: 18px; padding-bottom: 10px; } div.arearef { @@ -1104,6 +1170,9 @@ div.statusref { margin-bottom: 10px; clear: both; } +div.statusref img { + padding-left: 8px; +} img.photoref, div.photoref { border: 1px solid #CCC; -moz-box-shadow: 3px 3px 4px #DDD; @@ -1127,7 +1196,8 @@ img.photorefnoborder { height: 48px; width: 48px; object-fit: contain; - border: 1px solid #CCC; + border: 1px solid #AAA; + border-radius: 100px; } .underrefbanner { } @@ -1481,20 +1551,28 @@ foreach($mainmenuusedarray as $val) .bodylogin { background: #f0f0f0; + display: table; + position: absolute; + height: 100%; + width: 100%; } +.login_center { + display: table-cell; + vertical-align: middle; +} .login_vertical_align { padding: 10px; } form#login { - margin-top: px; - margin-bottom: 30px; + padding-bottom: 30px; font-size: 13px; vertical-align: middle; } .login_table_title { max-width: 530px; - color: #888888 !important; - text-shadow: 1px 1px 1px #FFF; + color: #aaa !important; + padding-top: 30px; + /* text-shadow: 1px 1px 1px #FFF; */ } .login_table label { text-shadow: 1px 1px 1px #FFF; @@ -1512,9 +1590,6 @@ form#login { -moz-box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); -webkit-box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); box-shadow: 0 4px 23px 5px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(60,60,60,0.15); - /*-moz-box-shadow: 3px 2px 20px #CCC; - -webkit-box-shadow: 3px 2px 20px #CCC; - box-shadow: 3px 2px 20px #CCC;*/ border-radius: 4px; border:solid 1px rgba(80,80,80,.4); @@ -1582,7 +1657,7 @@ div.login_block { padding-bottom: 3px; : 0; top: 0px; -global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +browser->layout, array('phone','tablet')) && ((GETPOST('testmenuhider') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) { ?> position: absolute; position: fixed; @@ -1622,7 +1697,7 @@ div.login_block_other { padding-top: 3px; } height: 16px; } .login_block_elem_name { - margin-top: 5px; + margin-top: 1px; } .atoplogin, .atoplogin:hover { color: # !important; @@ -1636,6 +1711,10 @@ div.login_block_other { padding-top: 3px; } .alogin:hover, .atoplogin:hover { text-decoration:underline !important; } +span.fa.atoplogin, span.fa.atoplogin:hover { + font-size: 16px; + text-decoration: none !important; +} img.login, img.printer, img.entity { /* padding: 0px 0px 0px 4px; */ /* margin: 0px 0px 0px 8px; */ @@ -1643,13 +1722,27 @@ img.login, img.printer, img.entity { color: white; font-weight: bold; } -img.loginphoto { - border-radius: 5px; - margin-top: -4px; - width: 20px; - height: 20px; +.userimgatoplogin img.userphoto { /* size for user photo in login bar */ + border-radius: 8px; + width: 16px; + height: 16px; + background-size: contain; + vertical-align: text-bottom; +} +img.userphoto { /* size for user photo in lists */ + border-radius: 9px; + width: 18px; + height: 18px; + background-size: contain; + vertical-align: middle; +} +img.userphotosmall { /* size for user photo in lists */ + border-radius: 6px; + width: 12px; + height: 12px; + background-size: contain; + vertical-align: middle; } - .span-icon-user { background-image: url(); background-repeat: no-repeat; @@ -1697,7 +1790,7 @@ div.vmenu, td.vmenu { } #menu_contenu_logo { padding-right: 4px; } .companylogo { padding-top: 4px; } -.searchform { padding-top: 8px; } +.searchform { padding-top: 10px; } a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { white-space: nowrap; font-size:px; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-size:px; font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } @@ -1710,8 +1803,11 @@ font.vsmenudisabledmargin { margin: 1px 1px 1px 8px; } a.help:link, a.help:visited, a.help:hover, a.help:active, span.help { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; text-decoration: none; } - -div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks +div.blockvmenulogo +{ + border-bottom: 0 !important; +} +div.blockvmenupair, div.blockvmenuimpair { font-family: ; color: #000000; @@ -1726,11 +1822,21 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks padding-bottom: 10px; border-bottom: 1px solid #e0e0e0; } +div.blockvmenubookmarks +{ + padding-bottom: 16px !important; +} +div.blockvmenuend { + border: none !important; + padding-left: 0 !important; +} a.vsmenu.addbookmarkpicto { padding-right: 10px; } - -div.blockvmenusearch +div.blockvmenufirst { + padding-top: 10px; +} +div.blockvmenusearch, div.blockvmenubookmarks { font-family: ; color: #000000; @@ -1740,7 +1846,7 @@ div.blockvmenusearch padding-right: 1px; padding-top: 3px; padding-bottom: 3px; - margin: 1px 0px 12px 0px; + margin: 1px 0px 2px 0px; padding-bottom: 10px; /* border-bottom: 1px solid #f4f4f4; */ @@ -1872,30 +1978,29 @@ div.tabBar { padding-top: px; padding-left: px; padding-right: px; - padding-bottom: px; - margin: 0px 0px 14px 0px; + margin: 0px 0px 16px 0px; -moz-border-radius:3px; -webkit-border-radius: 3px; border-radius: 3px; border-right: 1px solid #BBB; - border-bottom: 1px solid #BBB; border-left: 1px solid #BBB; border-top: 1px solid #CCC; width: auto; - background: rgb(); - /* - - -moz-box-shadow: 3px 3px 4px #f4f4f4; - -webkit-box-shadow: 3px 3px 4px #f4f4f4; - box-shadow: 3px 3px 4px #f4f4f4; - - */ + padding-bottom: 12px; + border-bottom: 1px solid #aaa; +} +div.tabBarWithBottom { + padding-bottom: 18px; + border-bottom: 1px solid #aaa; +} +div.tabBar table.tableforservicepart2:last-child { + border-bottom: 1px solid #aaa; } div.tabsAction { - margin: 20px 0em 10px 0em; + margin: 20px 0em 20px 0em; padding: 0em 0em; text-align: right; } @@ -2184,9 +2289,7 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd table.border, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { - border: 1px solid #f4f4f4; - border-collapse: collapse !important; padding: 1px 2px 1px 3px; /* t r b l */ } @@ -2195,7 +2298,7 @@ table.borderplus { } .border tbody tr, .border tbody tr td, div.tabBar table.border tr { - height: 20px; + height: 22px; } table.border td, div.border div div.tagtd { @@ -2221,6 +2324,9 @@ td.border, div.tagtable div div.border { /* Main boxes */ +.noborderbottom { + border-bottom: none !important; +} .ficheaddleft table.noborder { margin: 0px 0px 0px 0px; } @@ -2261,6 +2367,18 @@ table.paddingtopbottomonly tr td { padding-bottom: 2px; } +.liste_titre_filter { + background: rgb() !important; +} +tr.liste_titre_filter td.liste_titre { + border-bottom: 1px solid #FDFFFF; +} +.liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd +{ + /*border-top-width: 1px; + border-top-color: rgb(); + border-top-style: solid;*/ +} .liste_titre_add td, .liste_titre_add th, .liste_titre_add .tagtd { border-top-width: 2px; @@ -2290,19 +2408,19 @@ div.liste_titre_bydiv .divsearchfield { table.nobordernopadding { border-collapse: collapse !important; - border: 0px; + border: 0; } table.nobordernopadding tr { - border: 0px !important; - padding: 0px 0px !important; + border: 0 !important; + padding: 0 0 !important; } table.nobordernopadding tr td { - border: 0px; + border: 0 !important; padding: 0 3px 0 0; } table.border tr td table.nobordernopadding tr td { - padding-top: 0px; - padding-bottom: 0px; + padding-top: 0; + padding-bottom: 0; } td.borderright { border: none; /* to erase value for table.nobordernopadding td */ @@ -2330,7 +2448,7 @@ div.refid { font-size: 160%; } div.refidno { - padding-top: 2px; + padding-top: 8px; font-weight: normal; color: #444; font-size: px; @@ -2370,7 +2488,7 @@ div.pagination li { div.pagination li.pagination a, div.pagination li.pagination span { padding: 6px 12px; - margin-left: -1px; + padding-top: 8px; line-height: 1.42857143; color: #000; text-decoration: none; @@ -2410,9 +2528,10 @@ div.pagination li a:hover, div.pagination li span:hover, div.pagination li a:focus, div.pagination li span:focus { - color: #000; - background-color: #eee; - border-color: #ddd; + color: #000; + background-color: #eee; + border-color: #ddd; + padding-top: 8px; } div.pagination li .active a, div.pagination li .active span, @@ -2439,6 +2558,7 @@ div.pagination .disabled a:focus { } div.pagination li.pagination .active { text-decoration: underline; + box-shadow: none; } div.pagination li.paginationafterarrows { margin-left: 10px; @@ -2475,44 +2595,48 @@ div.pagination li.paginationafterarrows { */ /* Set the color for hover lines */ -.odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover, .box_pair:hover, .box_impair:hover +.oddeven:hover, .odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover { background: rgb() !important; } -.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover, tr.box_pair td.nohover, tr.box_impair td.nohover +.oddeven, .odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover { font-family: ; border: 0px; margin-bottom: 1px; color: #202020; - min-height: 18px; /* seems to not be used */ - +} +.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover +{ background: #; } #GanttChartDIV { background: #; } -.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { +.oddeven, .even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { font-family: ; margin-bottom: 1px; color: #202020; - +} +.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover { background-color: #; } -table.dataTable tr.odd { +table.dataTable tr.odd, table.dataTable tr.oddeven { background-color: # !important; } /* For no hover style */ -table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td { +td.oddeven, table.nohover tr.impair, table.nohover tr.pair, table.nohover tr.impair td, table.nohover tr.pair td, tr.nohover td, form.nohover, form.nohover:hover { background-color: # !important; + background: # !important; } tr.nohoverpair td { background-color: # !important; + background: # !important; } table.dataTable td { @@ -2592,6 +2716,10 @@ tr.liste_titre th, tr.liste_titre td, th.liste_titre, form.liste_titre div, div. { border-bottom: 1px solid #; } +/* TODO Once title line is moved under title search, make border bottom of all th black and force to whit when it's first tr */ +tr:first-child th.liste_titre { + border-bottom: 1px solid #FFF ! important; +} tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre { font-family: ; @@ -2616,7 +2744,7 @@ tr.liste_titre_topborder td { .liste_titre td a.notasortlink:hover { background: transparent; } -tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel { /* For last line of table headers only */ +tr.liste_titre:last-child th.liste_titre, tr.liste_titre:last-child th.liste_titre_sel, tr.liste_titre td.liste_titre, tr.liste_titre td.liste_titre_sel, form.liste_titre div.tagtd { /* For last line of table headers only */ border-bottom: 1px solid rgb(); } @@ -2694,6 +2822,31 @@ div .tdtop { } +/* Prepare to remove class pair - impair */ + +.noborder > tbody > tr:nth-child(even):not(.liste_titre), .liste > tbody > tr:nth-child(even):not(.liste_titre) { + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); +} +.noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre) { + border-bottom: 1px solid #ddd; +} + +.noborder > tbody > tr:nth-child(odd):not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(.liste_titre) { + background: linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); + background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); +} +.noborder > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(odd):not(:last-child) td:not(.liste_titre) { + border-bottom: 1px solid #ddd; +} + + /* * Boxes */ @@ -2701,52 +2854,97 @@ div .tdtop { .ficheaddleft div.boxstats { border: none; } -.boxstats { +.boxstatsborder { + border: 1px solid #CCC !important; +} +.boxstats, .boxstats130 { display: inline-block; margin: 3px; - padding: 3px; - /*-moz-box-shadow: 3px 3px 4px #f4f4f4; - -webkit-box-shadow: 3px 3px 4px #f4f4f4; - box-shadow: 3px 3px 4px #f4f4f4; - margin-bottom: 8px !important;*/ border: 1px solid #CCC; text-align: center; border-radius: 2px; - min-height: 38px; - +} +.boxstats, .boxstats130, .boxstatscontent { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; +} +.boxstats { + padding: 3px; width: 105px; } +.boxstats130 { + width: 135px; + height: 48px; + padding: 3px +} +@media only screen and (max-width: 767px) +{ + .thumbstat150 { + flex: 1 1 110px; + } + .boxstats, .boxstats130 { + width: 90px; + } + .dashboardlineindicator { + float: left; + padding-left: 5px; + } +} .boxstats:hover { box-shadow: 0px 0px 8px 0px rgba(0,0,0,0.20); } span.boxstatstext { - /* opacity: 0.9; Disabled. This make text on top of left menu in smartphone size */ line-height: 18px; + opacity: 0.7; } span.boxstatsindicator { font-size: 110%; font-weight: normal; + font-color: rgb(); } span.dashboardlineindicator, span.dashboardlineindicatorlate { font-size: 120%; - font-weight: bold; + font-weight: normal; +} +.dashboardlineindicatorlate img { + width: 16px; } span.dashboardlineok { color: #008800; } span.dashboardlineko { - color: #880000; - font-weight: bold; + color: #FFF; + font-size: 80%; +} +.dashboardlinelatecoin { + float: right; + position: relative; + text-align: right; + top: -24px; + padding: 1px 6px 1px 6px; + background-color: #8c4446; + color: #FFFFFF ! important; + border-radius: .25em; } .boxtable { margin-bottom: 8px !important; + border-bottom-width: 1px; +} +.boxtable { + margin-bottom: 8px !important; + border-bottom-width: 1px; +} +.boxtablenobottom { + border-bottom-width: 0 !important; } .tdboxstats { text-align: center; } +a.valignmiddle.dashboardlineindicator { + line-height: 30px; +} + .box { padding-right: 0px; @@ -2783,28 +2981,10 @@ tr.box_titre { tr.box_titre td.boxclose { width: 30px; } - -tr.box_impair { - background: -o-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -moz-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -webkit-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: -ms-linear-gradient(bottom, rgb() 85%, rgb() 100%); - background: linear-gradient(bottom, rgb() 85%, rgb() 100%); - font-family: ; +img.boxhandle, img.boxclose { + padding-left: 5px; } -tr.box_pair { - font-family: ; - - background-color: #f9f9f9; -} - -tr.box_pair td, tr.box_impair td { - padding: 4px; -} -tr.box_pair:not(:last-child) td, tr.box_impair:not(:last-child) td { - border-bottom: 1px solid #eee; -} .noborderbottom { border-bottom: none !important; } @@ -3240,6 +3420,7 @@ a.websitebuttonsitepreview img { /* Module agenda */ /* ============================================================================== */ +.agendacell { height: 60px; } table.cal_month { border-spacing: 0px; } table.cal_month td:first-child { border-left: 0px; } table.cal_month td:last-child { border-right: 0px; } @@ -3250,8 +3431,8 @@ table.cal_month td:last-child { border-right: 0px; } .cal_other_month_peruserleft { border-top: 0; border-left: solid 2px #6C7C7B !important; border-right: 0; } .cal_current_month_right { border-right: solid 1px #E0E0E0; } .cal_other_month_right { border-right: solid 1px #C0C0C0; } -.cal_other_month { opacity: 0.6; background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } -.cal_past_month { opacity: 0.6; background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_other_month { /* opacity: 0.6; */ background: #EAEAEA; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } +.cal_past_month { /* opacity: 0.6; */ background: #EEEEEE; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month { background: #FFFFFF; border-left: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_current_month_peruserleft { background: #FFFFFF; border-left: solid 2px #6C7C7B; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } .cal_today { background: #FDFDF0; border-left: solid 1px #E0E0E0; border-bottom: solid 1px #E0E0E0; padding-: 2px; padding-: 1px; padding-top: 0px; padding-bottom: 0px; } @@ -3263,18 +3444,10 @@ table.cal_month td:last-child { border-right: 0px; } .cal_today_peruser_impair { background: #F8F8F0; } .peruser_busy { background: #CC8888; } .peruser_notbusy { background: #EEDDDD; opacity: 0.5; } -table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 3px; border-radius: 3px; - -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); - moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.25); - background: -webkit-gradient(linear, left top, left bottom, from(#006aac), to(#00438d)); - min-height: 20px; - } +table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px; -webkit-border-radius: 3px; border-radius: 3px; min-height: 20px; } table.cal_event td { border: none; padding-: 2px; padding-: 2px; padding-top: 0px; padding-bottom: 0px; } table.cal_event td.cal_event { padding: 4px 4px !important; } table.cal_event td.cal_event_right { padding: 4px 4px !important; } -ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -moz-padding-start: 0px; -webkit-padding-start: 0px; } -li.cal_event { border: none; list-style-type: none; } .cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:visited { color: #111111; font-size: 11px; font-weight: normal !important; } .cal_event a:active { color: #111111; font-size: 11px; font-weight: normal !important; } @@ -3844,6 +4017,9 @@ div.dataTables_length select { /* Select2 */ /* ============================================================================== */ +.select2-container .select2-choice { + border-bottom: 1px solid #ccc; +} .select2-container .select2-choice > .select2-chosen { margin-right: 23px; } @@ -3871,13 +4047,14 @@ div.dataTables_length select { border-top: none !important; border-left: none !important; border-right: none !important; - border-bottom: 1px solid #aaa; + border-bottom: 1px solid #ccc; } .select2-drop.select2-drop-above { box-shadow: none !important; } .select2-drop.select2-drop-above.select2-drop-active { border-top: 1px solid #ccc; + border-bottom: 1px solid #ccc; } .select2-container-active .select2-choice, .select2-container-active .select2-choices { @@ -3913,8 +4090,6 @@ div.dataTables_length select { } .select2-dropdown-open.select2-drop-above .select2-choice, .select2-dropdown-open.select2-drop-above .select2-choices { background-image: none; - border-left: 1px solid #ccc !important; - border-right: 1px solid #ccc !important; border-radius: 0 !important; } div.select2-drop-above @@ -3958,13 +4133,40 @@ a span.select2-chosen .select2-container-multi .select2-choices .select2-search-choice { margin-bottom: 3px; } +.select2-dropdown-open.select2-drop-above .select2-choice, .select2-dropdown-open.select2-drop-above .select2-choices, .select2-container-multi .select2-choices, +.select2-container-multi.select2-container-active .select2-choices +{ + border-bottom: 1px solid #ccc; + border-right: none; + border-top: none; + border-left: 1px solid #ddd; +} + + + +/* Special case for the select2 add widget */ +#addbox .select2-container .select2-choice > .select2-chosen, #actionbookmark .select2-container .select2-choice > .select2-chosen { + text-align: left; + opacity: 0.3; +} +/* Style used before the select2 js is executed on boxcombo */ +#boxbookmark.boxcombo, #boxcombo.boxcombo { + text-align: left; + opacity: 0.3; + border-bottom: solid 1px rgba(0,0,0,.4) !important; + height: 26px; + line-height: 24px; + padding: 0 0 5px 5px; + vertical-align: top; +} + /* To emulate select 2 style */ .select2-container-multi-dolibarr .select2-choices-dolibarr .select2-search-choice-dolibarr { padding: 2px 5px 1px 5px; margin: 0 0 2px 3px; position: relative; line-height: 13px; - color: #333; + color: #444; cursor: default; border: 1px solid #ddd; border-radius: 3px; @@ -4036,7 +4238,9 @@ ul.ulselectedfields { dl.dropdown { margin:0px; padding:0px; - vertical-align: middle; + margin-left: 2px; + margin-right: 2px; + vertical-align: text-bottom; display: inline-block; } .dropdown dd, .dropdown dt { diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 62efff2f88f..d8aba34a934 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -151,9 +151,13 @@ print ''; $head=user_prepare_head($object); -dol_fiche_head($head, 'extsites', $langs->trans("User"), 0, 'user'); +dol_fiche_head($head, 'extsites', $langs->trans("User"), -1, 'user'); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''; + +if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; +} dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); @@ -185,8 +189,8 @@ while ($i <= $MAXAGENDA) $offsettz='AGENDA_EXT_OFFSETTZ_'.$id.'_'.$key; $color='AGENDA_EXT_COLOR_'.$id.'_'.$key; - $var=!$var; - print ""; + + print ''; // Nb print '"; // Name diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 63cdacf958d..c9551cdbc23 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -131,9 +131,13 @@ if ($id && $action == 'create' && $user->rights->user->user->creer) if ($id && $action != 'edit') { $title = $langs->trans("User"); - dol_fiche_head($head, 'bank', $title, 0, 'user'); + dol_fiche_head($head, 'bank', $title, -1, 'user'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''; + + if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; + } dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); @@ -232,14 +236,14 @@ if ($id && $action == 'edit' && $user->rights->user->user->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + dol_banner_tab($object, 'id', $linkback,$user->rights->user->user->lire || $user->admin); - print '
    '; + //print '
    '; print '
    '; print '
    '.$langs->trans("TotalHT").''.price($total).'
    '.$langs->trans("TotalHTforthispage").''.price($total).'
    '.$langs->trans("AgendaExtNb",$key)."
    '; - print ''; + print ''; print ''; print ''; @@ -271,29 +275,29 @@ if ($id && $action == 'edit' && $user->rights->user->user->creer) } // IBAN - print ''; + print ''; print ''; - print ''; + print ''; print ''; print '"; - print ''; + print ''; print ''; print "\n"; print '"; print '
    '.$langs->trans("LabelRIB").'
    '.$langs->trans("LabelRIB").'
    '.$langs->trans("BankName").'
    '.$langs->trans("IBAN").'
    '.$langs->trans("IBAN").'
    '.$langs->trans("BIC").'
    '.$langs->trans("BIC").'
    '.$langs->trans("BankAccountDomiciliation").''; - print '
    '.$langs->trans("BankAccountOwner").'
    '.$langs->trans("BankAccountOwner").'
    '.$langs->trans("BankAccountOwnerAddress").''; - print "
    '; - print ''; + //print ''; dol_fiche_end(); @@ -304,6 +308,10 @@ if ($id && $action == 'edit' && $user->rights->user->user->creer) print ''; } +if ($id && $action == 'edit' && $user->rights->user->user->creer) print ''; + +if ($id && $action == 'edit' && $user->rights->user->user->creer) print ''; + llxFooter(); $db->close(); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 10c3d433c2c..3255dc676cf 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -37,6 +37,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -590,6 +591,11 @@ if (empty($reshook)) { setEventMessages($ldap->error, $ldap->errors, 'errors'); } } + + // Actions to build doc + $upload_dir = $conf->user->dir_output; + $permissioncreate=$user->rights->user->user->creer; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -600,6 +606,7 @@ if (empty($reshook)) { $form = new Form($db); $formother=new FormOther($db); $formcompany = new FormCompany($db); +$formfile = new FormFile($db); llxHeader('',$langs->trans("UserCard")); @@ -716,11 +723,10 @@ if (($action == 'create') || ($action == 'adduserldap')) print dol_set_focus('#lastname'); - print ''; - - print ''; + print '
    '; // Lastname + print ''; print ''; print '"; + print ''; print ''; print '
    '.$langs->trans("Lastname").''; if (! empty($ldap_lastname)) @@ -1196,7 +1202,11 @@ else else { $title = $langs->trans("User"); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''; + + if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; + } } $head = user_prepare_head($object); @@ -1250,7 +1260,6 @@ else dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); - print '
    '; print '
    '; @@ -1711,9 +1720,9 @@ else foreach($groupslist as $group) { - $var=!$var; + - print "
    '; if ($caneditgroup) { @@ -2339,8 +2348,40 @@ else print ''; } - if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close; + if ($action != 'edit') + { + print '
    '; + /* + * Documents generes + */ + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->user->dir_output . "/" . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->user->user->creer; + $delallowed = $user->rights->user->user->supprimer; + + $var = true; + + $somethingshown = $formfile->show_documents('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, null); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + print '
    '; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'user', $socid); + + + print '
    '; + } + + if (! empty($conf->ldap->enabled) && ! empty($object->ldap_sid)) $ldap->close(); } + } if (! empty($conf->api->enabled) && ! empty($conf->use_javascript_ajax)) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f40685715c6..a3006d6ebcd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -4,7 +4,7 @@ * Copyright (c) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2005-2016 Regis Houssin + * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2013-2014 Philippe Grand @@ -104,32 +104,32 @@ class User extends CommonObject public $lang; public $rights; // Array of permissions user->rights->permx - public $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ - private $_tab_loaded=array(); // Array of cache of already loaded permissions - public $nb_rights; // Number of rights granted to the user - + public $all_permissions_are_loaded; // All permission are loaded + public $nb_rights; // Number of rights granted to the user + private $_tab_loaded=array(); // Cache array of already loaded permissions + public $conf; // To store personal config - var $oldcopy; // To contains a clone of this when we need to save old properties of object - + public $default_values; // To store default values for user + public $users; // To store all tree of users hierarchy public $parentof; // To store an array of all parents for all ids. - - public $accountancy_code; // Accountancy code in prevision of the complete accountancy module + private $cache_childids; + public $accountancy_code; // Accountancy code in prevision of the complete accountancy module + public $thm; // Average cost of employee - Used for valuation of time spent public $tjm; // Average cost of employee - - public $salary; // Monthly salary - Denormalized value from llx_user_employment + + public $salary; // Monthly salary - Denormalized value from llx_user_employment public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment public $color; // Define background color for user in agenda - + public $dateemployment; // Define date of employment by company - private $cache_childids; - - + + /** * Constructor de la classe * @@ -164,11 +164,11 @@ class User extends CommonObject * @param int $id If defined, id to used for search * @param string $login If defined, login to used for search * @param string $sid If defined, sid to used for search - * @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx) + * @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx), 0=do not load personal conf. * @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup. * @return int <0 if KO, 0 not found, >0 if OK */ - function fetch($id='', $login='',$sid='',$loadpersonalconf=1, $entity=-1) + function fetch($id='', $login='', $sid='', $loadpersonalconf=0, $entity=-1) { global $conf, $user; @@ -339,6 +339,7 @@ class User extends CommonObject // To get back the global configuration unique to the user if ($loadpersonalconf) { + // Load user->conf for user $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; $sql.= " WHERE fk_user = ".$this->id; $sql.= " AND entity = ".$conf->entity; @@ -359,9 +360,32 @@ class User extends CommonObject } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); return -2; } + + // Load user->default_values for user. TODO Save this in memcached ? + $sql = "SELECT rowid, entity, type, page, param, value"; + $sql.= " FROM ".MAIN_DB_PREFIX."default_values"; + $sql.= " WHERE entity IN (".$this->entity.",".$conf->entity.")"; + $sql.= " AND user_id IN (0, ".$this->id.")"; + $resql = $this->db->query($sql); + if ($resql) + { + while ($obj = $this->db->fetch_object($resql)) + { + if (! empty($obj->page) && ! empty($obj->type) && ! empty($obj->param)) + { + $user->default_values[$obj->page][$obj->type][$obj->param]=$obj->value; + } + } + $this->db->free($resql); + } + else + { + $this->error=$this->db->lasterror(); + return -3; + } } return 1; @@ -461,13 +485,13 @@ class User extends CommonObject if (! $error && ! $notrigger) { $this->context = array('audit'=>$langs->trans("PermissionsAdd")); - + // Call trigger $result=$this->call_trigger('USER_MODIFY',$user); if ($result < 0) { $error++; } // End call triggers } - + if ($error) { $this->db->rollback(); return -$error; @@ -570,13 +594,13 @@ class User extends CommonObject if (! $error && ! $notrigger) { $this->context = array('audit'=>$langs->trans("PermissionsDelete")); - + // Call trigger $result=$this->call_trigger('USER_MODIFY',$user); if ($result < 0) { $error++; } // End call triggers } - + if ($error) { $this->db->rollback(); return -$error; @@ -962,7 +986,7 @@ class User extends CommonObject $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user"; $sql.= " WHERE login ='".$this->db->escape($this->login)."'"; $sql.= " AND entity IN (0,".$this->db->escape($conf->entity).")"; - + dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) @@ -995,7 +1019,7 @@ class User extends CommonObject $this->db->rollback(); return -5; } - + // Update minor fields $result = $this->update($user,1,1); if ($result < 0) @@ -1015,7 +1039,7 @@ class User extends CommonObject $entrepot->country_id = $mysoc->country_id; $entrepot->create($user); } - + if (! $notrigger) { // Call trigger @@ -1084,7 +1108,7 @@ class User extends CommonObject $this->state_id = $contact->state_id; $this->country_id = $contact->country_id; $this->employee = 0; - + if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); $this->login = $login; @@ -1347,7 +1371,7 @@ class User extends CommonObject $sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null"); $sql.= ", entity = '".$this->db->escape($this->entity)."'"; $sql.= " WHERE rowid = ".$this->id; - + dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1384,7 +1408,7 @@ class User extends CommonObject if ($this->fk_member > 0 && ! $nosyncmember) { dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); - + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; // This user is linked with a member, so we also update members informations @@ -1398,9 +1422,9 @@ class User extends CommonObject $adh->lastname=$this->lastname; $adh->login=$this->login; $adh->gender=$this->gender; - + $adh->pass=$this->pass; - + $adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe); $adh->email=$this->email; @@ -1675,7 +1699,7 @@ class User extends CommonObject $appli=constant('DOL_APPLICATION_TITLE'); if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; - + $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli); // Define $urlwithroot @@ -1685,23 +1709,23 @@ class User extends CommonObject if (! $changelater) { $url = $urlwithroot.'/'; - + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= "\n"; - + $mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n"; $mesg.= "--\n"; $mesg.= $user->getFullName($outputlangs); // Username that make then sending - + dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); } else { $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); - + $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; @@ -1710,7 +1734,7 @@ class User extends CommonObject $mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; $mesg.= $url."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; - + dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } @@ -1859,7 +1883,7 @@ class User extends CommonObject { $this->newgroupid=$group; // deprecated. Remove this. $this->context = array('audit'=>$langs->trans("UserSetInGroup"), 'newgroupid'=>$group); - + // Call trigger $result=$this->call_trigger('USER_MODIFY',$user); if ($result < 0) { $error++; } @@ -1914,7 +1938,7 @@ class User extends CommonObject { $this->oldgroupid=$group; // deprecated. Remove this. $this->context = array('audit'=>$langs->trans("UserRemovedFromGroup"), 'oldgroupid'=>$group); - + // Call trigger $result=$this->call_trigger('USER_MODIFY',$user); if ($result < 0) { $error++; } @@ -1968,7 +1992,7 @@ class User extends CommonObject * Return a link to the user card (with optionaly the picto) * Use this->id,this->lastname, this->firstname * - * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo) + * @param int $withpictoimg Include picto in link (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 string $option On what the link point to * @param integer $infologin Add complete info tooltip * @param integer $notooltip 1=Disable tooltip on picto and name @@ -1981,77 +2005,77 @@ class User extends CommonObject function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='') { global $langs, $conf, $db, $hookmanager; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; - $result = ''; - $companylink = ''; - $link = ''; - - $label = '' . $langs->trans("User") . ''; - $label.= '
    '; - $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); - if (! empty($this->login)) - $label.= '
    ' . $langs->trans('Login') . ': ' . $this->login; - $label.= '
    ' . $langs->trans("EMail").': '.$this->email; - if (! empty($this->admin)) - $label.= '
    ' . $langs->trans("Administrator").': '.yn($this->admin); - if (! empty($this->societe_id) ) // Add thirdparty for external users - { - $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($this->societe_id); - if (empty($hidethirdpartylogo)) $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company - $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; - } - $type=($this->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); - $label.= '
    ' . $langs->trans("Type") . ': ' . $type; - $label.='
    '; - if (! empty($this->photo)) - { - $label.= '
    '; - $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); - $label.= '
    '; - } + $result=''; $label=''; + $link=''; $linkstart=''; $linkend=''; + + if (! empty($this->photo)) + { + $label.= '
    '; + $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); + $label.= '
    '; + } + + $label.= '
    '; + $label.= '' . $langs->trans("User") . '
    '; + $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,'',''); + if (! empty($this->login)) + $label.= '
    ' . $langs->trans('Login') . ': ' . $this->login; + $label.= '
    ' . $langs->trans("EMail").': '.$this->email; + if (! empty($this->admin)) + $label.= '
    ' . $langs->trans("Administrator").': '.yn($this->admin); + if (! empty($this->societe_id) ) // Add thirdparty for external users + { + $thirdpartystatic = new Societe($db); + $thirdpartystatic->fetch($this->societe_id); + if (empty($hidethirdpartylogo)) $companylink = ' '.$thirdpartystatic->getNomUrl(2); // picto only of company + $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; + } + $type=($this->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); + $label.= '
    ' . $langs->trans("Type") . ': ' . $type; + $label.='
    '; - // Info Login - if ($infologin) - { - $label.= '
    '; - $label.= '
    '.$langs->trans("Connection").''; - $label.= '
    '.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; - if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $label.= '
    '.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; - $label.= '
    '.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); - $label.= '
    '.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin,"dayhour",'tzuser'); - $label.= '
    '.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin,"dayhour",'tzuser'); - $label.= '
    '.$langs->trans("CurrentTheme").': '.$conf->theme; - $label.= '
    '.$langs->trans("CurrentMenuManager").': '.$menumanager->name; - $s=picto_from_langcode($langs->getDefaultLang()); - $label.= '
    '.$langs->trans("CurrentUserLanguage").': '.($s?$s.' ':'').$langs->getDefaultLang(); - $label.= '
    '.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; - $label.= '
    '.$langs->trans("Layout").': '.$conf->browser->layout; - $label.= '
    '.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; - if (! empty($conf->browser->phone)) $label.= '
    '.$langs->trans("Phone").': '.$conf->browser->phone; - if (! empty($_SESSION["disablemodules"])) $label.= '
    '.$langs->trans("DisabledModules").':
    '.join(', ',explode(',',$_SESSION["disablemodules"])); - } + // Info Login + if ($infologin) + { + $label.= '
    '; + $label.= '
    '.$langs->trans("Connection").''; + $label.= '
    '.$langs->trans("IPAddress").': '.$_SERVER["REMOTE_ADDR"]; + if (! empty($conf->global->MAIN_MODULE_MULTICOMPANY)) $label.= '
    '.$langs->trans("ConnectedOnMultiCompany").': '.$conf->entity.' (user entity '.$this->entity.')'; + $label.= '
    '.$langs->trans("AuthenticationMode").': '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo)?'':' (demo)'); + $label.= '
    '.$langs->trans("ConnectedSince").': '.dol_print_date($this->datelastlogin,"dayhour",'tzuser'); + $label.= '
    '.$langs->trans("PreviousConnexion").': '.dol_print_date($this->datepreviouslogin,"dayhour",'tzuser'); + $label.= '
    '.$langs->trans("CurrentTheme").': '.$conf->theme; + $label.= '
    '.$langs->trans("CurrentMenuManager").': '.$menumanager->name; + $s=picto_from_langcode($langs->getDefaultLang()); + $label.= '
    '.$langs->trans("CurrentUserLanguage").': '.($s?$s.' ':'').$langs->getDefaultLang(); + $label.= '
    '.$langs->trans("Browser").': '.$conf->browser->name.($conf->browser->version?' '.$conf->browser->version:'').' ('.$_SERVER['HTTP_USER_AGENT'].')'; + $label.= '
    '.$langs->trans("Layout").': '.$conf->browser->layout; + $label.= '
    '.$langs->trans("Screen").': '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight']; + if (! empty($conf->browser->phone)) $label.= '
    '.$langs->trans("Phone").': '.$conf->browser->phone; + if (! empty($_SESSION["disablemodules"])) $label.= '
    '.$langs->trans("DisabledModules").':
    '.join(', ',explode(',',$_SESSION["disablemodules"])); + } - - if ($option == 'leave') $link.= '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:'').'"'; - } + + if ($option == 'leave') $link.= '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:'').'"'; + } if (! is_object($hookmanager)) { include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; @@ -2071,11 +2095,13 @@ class User extends CommonObject { $paddafterimage=''; if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"'; - if ($withpictoimg > 0) $picto='
    '.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'
    '; - else $picto='
    '.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'
    '; - $result.=$picto; + // 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('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'
    '; + $result.=$picto; } - if (abs($withpictoimg) != 2) + if ($withpictoimg > -2 && $withpictoimg != 2) { if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
    '; if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); @@ -2084,7 +2110,9 @@ class User extends CommonObject } $result.=$linkend; //if ($withpictoimg == -1) $result.='
    '; + $result.=$companylink; + return $result; } @@ -2116,7 +2144,7 @@ class User extends CommonObject } /** - * Retourne le libelle du statut d'un user (actif, inactif) + * Return label of status of user (active, inactive) * * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status @@ -2208,13 +2236,14 @@ class User extends CommonObject $this->fullname=$this->getFullName($langs); // Champs - if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname; - if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname; - if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname; - if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login; - if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login; - if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte - if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid; + if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname; + if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname; + if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname; + if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login; + if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login; + if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte + if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption + if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid; if ($this->societe_id > 0) { $soc = new Societe($this->db); @@ -2455,7 +2484,7 @@ class User extends CommonObject * Return and array with all instanciated first level children users of current user * * @return void - * @see getAllChildIds + * @see getAllChildIds */ function get_children() { @@ -2586,7 +2615,7 @@ class User extends CommonObject foreach($this->users as $key => $val) { $result = $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent) - if ($result < 0) + if ($result < 0) { $this->error='ErrorLoopInHierarchy'; return -1; @@ -2630,7 +2659,7 @@ class User extends CommonObject function getAllChildIds($addcurrentuser=0) { $childids=array(); - + if (isset($this->cache_childids[$this->id])) { $childids = $this->cache_childids[$this->id]; @@ -2639,20 +2668,20 @@ class User extends CommonObject { // Init this->users $this->get_full_tree(); - + $idtoscan=$this->id; - + dol_syslog("Build childid for id = ".$idtoscan); foreach($this->users as $id => $val) { //var_dump($val['fullpath']); if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id']; } - } + } $this->cache_childids[$this->id] = $childids; - + if ($addcurrentuser) $childids[$this->id]=$this->id; - + return $childids; } @@ -2683,7 +2712,7 @@ class User extends CommonObject $useridfound=array($id_user); while (! empty($this->parentof[$cursor_user])) { - if (in_array($this->parentof[$cursor_user], $useridfound)) + if (in_array($this->parentof[$cursor_user], $useridfound)) { dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING); return -1; // Should not happen. Protection against looping hierarchy @@ -2753,5 +2782,39 @@ class User extends CommonObject } } + /** + * Create a document onto disk according to template module. + * + * @param string $modele Force model to use ('' to not force) + * @param Translate $outputlangs Object langs to use for output + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$user,$langs; + + $langs->load("user"); + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->USER_ADDON_PDF)) + { + $modele = $conf->global->USER_ADDON_PDF; + } + else + { + $modele = 'bluesky'; + } + } + + $modelpath = "core/modules/user/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } + } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 735b3253afb..907c0cef40d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -819,5 +819,39 @@ class UserGroup extends CommonObject $this->datem=time(); $this->members=array($user->id); // Members of this group is just me } + + /** + * Create a document onto disk according to template module. + * + * @param string $modele Force model to use ('' to not force) + * @param Translate $outputlangs Object langs to use for output + * @param int $hidedetails Hide details of lines + * @param int $hidedesc Hide description + * @param int $hideref Hide ref + * @return int 0 if KO, 1 if OK + */ + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + { + global $conf,$user,$langs; + + $langs->load("user"); + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->USERGROUP_ADDON_PDF)) + { + $modele = $conf->global->USERGROUP_ADDON_PDF; + } + else + { + $modele = 'grass'; + } + } + + $modelpath = "core/modules/usergroup/doc/"; + + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + } } diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index cb1e9f875aa..5299f348431 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -96,12 +96,17 @@ if ($id > 0) print ''; print ''; - dol_fiche_head($head, 'clicktodial', $title, 0, 'user'); + dol_fiche_head($head, 'clicktodial', $title, -1, 'user'); - $linkback = '
    '.$langs->trans("BackToList").''; + $linkback = ''; + + if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; + } dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + print '
    '; print '
    '; // Edit mode @@ -193,6 +198,7 @@ if ($id > 0) print '
    '; } + print ''; print ''; /* diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 081bf2bc408..a8d5000e809 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2013 Cédric Salvador @@ -129,16 +129,20 @@ if ($object->id) $form=new Form($db); - dol_fiche_head($head, 'document', $langs->trans("User"),0,'user'); - - $linkback = ''.$langs->trans("BackToList").''; + dol_fiche_head($head, 'document', $langs->trans("User"), -1, 'user'); + $linkback = ''; + if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; + } + dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); + 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) { @@ -158,12 +162,14 @@ if ($object->id) print '
    '.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
    '; - + print ''; + dol_fiche_end(); $modulepart = 'user'; $permission = $user->rights->user->user->creer; + $permtoedit = $user->rights->user->user->creer; $param = '&id=' . $object->id; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1dac5d3e7f6..eacb954e007 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; if(! empty($conf->multicompany->enabled)) dol_include_once('/multicompany/class/actions_multicompany.class.php'); // Defini si peux lire/modifier utilisateurs et permisssions @@ -209,6 +210,11 @@ if ($action == 'update') setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs'); } } + +// Actions to build doc +$upload_dir = $conf->usergroup->dir_output; +$permissioncreate=$user->rights->user->user->creer; +include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -220,6 +226,8 @@ llxHeader('',$langs->trans("GroupCard")); $form = new Form($db); $fuserstatic = new User($db); +$form = new Form($db); +$formfile = new FormFile($db); if ($action == 'create') { @@ -446,9 +454,9 @@ else foreach($object->members as $useringroup) { - $var=!$var; + - print "
    '; print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); @@ -495,6 +503,37 @@ else } print "
    "; print "
    "; + + /* + * Documents generes + */ + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->usergroup->dir_output . "/" . dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $genallowed = $user->rights->user->user->creer; + $delallowed = $user->rights->user->user->supprimer; + + $var = true; + + $somethingshown = $formfile->show_documents('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang); + + // Linked object block + $somethingshown = $form->showLinkedObjectBlock($object); + + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object); + if ($linktoelem) print '
    '.$linktoelem; + + + print '
    '; + + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'usergroup', $socid); + + + print '
    '; } /* @@ -551,7 +590,6 @@ else print ''; } - } } diff --git a/htdocs/user/group/index.php b/htdocs/user/group/index.php index 94c12147f1a..539c1f2be23 100644 --- a/htdocs/user/group/index.php +++ b/htdocs/user/group/index.php @@ -171,9 +171,9 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - $var=!$var; + - print "
    '.img_object($langs->trans("ShowGroup"),"group").' '.$obj->name.''; if (! $obj->entity) { diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index bb558bd56b3..734b1aa0d14 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -144,15 +144,8 @@ print '
    '; -print '
      
    '; -print ''; -print ''; +print ''; +print ''; // Search Group if ($canreadperms) { - $var=false; - print ''; } +print ''; print "
    '.$langs->trans("Search").'
    '; -print $langs->trans("User").':
    '.$langs->trans("Search").'
    '; +print $langs->trans("User").':
    '; + print '
    '; print $langs->trans("Group").':

    \n"; print ''; @@ -125,9 +124,9 @@ if ($resql) while ($i < $num && $i < $max) { $obj = $db->fetch_object($resql); - $var=!$var; + - print "
    '; $fuserstatic->id = $obj->rowid; $fuserstatic->statut = $obj->statut; @@ -238,9 +237,9 @@ if ($canreadperms) while ($i < $num && (! $max || $i < $max)) { $obj = $db->fetch_object($resql); - $var=!$var; + - print "
    '.img_object($langs->trans("ShowGroup"),"group").' '.$obj->name.''; if (! $obj->entity) { diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 623e2df3434..c3a32ae02fc 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -174,6 +174,7 @@ if (empty($reshook)) * View */ +$user2=new User($db); $buttonviewhierarchy='
    '; @@ -315,43 +316,8 @@ $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfiel print '
    '; print ''."\n"; -print ''; -if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titre($langs->trans("Gender"),$_SERVER['PHP_SELF'],"u.gender",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre($langs->trans("Employee"),$_SERVER['PHP_SELF'],"u.employee",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER['PHP_SELF'],"u.accountancy_code",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER['PHP_SELF'],"u.email",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u.fk_user",$param,"","",$sortfield,$sortorder); -if (! empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); -if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre($langs->trans("PreviousConnexion"),$_SERVER['PHP_SELF'],"u.datepreviouslogin",$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['u.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['u.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"u.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); -if (! empty($arrayfields['u.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"u.statut","",$param,'align="center"',$sortfield,$sortorder); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); -print "\n"; - // Search bar -print ''; +print ''; if (! empty($arrayfields['u.login']['checked'])) { print ''; @@ -459,14 +425,48 @@ print ''; print "\n"; -$user2=new User($db); -$var=True; +print ''; +if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans("Login"),$_SERVER['PHP_SELF'],"u.login",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.lastname']['checked'])) print_liste_field_titre($langs->trans("Lastname"),$_SERVER['PHP_SELF'],"u.lastname",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.firstname']['checked'])) print_liste_field_titre($langs->trans("FirstName"),$_SERVER['PHP_SELF'],"u.firstname",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titre($langs->trans("Gender"),$_SERVER['PHP_SELF'],"u.gender",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre($langs->trans("Employee"),$_SERVER['PHP_SELF'],"u.employee",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER['PHP_SELF'],"u.accountancy_code",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre($langs->trans("EMail"),$_SERVER['PHP_SELF'],"u.email",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"u.fk_soc",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre($langs->trans("Entity"),$_SERVER['PHP_SELF'],"u.entity",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre($langs->trans("HierarchicalResponsible"),$_SERVER['PHP_SELF'],"u.fk_user",$param,"","",$sortfield,$sortorder); +if (! empty($arrayfields['u.datelastlogin']['checked'])) print_liste_field_titre($langs->trans("LastConnexion"),$_SERVER['PHP_SELF'],"u.datelastlogin",$param,"",'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_titre($langs->trans("PreviousConnexion"),$_SERVER['PHP_SELF'],"u.datepreviouslogin",$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['u.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['u.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"u.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['u.statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"u.statut","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + + + $i = 0; while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); - $var=!$var; $userstatic->id=$obj->rowid; $userstatic->ref=$obj->label; @@ -482,18 +482,18 @@ while ($i < min($num,$limit)) $li=$userstatic->getNomUrl(-1,'',0,0,24,1,'login'); - print ""; + print ""; if (! empty($arrayfields['u.login']['checked'])) { print ''; } @@ -584,11 +584,11 @@ while ($i < min($num,$limit)) print $user2->getNomUrl(-1,'',0,0,24,0,''); if (! empty($conf->multicompany->enabled) && $obj->admin2 && ! $obj->entity2) { - print img_picto($langs->trans("SuperAdministrator"),'redstar'); + print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"'); } else if ($obj->admin2) { - print img_picto($langs->trans("Administrator"),'star'); + print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"'); } } print ''; diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 5ea7200a0f7..86bff7147ff 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -65,10 +65,14 @@ llxHeader(); $head = user_prepare_head($object); $title = $langs->trans("User"); -dol_fiche_head($head, 'info', $title, 0, 'user'); +dol_fiche_head($head, 'info', $title, -1, 'user'); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''; + +if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; +} dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 1da5911861c..0f0cc6b4ed7 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -96,7 +96,11 @@ $head = user_prepare_head($object); $title = $langs->trans("User"); dol_fiche_head($head, 'ldap', $title, 0, 'user'); -$linkback = ''.$langs->trans("BackToList").''; +$linkback = ''; + +if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; +} dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 38aef489b87..ae685391299 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -88,9 +88,13 @@ if ($id) $head = user_prepare_head($object); $title = $langs->trans("User"); - dol_fiche_head($head, 'note', $title, 0, 'user'); + dol_fiche_head($head, 'note', $title, -1, 'user'); - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''; + + if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; + } dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); @@ -99,6 +103,7 @@ if ($id) print ""; print ''; + print '
    '; print '
    '; print $li; if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { - print img_picto($langs->trans("SuperAdministrator"),'redstar'); + print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"'); } else if ($obj->admin) { - print img_picto($langs->trans("Administrator"),'star'); + print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"'); } print '
    '; // Login @@ -123,6 +128,7 @@ if ($id) print ""; print "
    "; + print '
    '; dol_fiche_end(); diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 4e84a8b83fa..4f47578f543 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -44,15 +44,16 @@ $actionid=GETPOST('actionid'); if ($user->societe_id) $id=$user->societe_id; $result = restrictedArea($user, 'societe','',''); -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; -$pageprev = $page - 1; -$pagenext = $page + 1; +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield=GETPOST("sortfield",'alpha'); +$sortorder=GETPOST("sortorder",'alpha'); +$page=GETPOST("page",'int'); if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="n.daten"; +if (empty($page) || $page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; $now=dol_now(); @@ -135,36 +136,45 @@ if ($result > 0) $head = user_prepare_head($object); - dol_fiche_head($head, 'notify', $langs->trans("User"),0,'user'); + dol_fiche_head($head, 'notify', $langs->trans("User"), -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', '', '', 0, '', '', 0, ''); + + print '
    '; - /*print ''; - - // Ref - print ''; + print '
    '; + print '
    '.$langs->trans("Ref").'
    '; + + // Login + print ''; + if (! empty($object->ldap_sid) && $object->statut==0) + { + print ''; + } + else + { + print ''; + } + print ''."\n"; + + /*print ''; // Notification for this thirdparty print ''; - print ''."\n"; - - print ''; - print ''; - - // Firstname - print ''; - print ''; - print ''."\n"; - - // EMail - print ''; - print ''; - print "\n"; - - print '
    '.$langs->trans("Login").''.$langs->trans("LoginAccountDisableInDolibarr").''.$object->login.'
    '.$langs->trans("NbOfActiveNotifications").''; - print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin); - print '
    '.$langs->trans("Lastname").''.$object->lastname.'
    '.$langs->trans("Firstname").''.$object->firstname.'
    '.$langs->trans("EMail").''.dol_print_email($object->email,0,0,1).'
    ';*/ - + $nbofrecipientemails=0; + $notify=new Notify($db); + $tmparray = $notify->getNotificationsArray('', 0, null, $object->id, array('user')); + foreach($tmparray as $tmpkey => $tmpval) + { + $nbofrecipientemails++; + } + print $nbofrecipientemails; + print '
    '; + + print '
    '; + dol_fiche_end(); print "\n"; @@ -211,7 +221,7 @@ if ($result > 0) $label=($langs->trans("Notify_".$notifiedevent['code'])!="Notify_".$notifiedevent['code']?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']); $actions[$notifiedevent['rowid']]=$label; } - print '
    '; + print '
    '; print $object->getNomUrl(1); if (isValidEmail($object->email)) { @@ -235,7 +245,7 @@ if ($result > 0) } else { - print '
    '; + print '
    '; print $langs->trans("YouMustAssignUserMailFirst"); print '
    '.$userstatic->getNomUrl(1); + print '
    '.$userstatic->getNomUrl(1); if ($obj->type == 'email') { if (isValidEmail($obj->email)) @@ -333,7 +343,7 @@ if ($result > 0) { if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_(.*)/', $key, $reg)) continue; $var = ! $var; - print '
    '; + print '
    '; $listtmp=explode(',',$val); $first=1; foreach($listtmp as $keyemail => $valemail) @@ -369,13 +379,13 @@ if ($result > 0) print ''.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).'
    '; + print '
    '; print '+ '.$langs->trans("SeeModuleSetup", $langs->transnoentitiesnoconv("Module600Name")).''; print '
    '; @@ -388,12 +398,22 @@ if ($result > 0) $sql.= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,"; $sql.= " a.code, a.label"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,"; - $sql.= " ".MAIN_DB_PREFIX."notify as n "; + $sql.= " ".MAIN_DB_PREFIX."notify as n"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as c ON n.fk_user = c.rowid"; $sql.= " WHERE a.rowid = n.fk_action"; $sql.= " AND n.fk_user = ".$object->id; $sql.= $db->order($sortfield, $sortorder); + // Count total nb of records + $nbtotalofrecords = ''; + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } + + $sql.= $db->plimit($limit+1, $offset); + $resql=$db->query($sql); if ($resql) { @@ -404,10 +424,21 @@ if ($result > 0) dol_print_error($db); } + $param='&id='.$object->id; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + // List of notifications done - print_fiche_titre($langs->trans("ListOfNotificationsDone").' ('.$num.')','',''); - $var=true; - + print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); + // Line with titles print ''; print ''; @@ -426,11 +457,9 @@ if ($result > 0) while ($i < $num) { - $var = !$var; - $obj = $db->fetch_object($resql); - print '
    '; + print '
    '; if ($obj->id > 0) { $userstatic->id=$obj->id; @@ -470,6 +499,8 @@ if ($result > 0) } print '
    '; + + print ''; } else dol_print_error('','RecordNotFound'); diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index f0ca0f17c31..473c06e7368 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2010-2015 Regis Houssin * Copyright (C) 2013 Florian Henry * @@ -65,7 +65,7 @@ $dirleft = "../core/menus/standard"; // Charge utilisateur edite $object = new User($db); -$object->fetch($id); +$object->fetch($id, '', '', 1); $object->getrights(); // Liste des zone de recherche permanentes supportees @@ -81,9 +81,11 @@ $formadmin=new FormAdmin($db); // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('usercard','globalcard')); + /* * Actions */ + $parameters=array('id'=>$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'); @@ -180,8 +182,12 @@ if ($action == 'edit') if ($action == 'edit') { dol_fiche_head($head, 'guisetup', $title, 0, 'user'); - - $linkback = '
    '.$langs->trans("BackToList").''; + + $linkback = ''; + + if ($user->rights->user->user->lire || $user->admin) { + $linkback = ''.$langs->trans("BackToList").''; + } dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); @@ -239,8 +245,8 @@ if ($action == 'edit') print '
    '.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
    '.$langs->trans("LandingPage").'
    '.$langs->trans("LandingPage").''; print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); print '
    '.$langs->trans("Language").'
    '.$langs->trans("Language").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print $s?$s.' ':''; @@ -268,8 +274,8 @@ if ($action == 'edit') print '
    '.$langs->trans("MaxSizeList").'
    '.$langs->trans("MaxSizeList").''.$conf->global->MAIN_SIZE_LISTE_LIMIT.'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":""); print empty($dolibarr_main_demo)?'':' disabled="disabled"'; // Disabled for demo @@ -293,7 +299,7 @@ if ($action == 'edit') } else { - dol_fiche_head($head, 'guisetup', $title, 0, 'user'); + dol_fiche_head($head, 'guisetup', $title, -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; @@ -305,8 +311,8 @@ else print '
    '.$langs->trans("Parameter").''.$langs->trans("DefaultValue").' '.$langs->trans("PersonalValue").'
    '.$langs->trans("LandingPage").'
    '.$langs->trans("LandingPage").''; print (empty($conf->global->MAIN_LANDING_PAGE)?'':$conf->global->MAIN_LANDING_PAGE); print '
    '.$langs->trans("Language").'
    '.$langs->trans("Language").''; $s=picto_from_langcode($conf->global->MAIN_LANG_DEFAULT); print ($s?$s.' ':''); @@ -337,8 +343,8 @@ else print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT=='auto'?$langs->trans("AutoDetectLang"):(! empty($object->conf->MAIN_LANG_DEFAULT)?$langs->trans("Language_".$object->conf->MAIN_LANG_DEFAULT):'')); print '
    '.$langs->trans("MaxSizeList").'
    '.$langs->trans("MaxSizeList").''.(! empty($conf->global->MAIN_SIZE_LISTE_LIMIT)?$conf->global->MAIN_SIZE_LISTE_LIMIT:' ').'conf->MAIN_SIZE_LISTE_LIMIT)?" checked":"").'> '.$langs->trans("UsePersonalValue").'' . (! empty($object->conf->MAIN_SIZE_LISTE_LIMIT)?$object->conf->MAIN_SIZE_LISTE_LIMIT:' ') . '
    - + - + @@ -157,6 +168,12 @@ if ($action == 'edit') {
    trans('Ref') ?>trans('Ref') ?> ref.'">'; + print ''; } else { - print dol_htmlentities($prodattr->ref); + print dol_htmlentities($object->ref); } ?>
    trans('Label') ?>trans('Label') ?> label.'">'; + print ''; } else { - print dol_htmlentities($prodattr->label); + print dol_htmlentities($object->label); } ?>
    '; +} + dol_fiche_end(); if ($action == 'edit') { ?> @@ -173,7 +190,7 @@ if ($action == 'edit') { ?> $form = new Form($db); print $form->formconfirm( - "card.php?id=".$prodattr->id, + "card.php?id=".$object->id, $langs->trans('Delete'), $langs->trans('ProductAttributeDeleteDialog'), "confirm_delete", @@ -183,14 +200,14 @@ if ($action == 'edit') { ?> ); } elseif ($action == 'delete_value') { - if ($prodattrval->fetch($valueid) > 0) { + if ($objectval->fetch($valueid) > 0) { $form = new Form($db); print $form->formconfirm( - "card.php?id=".$prodattr->id."&valueid=".$prodattrval->id, + "card.php?id=".$object->id."&valueid=".$objectval->id, $langs->trans('Delete'), - $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($prodattrval->value), dol_htmlentities($prodattrval->ref)), + $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($objectval->value), dol_htmlentities($objectval->ref)), "confirm_deletevalue", '', 0, @@ -203,8 +220,8 @@ if ($action == 'edit') { ?> @@ -219,7 +236,7 @@ if ($action == 'edit') { ?> - fetchAllByProductAttribute($prodattr->id) as $attrval): ?> + fetchAllByProductAttribute($object->id) as $attrval): ?> > id)): ?> @@ -233,8 +250,8 @@ if ($action == 'edit') { ?> ref) ?> value) ?> - - + + @@ -250,7 +267,7 @@ if ($action == 'edit') { ?> @@ -258,3 +275,4 @@ if ($action == 'edit') { ?> } llxFooter(); +$db->close(); diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index dc1edd01ef0..4342b352478 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -1,6 +1,6 @@ +/* Copyright (C) 2016 Marcos García + * 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 @@ -35,7 +35,13 @@ $weight_impact = (float) GETPOST('weight_impact'); $price_impact = (float) GETPOST('price_impact'); $price_impact_percent = (bool) GETPOST('price_impact_percent'); $form = new Form($db); -$action = GETPOST('action'); + +$action=GETPOST('action','alpha'); +$massaction=GETPOST('massaction','alpha'); +$show_files=GETPOST('show_files','int'); +$confirm=GETPOST('confirm','alpha'); +$toselect = GETPOST('toselect', 'array'); +$cancel = GETPOST('cancel'); // Security check $fieldvalue = (! empty($id) ? $id : $ref); @@ -52,16 +58,34 @@ if ($id > 0 || $ref) $object->fetch($id, $ref); } +$selectedvariant = $_SESSION['addvariant_'.$object->id]; + /* * Actions */ +if ($cancel) { + $action=''; + $massactions=''; + unset($_SESSION['addvariant_'.$object->id]); +} + if (! $object->isProduct()) { header('Location: '.dol_buildpath('/product/card.php?id='.$object->id, 2)); exit(); } +if (GETPOST('selectvariant')) +{ + $action = 'add'; + if (GETPOST('attribute') != '-1' && GETPOST('value') != '-1') + { + $selectedvariant[GETPOST('attribute').':'.GETPOST('value')]=GETPOST('attribute').':'.GETPOST('value'); + $_SESSION['addvariant_'.$object->id]=$selectedvariant; + } +} + $prodcomb = new ProductCombination($db); $prodcomb2val = new ProductCombination2ValuePair($db); @@ -70,13 +94,16 @@ $productCombination2ValuePairs1 = array(); if ($_POST) { - if ($action == 'add') { + if (($action == 'add' || $action == 'create') && empty($massaction) && ! GETPOST('selectvariant')) { - $features = GETPOST('features', 'array'); + //$features = GETPOST('features', 'array'); + $features = $_SESSION['addvariant_'.$object->id]; if (!$features) { setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors'); - } else { + } + else + { $weight_impact = price2num($weight_impact); $price_impact = price2num($price_impact); $sanit_features = array(); @@ -107,9 +134,10 @@ if ($_POST) { $db->begin(); if (!$prodcomb->fetchByProductCombination2ValuePairs($id, $sanit_features)) { - if (ProductCombination::createProductCombination($product, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact)) { + if (ProductCombination::createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact)) { $db->commit(); setEventMessage($langs->trans('RecordSaved')); + unset($_SESSION['addvariant_'.$object->id]); header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2)); exit(); } else { @@ -121,17 +149,17 @@ if ($_POST) { $db->rollback(); } - } elseif ($action == 'bulk_actions') { - - $prodarray = array_keys(GETPOST('select', 'array')); - $bulkaction = GETPOST('bulk_action'); + } + elseif (! empty($massaction)) + { + $bulkaction = $massaction; $error = 0; $prodstatic = new Product($db); $db->begin(); - foreach ($prodarray as $prodid) { + foreach ($toselect as $prodid) { if ($prodstatic->fetch($prodid) < 0) { continue; @@ -175,7 +203,8 @@ if ($_POST) { setEventMessage($langs->trans('RecordSaved')); } - } else { + } + elseif ($valueid > 0) { if ($prodcomb->fetch($valueid) < 0) { dol_print_error($db, $langs->trans('ErrorRecordNotFound')); @@ -196,6 +225,7 @@ if ($_POST) { } } +// Reload variants $productCombinations = $prodcomb->fetchAllByFkProductParent($object->id); if ($action === 'confirm_deletecombination') { @@ -256,28 +286,29 @@ if ($action === 'confirm_deletecombination') { * View */ -if (! empty($id) || ! empty($ref)) { +$form = new Form($db); +if (! empty($id) || ! empty($ref)) +{ llxHeader("", "", $langs->trans("CardProduct".$object->type)); - if ($result) - { - $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); - - $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(); - } + $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); + + $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(); + + // Create or edit a varian if ($action == 'add' || ($action == 'edit')) { if ($action == 'add') { @@ -286,6 +317,7 @@ if (! empty($id) || ! empty($ref)) { $title = $langs->trans('EditProductCombination'); } + print '
    '; print_fiche_titre($title); if ($action == 'add') { @@ -303,7 +335,7 @@ if (! empty($id) || ! empty($ref)) { ?> - - - - + + '."\n"; + print ''."\n"; + print ''."\n"; + + print dol_fiche_head(); + + ?> + - + + - - + + - - + - - - + + +
    - +
    + "> + +
    +
    + + + + + - - + - - + +
    +
    + $val) { + $tmp = explode(':',$val); + $result1 = $prodattr->fetch($tmp[0]); + $result2 = $prodattr_val->fetch($tmp[1]); + if ($result1 > 0 && $result2 > 0) + { + print $prodattr->label . ' - '.$prodattr_val->value.'
    '; + // TODO Add delete link + } + } + } + ?> +
    + +
    - -

    - -
    + >
    -
    -
    - - - - - - } else { +
    + value="trans('Create') : $langs->trans('Save') ?>" class="button"> +   + +
    + + '; + } + else + { if ($action === 'delete') { if ($prodcomb->fetch($valueid) > 0) { - $form = new Form($db); $prodstatic->fetch($prodcomb->fk_product_child); print $form->formconfirm( @@ -506,8 +519,6 @@ if (! empty($id) || ! empty($ref)) { } } elseif ($action === 'copy') { - $form = new Form($db); - print $form->formconfirm( 'combinations.php?id='.$id, $langs->trans('CloneCombinationsProduct'), @@ -552,84 +563,144 @@ if (! empty($id) || ! empty($ref)) { }); -
    - - - - " class="button"> -
    -
    - - - - - - - - - - - - - - fetch($currcomb->fk_product_child); ?> - > - - - - - - - - - - -
    - - - - trans('Product') ?>trans('Combination') ?>trans('PriceImpact') ?>trans('WeightImpact') ?>trans('OnSell') ?>trans('OnBuy') ?>
    getNomUrl(1) ?> - fetchByFkCombination($currcomb->id); - $iMax = count($productCombination2ValuePairs); - - for ($i = 0; $i < $iMax; $i++) { - echo dol_htmlentities($productCombination2ValuePairs[$i]); - - if ($i !== ($iMax - 1)) { - echo ', '; - } - } ?> - 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 '
    '; if ($productCombinations) { - print ' '.$langs->trans('Copy').''; + print ''.$langs->trans('PropagateVariant').''; } - print ' '.$langs->trans('ProductCombinationGenerator').' - '.$langs->trans('NewProductCombination').''; + + print ''.$langs->trans('NewProductCombination').''; // NewVariant + + // Too much bugged page. + /* + print ''.$langs->trans('ProductCombinationGenerator').''; + */ + print '
    '; + print ''; + + + + $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') ?>
    getNomUrl(1) ?> + fetchByFkCombination($currcomb->id); + $iMax = count($productCombination2ValuePairs); + + for ($i = 0; $i < $iMax; $i++) { + echo dol_htmlentities($productCombination2ValuePairs[$i]); + + if ($i !== ($iMax - 1)) { + echo ', '; + } + } ?> + 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) ?> + + +
    '.$langs->trans("None").'
    + '; + 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/index.php b/htdocs/websites/index.php index e6bfec0d84a..b55f81f5b7f 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,7 +436,7 @@ if ($action == 'updatemeta') } // Update page -if ($action == 'updatecontent') +if ($action == 'updatecontent' || GETPOST('refreshsite') || GETPOST('refreshpage') || GETPOST('preview')) { $db->begin(); $object->fetch(0, $website); @@ -444,110 +446,123 @@ if ($action == 'updatecontent') $res = $objectpage->fetch($pageid, $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); - } + $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); */ - $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(); - } + $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 +618,7 @@ if ($action == 'edit') $style=''; if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5px;'; - +//var_dump($objectpage);exit; print '
    '; if (count($object->records) > 0) 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/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index d60218fba22..4360e74cae5 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -128,7 +128,7 @@ if (! empty($id)) { $filter['t.rowid']=$id; } -$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter); +$result = $object->fetch_all('DESC','t.rowid', 0, 0, 1, $filter, 0); if ($result<0) { echo "Error: ".$object->error; @@ -136,7 +136,7 @@ if ($result<0) exit(-1); } -// TODO This sequence of code must be shared with code into cron_run_jobs.php php page. +// TODO This sequence of code must be shared with code into public/cron/cron_run_jobs.php php page. // current date $now=dol_now(); 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/scripts/odt2pdf/odt2pdf.sh b/scripts/odt2pdf/odt2pdf.sh index b44ab3e6d78..4cf1ab54013 100755 --- a/scripts/odt2pdf/odt2pdf.sh +++ b/scripts/odt2pdf/odt2pdf.sh @@ -1,14 +1,14 @@ #!/bin/bash # @copyright GPL License 2010 - Vikas Mahajan - http://vikasmahajan.wordpress.com # @copyright GPL License 2013 - Florian HEnry - florian.henry@open-concept.pro -# @copyright GPL License 2015 - Laurent Destailleur - eldy@users.sourceforge.net +# @copyright GPL License 2017 - Laurent Destailleur - eldy@users.sourceforge.net # # Convert an ODT into a PDF using "jodconverter" or "pyodconverter" tool. # Dolibarr variable MAIN_ODT_AS_PDF must be defined to value "jodconverter" to call jodconverter wrapper after ODT generation -# or value "pyodconverter" to call DocumentConverter.py after ODT generation. -# or value "/pathto/jodconverter-cli-file.jar" to call jodconverter java tool without wrapper after ODT generation. +# or value "pyodconverter" to call DocumentConverter.py after ODT generation. +# or value "/pathto/jodconverter-cli-file.jar" to call jodconverter java tool without wrapper after ODT generation. # Dolibarr variable MAIN_DOL_SCRIPTS_ROOT must be defined to path of script directories (otherwise dolibarr will try to guess). - + if [ "x$1" == "x" ] then @@ -17,13 +17,21 @@ then exit fi +# Full patch where soffice is installed +soffice="/usr/bin/soffice" +# Temporary directory (web user must have permission to read/write). You can set here path to your DOL_DATA_ROOT/admin/temp directory for example. +home_java="/tmp" + + +# Main program if [ -f "$1.odt" ] then nbprocess=$(pgrep -c soffice) if [ $nbprocess -ne 1 ] # If there is some soffice process running then - soffice --invisible --accept="socket,host=127.0.0.1,port=8100;urp;" --nofirststartwizard --headless & + cmd="$soffice --invisible --accept=socket,host=127.0.0.1,port=8100;urp; --nofirststartwizard --headless -env:UserInstallation=file:///$home_java/" + export HOME=$home_java && cd $home_java && $cmd& retcode=$? if [ $retcode -ne 0 ] then 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 786970e2b3a..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);