diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index e5908c26ac0..00000000000 --- a/.dockerignore +++ /dev/null @@ -1,16 +0,0 @@ -build -build.xml -ChangeLog -composer.json -CONTRIBUTING.md -COPYING -COPYRIGHT -dev -doc -Dockerfile -INSTALL -README-FR.md -README.md -robots.txt -scripts -test \ No newline at end of file diff --git a/ChangeLog b/ChangeLog index 3cfc257bbb2..42cf4d14f1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,7 +28,7 @@ NEW: add property to show warnings when activating modules NEW: add rapport file for supplier paiement NEW: Add statistics on supplier tab. NEW: Add tooltip help on shipment weight and volume calculation -NEW: An external module can hook and add mass actions +NEW: An external module can hook and add mass actions. NEW: Better reponsive design NEW: Bookmarks are into a combo list. NEW: Bulk actions available on supplier orders @@ -147,8 +147,12 @@ Following changes may create regression for some external modules, but were nece * Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used. * Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still exists, but if an external module need action on it, it must provides itself its trigger file. -* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode +* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var + $multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into + the Home - setup - other admin page. * Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx') +* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can + retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1. * The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow hook specifications so you must return output into "resprint". diff --git a/build/docker/.dockerignore b/build/docker/.dockerignore new file mode 100644 index 00000000000..e345920fb8c --- /dev/null +++ b/build/docker/.dockerignore @@ -0,0 +1,3 @@ +Dockerfile +README.md +docker-compose.yml diff --git a/Dockerfile b/build/docker/Dockerfile similarity index 72% rename from Dockerfile rename to build/docker/Dockerfile index 00a5d0ef567..caa7b0c436a 100644 --- a/Dockerfile +++ b/build/docker/Dockerfile @@ -1,4 +1,7 @@ -FROM php:5.6-apache +FROM php:7.0-apache + +ENV HOST_USER_ID 33 +ENV PHP_INI_DATE_TIMEZONE 'UTC' RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \ && rm -rf /var/lib/apt/lists/* \ @@ -9,11 +12,9 @@ RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \ && docker-php-ext-install mysqli \ && apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev -COPY htdocs/ /var/www/html/ - -RUN chown -hR www-data:www-data /var/www/html - -VOLUME /var/www/html/conf -VOLUME /var/www/html/documents +COPY docker-run.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/docker-run.sh EXPOSE 80 + +ENTRYPOINT ["docker-run.sh"] diff --git a/build/docker/README.md b/build/docker/README.md new file mode 100644 index 00000000000..5a0997cf121 --- /dev/null +++ b/build/docker/README.md @@ -0,0 +1,25 @@ +# How to use it ? + +The docker-compose.yml file is used to build and run Dolibarr in the current workspace. + +Before build/run, define the variable HOST_USER_ID as following: + + export HOST_USER_ID=$(id -u) + +Go in repository build/docker : + + cd build/docker + +And then, you can run : + + docker-compose up + +This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin. + +The URL to go to the Dolibarr is : + + http://0.0.0.0 + +The URL to go to PhpMyAdmin is (login/password is root/root) : + + http://0.0.0.0:8080 diff --git a/build/docker/docker-compose.yml b/build/docker/docker-compose.yml new file mode 100644 index 00000000000..a2017335197 --- /dev/null +++ b/build/docker/docker-compose.yml @@ -0,0 +1,25 @@ +mariadb: + image: mariadb:latest + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: dolibarr + +phpmyadmin: + image: phpmyadmin/phpmyadmin + environment: + PMA_HOST: mariadb + links: + - mariadb + ports: + - "8080:80" + +web: + build: . + environment: + HOST_USER_ID: $HOST_USER_ID + volumes: + - ../../htdocs:/var/www/html + links: + - mariadb + ports: + - "80:80" diff --git a/build/docker/docker-run.sh b/build/docker/docker-run.sh new file mode 100644 index 00000000000..c151e1c3cab --- /dev/null +++ b/build/docker/docker-run.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +usermod -u $HOST_USER_ID www-data +groupmod -g $HOST_USER_ID www-data + +chown -hR www-data:www-data /var/www + +if [ ! -f /usr/local/etc/php/php.ini ]; then + cat < /usr/local/etc/php/php.ini +date.timezone = $PHP_INI_DATE_TIMEZONE +display_errors = On +EOF +fi + +exec apache2-foreground diff --git a/build/perl/virtualmin/README b/build/perl/virtualmin/README index 22db444a31f..6da04e5f0b8 100644 --- a/build/perl/virtualmin/README +++ b/build/perl/virtualmin/README @@ -1,8 +1,10 @@ README (English) ################################################## -Install script for Virtualmin Pro +Install script for Virtualmin Professional / GPL ################################################## -This script will install automatically Dolibarr from Virtualmin Pro -http://www.virtualmin.com +This script will install automatically Dolibarr from Virtualmin. +(Included in the professional version and can be added in the GPL version) + +https://www.virtualmin.com http://www.webmin.com/virtualmin.html \ No newline at end of file diff --git a/build/perl/virtualmin/dolibarr.pl b/build/perl/virtualmin/dolibarr.pl index 32324d28e42..08d02e8b2b8 100644 --- a/build/perl/virtualmin/dolibarr.pl +++ b/build/perl/virtualmin/dolibarr.pl @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- # \file dolibarr.pl # \brief Dolibarr script install for Virtualmin Pro -# \author (c)2009-2015 Regis Houssin +# \author (c)2009-2017 Regis Houssin #---------------------------------------------------------------------------- @@ -30,7 +30,12 @@ return "Regis Houssin"; # script_dolibarr_versions() sub script_dolibarr_versions { -return ( "3.8.1", "3.7.1", "3.6.4", "3.5.7" ); +return ( "5.0.4", "4.0.6", "3.9.4" ); +} + +sub script_dolibarr_release +{ +return 2; # for mysqli fix } sub script_dolibarr_category @@ -177,9 +182,9 @@ if ($opts->{'newdb'} && !$upgrade) { local ($dbtype, $dbname) = split(/_/, $opts->{'db'}, 2); local $dbuser = $dbtype eq "mysql" ? &mysql_user($d) : &postgres_user($d); local $dbpass = $dbtype eq "mysql" ? &mysql_pass($d) : &postgres_pass($d, 1); -local $dbphptype = $dbtype eq "mysql" && $version >= 3.6 ? "mysql" : +local $dbphptype = $dbtype eq "mysql" && $version < 3.6 ? "mysql" : $dbtype eq "mysql" ? "mysqli" : "pgsql"; -local $dbhost = &get_database_host($dbtype); +local $dbhost = &get_database_host($dbtype, $d); local $dberr = &check_script_db_connection($dbtype, $dbname, $dbuser, $dbpass); return (0, "Database connection failed : $dberr") if ($dberr); @@ -206,9 +211,6 @@ $pgcharset = $tmpl->{'postgres_encoding'}; $charset = $dbtype eq "mysql" ? $mycharset : $pgcharset; $collate = $dbtype eq "mysql" ? $mycollate : "C"; -# Install filename -local $step = $version >= 3.8 ? "step" : "etape"; - $path = &script_path_url($d, $opts); if ($path =~ /^https:/ || $d->{'ssl'}) { $url = "https://$d->{'dom'}"; @@ -222,15 +224,11 @@ if ($opts->{'path'} =~ /\w/) { if (!$upgrade) { local $cdef = "$opts->{'dir'}/conf/conf.php.example"; - &run_as_domain_user($d, "cp ".quotemeta($cdef)." ".quotemeta($cfile)); + ©_source_dest_as_domain_user($d, $cdef, $cfile); &set_permissions_as_domain_user($d, 0777, $cfiledir); - &set_permissions_as_domain_user($d, 0666, $cfile); + ©_source_dest_as_domain_user($d, $cfile); &run_as_domain_user($d, "mkdir ".quotemeta($docdir)); &set_permissions_as_domain_user($d, 0777, $docdir); - if (!$version >= 3.7.2) { - &run_as_domain_user($d, "mkdir ".quotemeta($altdir)); - &set_permissions_as_domain_user($d, 0777, $altdir); - } } else { # Preserve old config file, documents and custom directory @@ -266,7 +264,8 @@ if ($upgrade) { [ "versionfrom", $upgrade->{'version'} ], [ "versionto", $ver ], ); - local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts); + local $p = $ver >= 3.8 ? "step5" : "etape5"; + local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); return (-1, "Dolibarr wizard failed : $err") if ($err); # Remove the installation directory. @@ -289,15 +288,17 @@ else { [ "main_force_https", $opts->{'forcehttps'} ], [ "dolibarr_main_db_character_set", $charset ], [ "dolibarr_main_db_collation", $collate ], - [ "main_use_alt_dir", "1" ], + [ "usealternaterootdir", "1" ], [ "main_alt_dir_name", "custom" ], ); - local $err = &call_dolibarr_wizard_page(\@params, $step."1", $d, $opts); + local $p = $ver >= 3.8 ? "step1" : "etape1"; + local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); return (-1, "Dolibarr wizard failed : $err") if ($err); # Second page (Populate database) local @params = ( [ "action", "set" ] ); - local $err = &call_dolibarr_wizard_page(\@params, $step."2", $d, $opts); + local $p = $ver >= 3.8 ? "step2" : "etape2"; + local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); return (-1, "Dolibarr wizard failed : $err") if ($err); # Third page (Add administrator account) @@ -306,7 +307,8 @@ else { [ "pass", $dompass ], [ "pass_verif", $dompass ], ); - local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts); + local $p = $ver >= 3.8 ? "step5" : "etape5"; + local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); return (-1, "Dolibarr wizard failed : $err") if ($err); # Remove the installation directory and protect config file. @@ -384,7 +386,10 @@ sub script_dolibarr_check_latest { local ($ver) = @_; local @vers = &osdn_package_versions("dolibarr", - $ver >= 3.8 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" : + $ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" : + $ver >= 4.0 ? "dolibarr\\-(4\\.0\\.[0-9\\.]+)\\.tgz" : + $ver >= 3.9 ? "dolibarr\\-(3\\.9\\.[0-9\\.]+)\\.tgz" : + $ver >= 3.8 ? "dolibarr\\-(3\\.8\\.[0-9\\.]+)\\.tgz" : $ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" : $ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" : $ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" : diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index fa817942a54..420246411c8 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -145,12 +145,12 @@ else if ($action == 'update') { * View */ +$form = new Form($db); + $title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card"); $helpurl = ""; llxHeader("",$title,$helpurl); -$form = new Form($db); - if ($action == 'create') { print load_fiche_titre($langs->trans("NewFiscalYear")); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index c72ce8cc134..85784ec16d7 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -336,17 +336,17 @@ if ($result) 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); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("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("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("AssignDedicatedAccountingAccount"); $clickpitco=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"'); print ''; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fb503c17ca0..50f9e18fd80 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -195,11 +195,11 @@ else { 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_operation", "", $options, "", $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder); + print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index d05dc11ed26..d3252b01a18 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -567,13 +567,13 @@ if ($action == 'create') { print ''; - print_liste_field_titre($langs->trans("AccountAccountingShort")); - print_liste_field_titre($langs->trans("SubledgerAccount")); - print_liste_field_titre($langs->trans("Labelcompte")); - print_liste_field_titre($langs->trans("Label")); - print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"'); - print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"'); - print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"'); + print_liste_field_titre("AccountAccountingShort"); + print_liste_field_titre("SubledgerAccount"); + print_liste_field_titre("Labelcompte"); + print_liste_field_titre("Label"); + print_liste_field_titre("Debit", "", "", "", "", 'align="right"'); + print_liste_field_titre("Credit", "", "", "", "", 'align="right"'); + print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"'); print "\n"; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 93968644a8f..3d6d7b7ad86 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -436,15 +436,15 @@ print ''; print ''; 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("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $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("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); +print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("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); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 1f43964bd0a..2e125925860 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -244,14 +244,14 @@ print $searchpicto; print ''; print ''; -print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF']); -print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Label")); -print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']); +print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("Label"); +print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index d10f621d9e3..bf7578bb752 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -201,19 +201,19 @@ print ''; print ""; print ''; -print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); +print_liste_field_titre("NumPiece", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("Doctype", $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("Date", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("ThirdPartyAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Amount", $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Sens", $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder); +print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; print ''; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php index 41e1570ae83..5f621a55186 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage.php @@ -191,17 +191,17 @@ llxHeader ( '', 'Compta - Grand Livre' ); print "
"; print ''; print ''; - print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" ); - print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" ); - print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" ); -// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" ); -// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" ); - print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" ); - print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" ); - print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" ); -// print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" ); -// print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" ); - print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" ); + print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" ); + print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" ); + print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" ); +// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" ); +// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" ); + print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" ); + print_liste_field_titre("Debit", "liste.php", "bk.debit" ); + print_liste_field_titre("Credit", "liste.php", "bk.credit" ); +// print_liste_field_titre("Amount", "liste.php", "bk.montant" ); +// print_liste_field_titre("Sens", "liste.php", "bk.sens" ); + print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" ); print ''; print ''; print "\n"; diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php index 17f0194628d..623e54f71fb 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettrage_supplier.php @@ -200,17 +200,17 @@ llxHeader ( '', 'Compta - Grand Livre' ); print "
"; print ''; print ''; - print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" ); - print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" ); - print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" ); -// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" ); -// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" ); - print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" ); - print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" ); - print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" ); - print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" ); - print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" ); - print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" ); + print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" ); + print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" ); + print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" ); +// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" ); +// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" ); + print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" ); + print_liste_field_titre("Debit", "liste.php", "bk.debit" ); + print_liste_field_titre("Credit", "liste.php", "bk.credit" ); + print_liste_field_titre("Amount", "liste.php", "bk.montant" ); + print_liste_field_titre("Sens", "liste.php", "bk.sens" ); + print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" ); print ''; print ''; print "\n"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index d48f81259df..9012257adee 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -280,17 +280,17 @@ if ($result) { 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="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); $clickpicto=$form->showCheckAddButtons(); print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"'); print "\n"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 4272dfaf115..5e78d735523 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -295,16 +295,16 @@ if ($result) { 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"'); + print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"'); + print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"'); $checkpicto=''; if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index f115cbde2e4..156d80f09e4 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -251,14 +251,14 @@ if ($result) { print "\n"; print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.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("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre(''); $checkpicto=$form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 1c08deb51d2..09bb45df918 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -277,15 +277,15 @@ if ($result) { print ''; print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder); $checkpicto=''; if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 9ac7eae658f..66e6928da07 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -278,18 +278,18 @@ if ($result) { print "\n"; print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); - //print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $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("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder); $checkpicto=$form->showCheckAddButtons(); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print "\n"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2eac6fdd6df..84c341400d7 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -294,17 +294,17 @@ if ($result) { print ''; print ''; - print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); - //print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); - print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); + print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); + //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"'); + print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"'); $checkpicto=''; if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index a7775332812..eec88a59c11 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -134,7 +134,7 @@ class AdherentType extends CommonObject $sql.= "note = '".$this->db->escape($this->note)."',"; $sql.= "vote = '".$this->db->escape($this->vote)."',"; $sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'"; - $sql .= " WHERE rowid =".$this->id; + $sql.= " WHERE rowid =".$this->id; $result = $this->db->query($sql); if ($result) @@ -252,7 +252,7 @@ class AdherentType extends CommonObject $sql = "SELECT rowid, libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type"; - $sql.= " WHERE entity = ".$conf->entity; + $sql.= " WHERE entity IN (".getEntity('adherent').")"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index bfa92cafa7b..f2f7aacbf52 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -594,8 +594,8 @@ if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titr 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['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.town']['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['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); @@ -611,7 +611,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 1b42b3aaf06..1fee5ac545c 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -155,7 +155,7 @@ if ($result) $num = $db->num_rows($result); $arrayofselected=is_array($toselect)?$toselect:array(); - + $i = 0; $title=$langs->trans("ListOfSubscriptions"); @@ -171,7 +171,7 @@ if ($result) if ($search_acount) $param.="&search_account=".$search_account; if ($search_amount) $param.="&search_amount=".$search_amount; if ($optioncss != '') $param.='&optioncss='.$optioncss; - + // List of mass actions available $arrayofmassactions = array( //'presend'=>$langs->trans("SendByMail"), @@ -181,7 +181,7 @@ if ($result) 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 ''; @@ -191,7 +191,7 @@ if ($result) print ''; print ''; print ''; - + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); if ($sall) @@ -200,11 +200,11 @@ 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"; @@ -237,33 +237,33 @@ if ($result) print ''; - + // Action column print ''; + 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); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("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("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("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("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); @@ -286,7 +286,7 @@ if ($result) $adherent->login=$obj->login; $adherent->photo=$obj->photo; - + print ''; @@ -329,7 +329,7 @@ if ($result) // Price print ''; - + print ''; print ""; @@ -338,7 +338,7 @@ if ($result) } // Total - + print ''; print "\n"; print "\n"; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 06297229420..016fc5e0499 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -508,13 +508,13 @@ if ($rowid > 0) print "\n"; print ''; - print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_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("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); + print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Nature",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder); print "\n"; while ($i < $num && $i < $conf->liste_limit) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index a30ebad4703..fa2c11849fb 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -131,12 +131,11 @@ if (preg_match('/del_(.*)/',$action,$reg)) * View */ -llxHeader(); +$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +llxHeader('', $langs->trans("AgendaSetup"), $wikihelp); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup'); -print "
\n"; - print ''; print ''; diff --git a/htdocs/admin/agenda_extrafields.php b/htdocs/admin/agenda_extrafields.php index 74ae6cb2d95..b331611e511 100644 --- a/htdocs/admin/agenda_extrafields.php +++ b/htdocs/admin/agenda_extrafields.php @@ -67,11 +67,11 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; $textobject=$langs->transnoentitiesnoconv("Agenda"); -llxHeader('',$langs->trans("AgendaSetup")); +$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +llxHeader('', $langs->trans("AgendaSetup"), $wikihelp); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup'); -print "
\n"; $head=agenda_prepare_head(); diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 0b69b947a38..24319a34a28 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -125,11 +125,11 @@ $formother=new FormOther($db); $arrayofjs=array(); $arrayofcss=array(); -llxHeader('',$langs->trans("AgendaSetup"),'','',0,0,$arrayofjs,$arrayofcss); +$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +llxHeader('',$langs->trans("AgendaSetup"),$wikihelp,'',0,0,$arrayofjs,$arrayofcss); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup'); -print '
'; print ''; print ''; @@ -210,7 +210,7 @@ while ($i <= $MAXAGENDA) $color='AGENDA_EXT_COLOR'.$key; $enabled='AGENDA_EXT_ENABLED'.$key; - + print ''; // Nb print '"; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index cf4f3832a1f..49987648910 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -174,12 +174,12 @@ else if ($action == 'setdoc') $formactions=new FormActions($db); $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); -llxHeader(); + +$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +llxHeader('', $langs->trans("AgendaSetup"),$wikihelp); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup'); -print "
\n"; - @@ -389,37 +389,6 @@ $tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->tra print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); print ''."\n"; -// AGENDA NOTIFICATION -if ($conf->global->MAIN_FEATURES_LEVEL > 0) -{ - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - } else { - print ''.img_picto($langs->trans('Enabled'),'switch_on').''; - print ''."\n"; - - print ''."\n"; - print ''."\n"; - print ''."\n"; - print ''."\n"; - } -} - print '
'; print ''; print ''; $searchpicto=$form->showFilterButtons(); print $searchpicto; - print '
'.price($obj->subscription).'
".$langs->trans("Total")." 
'.$langs->trans("AgendaExtNb",$key)."
'.$langs->trans('AGENDA_NOTIFICATION').' '."\n"; - - if (empty($conf->global->AGENDA_NOTIFICATION)) { - print ''.img_picto($langs->trans('Disabled'),'switch_off').''; - print '
'.$langs->trans('AGENDA_NOTIFICATION_SOUND').' '."\n"; - - if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) { - print ''.img_picto($langs->trans('Disabled'),'switch_off').''; - } else { - print ''.img_picto($langs->trans('Enabled'),'switch_on').''; - } - - print '
'; dol_fiche_end(); diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php new file mode 100644 index 00000000000..635f3c0cdd5 --- /dev/null +++ b/htdocs/admin/agenda_reminder.php @@ -0,0 +1,255 @@ + + * + * 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/agenda_reminder.php + * \ingroup agenda + * \brief Page to setup agenda reminder options + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; + +if (!$user->admin) + accessforbidden(); + +$langs->load("admin"); +$langs->load("other"); +$langs->load("agenda"); + +$action = GETPOST('action','alpha'); +$value = GETPOST('value','alpha'); +$param = GETPOST('param','alpha'); +$cancel = GETPOST('cancel','alpha'); +$scandir = GETPOST('scandir','alpha'); +$type = 'action'; + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + +if (preg_match('/set_(.*)/',$action,$reg)) +{ + $code=$reg[1]; + $value=(GETPOST($code) ? GETPOST($code) : 1); + if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0) + { + Header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + +if (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); + } +} +if ($action == 'set') +{ + dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); +} +else if ($action == 'specimen') // For orders +{ + $modele=GETPOST('module','alpha'); + + $commande = new CommandeFournisseur($db); + $commande->initAsSpecimen(); + $commande->thirdparty=$specimenthirdparty; + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + $file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0); + if (file_exists($file)) + { + $filefound=1; + $classname = "pdf_".$modele; + break; + } + } + + if ($filefound) + { + require_once $file; + + $module = new $classname($db,$commande); + + if ($module->write_file($commande,$langs) > 0) + { + header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); + return; + } + else + { + setEventMessages($module->error, $module->errors, 'errors'); + dol_syslog($module->error, LOG_ERR); + } + } + else + { + setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); + dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); + } +} + +// Activate a model +else if ($action == 'setmodel') +{ + //print "sssd".$value; + $ret = addDocumentModel($value, $type, $label, $scandir); +} + +else if ($action == 'del') +{ + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity); + } +} + +// Set default model +else if ($action == 'setdoc') +{ + if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$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->ACTION_EVENT_ADDON_PDF = $value; + } + + // On active le modele + $ret = delDocumentModel($value, $type); + if ($ret > 0) + { + $ret = addDocumentModel($value, $type, $label, $scandir); + } +} + + +/** + * View + */ + +$formactions=new FormActions($db); +$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); +llxHeader(); + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup'); +print "
\n"; + + + + +$head=agenda_prepare_head(); + +dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action'); + +print ''; +print ''; + +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print ''."\n"; + + +// AGENDA REMINDER EMAIL +if ($conf->global->MAIN_FEATURES_LEVEL > 0) +{ + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + } else { + print ''.img_picto($langs->trans('Enabled'),'switch_on').''; + print ''."\n"; + } +} + +// AGENDA REMINDER BROWSER +if ($conf->global->MAIN_FEATURES_LEVEL > 0) +{ + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + } else { + print ''.img_picto($langs->trans('Enabled'),'switch_on').''; + print ''."\n"; + + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + } +} + +print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").'
'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).' '."\n"; + + if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { + print ''.img_picto($langs->trans('Disabled'),'switch_off').''; + print '
'.$langs->trans('AGENDA_REMINDER_BROWSER').' '."\n"; + + if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { + print ''.img_picto($langs->trans('Disabled'),'switch_off').''; + print '
'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').' '."\n"; + + if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { + print ''.img_picto($langs->trans('Disabled'),'switch_off').''; + } else { + print ''.img_picto($langs->trans('Enabled'),'switch_on').''; + } + + print '
'; + +dol_fiche_end(); + +print '
'; + +print ''; + +print "
"; + +llxFooter(); + +$db->close(); diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 99742b19f57..93f0e909ab9 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -71,11 +71,11 @@ if ($actionsave) if (! isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY=100; -llxHeader(); +$wikihelp='EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +llxHeader('', $langs->trans("AgendaSetup"), $wikihelp); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup'); -print '
'; print '
'; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index afe60acff2e..c8162c5229f 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -1,4 +1,5 @@ * Copyright (C) 2010-2016 Juanjo Menent * Copyright (C) 2013-2014 Philippe Grand @@ -21,15 +22,14 @@ /** * \file htdocs/admin/bank.php - * \ingroup bank - * \brief Page to setup the bank module + * \ingroup bank + * \brief Page to setup the bank module */ - require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $langs->load("admin"); $langs->load("companies"); @@ -38,12 +38,12 @@ $langs->load("other"); $langs->load("banks"); if (!$user->admin) - accessforbidden(); + accessforbidden(); -$action = GETPOST('action','alpha'); -$value = GETPOST('value','alpha'); -$label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$action = GETPOST('action', 'alpha'); +$value = GETPOST('value', 'alpha'); +$label = GETPOST('label', 'alpha'); +$scandir = GETPOST('scandir', 'alpha'); $type = 'bankaccount'; @@ -52,100 +52,109 @@ $type = 'bankaccount'; */ //Order display of bank account -if ($action == 'setbankorder') -{ - if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",GETPOST('value','alpha'),'chaine',0,'',$conf->entity) > 0) - { - header("Location: ".$_SERVER["PHP_SELF"]); - exit; - } - else - { - dol_print_error($db); - } +if ($action == 'setbankorder') { + if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION", + GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) { + header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } + else { + dol_print_error($db); + } +} + +//Auto report last num releve on conciliate +if ($action == 'setreportlastnumreleve') { + if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0, + '', $conf->entity) > 0) { + header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } + else { + dol_print_error($db); + } +} +elseif ($action == 'unsetreportlastnumreleve') { + if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0, + '', $conf->entity) > 0) { + header("Location: " . $_SERVER["PHP_SELF"]); + exit; + } + else { + dol_print_error($db); + } } -if ($action == 'specimen') -{ - $modele=GETPOST('module','alpha'); - - if ($modele == 'sepamandate') - { +if ($action == 'specimen') { + $modele = GETPOST('module', 'alpha'); + + if ($modele == 'sepamandate') { $object = new CompanyBankAccount($db); } - else - { + else { $object = new Account($db); } $object->initAsSpecimen(); - + // Search template files - $file=''; $classname=''; $filefound=0; - $dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); - foreach($dirmodels as $reldir) - { - $file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0); - if (file_exists($file)) - { - $filefound=1; - $classname = "pdf_".$modele; + $file = ''; + $classname = ''; + $filefound = 0; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php", + 0); + if (file_exists($file)) { + $filefound = 1; + $classname = "pdf_" . $modele; break; } } - - if ($filefound) - { + + if ($filefound) { require_once $file; - + $module = new $classname($db); - - if ($module->write_file($object,$langs) > 0) - { - header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf"); + + if ($module->write_file($object, $langs) > 0) { + header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=bank&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, null, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } } // Activate a model -if ($action == 'set') -{ - $ret = addDocumentModel($value, $type, $label, $scandir); +if ($action == 'set') { + $ret = addDocumentModel($value, $type, $label, $scandir); } - -else if ($action == 'del') -{ - $ret = delDocumentModel($value, $type); - if ($ret > 0) - { - if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity); - } +else if ($action == 'del') { + $ret = delDocumentModel($value, $type); + if ($ret > 0) { + if ($conf->global->BANKADDON_PDF == "$value") + dolibarr_del_const($db, 'BANKADDON_PDF', $conf->entity); + } } // Set default model -else if ($action == 'setdoc') -{ - if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity)) - { +else if ($action == 'setdoc') { + if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '', + $conf->entity)) { // The constant that was read before the new set // We therefore requires a variable to have a coherent view $conf->global->BANKADDON_PDF = $value; } - + // On active le modele $ret = delDocumentModel($value, $type); - if ($ret > 0) - { + if ($ret > 0) { $ret = addDocumentModel($value, $type, $label, $scandir); } } @@ -156,80 +165,78 @@ else if ($action == 'setdoc') * view */ -$form=new Form($db); +$form = new Form($db); -$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); -llxHeader("",$langs->trans("BankSetupModule")); +llxHeader("", $langs->trans("BankSetupModule")); -$linkback=''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup'); +$linkback = '' . $langs->trans("BackToModuleList") . ''; +print load_fiche_titre($langs->trans("BankSetupModule"), $linkback, + 'title_setup'); $head = bank_admin_prepare_head(null); dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account'); -$var=true; +$var = true; -$var=! $var; +$var = !$var; //Show bank account order print load_fiche_titre($langs->trans("BankOrderShow"), '', ''); print ''; print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; print ''; print "\n"; -$bankorder[0][0]=$langs->trans("BankOrderGlobal"); -$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc"); -$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey'; -$bankorder[1][0]=$langs->trans("BankOrderES"); -$bankorder[1][1]=$langs->trans("BankOrderESDesc"); -$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber'; +$bankorder[0][0] = $langs->trans("BankOrderGlobal"); +$bankorder[0][1] = $langs->trans("BankOrderGlobalDesc"); +$bankorder[0][2] = 'BankCode DeskCode BankAccountNumber BankAccountNumberKey'; +$bankorder[1][0] = $langs->trans("BankOrderES"); +$bankorder[1][1] = $langs->trans("BankOrderESDesc"); +$bankorder[1][2] = 'BankCode DeskCode BankAccountNumberKey BankAccountNumber'; $var = true; -$i=0; +$i = 0; -$nbofbank=count($bankorder); -while ($i < $nbofbank) -{ - $var = !$var; +$nbofbank = count($bankorder); +while ($i < $nbofbank) { + $var = !$var; - print ''; - print ''; - print '\n"; + print ''; + print ''; + print '\n"; - if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) - { - print ''; - } - else - { - print ''; - } - print ''; - print ''."\n"; - $i++; + if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) { + print ''; + } + else { + print ''; + } + print ''; + print '' . "\n"; + $i++; } -print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").'' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Example") . '' . $langs->trans("Status") . ' 
'.$bankorder[$i][0]."\n"; - print $bankorder[$i][1]; - print ''; - $tmparray=explode(' ',$bankorder[$i][2]); - foreach($tmparray as $key => $val) - { - if ($key > 0) print ', '; - print $langs->trans($val); - } - print "
' . $bankorder[$i][0] . "\n"; + print $bankorder[$i][1]; + print ''; + $tmparray = explode(' ', $bankorder[$i][2]); + foreach ($tmparray as $key => $val) { + if ($key > 0) + print ', '; + print $langs->trans($val); + } + print "'; - print img_picto($langs->trans("Activated"),'on'); - print ''; - print img_picto($langs->trans("Disabled"),'off'); - print ' 
'; + print img_picto($langs->trans("Activated"), 'on'); + print ''; + print img_picto($langs->trans("Disabled"), 'off'); + print ' 
'."\n"; +print '' . "\n"; print '

'; @@ -257,7 +264,8 @@ if ($resql) { array_push($def, $array[0]); $i ++; } -} else { +} +else { dol_print_error($db); } @@ -273,11 +281,10 @@ print "\n"; clearstatcache(); -foreach ($dirmodels as $reldir) -{ +foreach ($dirmodels as $reldir) { foreach (array('', '/doc') as $valdir) { $dir = dol_buildpath($reldir . "core/modules/bank" . $valdir); - + if (is_dir($dir)) { $handle = opendir($dir); if (is_resource($handle)) { @@ -286,23 +293,26 @@ foreach ($dirmodels as $reldir) } closedir($handle); arsort($filelist); - + foreach ($filelist as $file) { - if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $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) + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL + < 2) $modulequalified = 0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL + < 1) $modulequalified = 0; - + if ($modulequalified) { print ''; print(empty($module->name) ? $name : $module->name); @@ -312,29 +322,35 @@ foreach ($dirmodels as $reldir) else print $module->description; print ''; - + // Active if (in_array($name, $def)) { print '' . "\n"; print ''; - print img_picto($langs->trans("Enabled"), 'switch_on'); + print img_picto($langs->trans("Enabled"), + 'switch_on'); print ''; print ''; - } else { + } + else { print '' . "\n"; - print '' . img_picto($langs->trans("Disabled"), 'switch_off') . ''; + print '' . img_picto($langs->trans("Disabled"), + 'switch_off') . ''; print ""; } - + // Default print ''; if ($conf->global->BANKADDON_PDF == $name) { - print img_picto($langs->trans("Default"), 'on'); - } else { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + print img_picto($langs->trans("Default"), + 'on'); + } + else { + print '' . img_picto($langs->trans("Disabled"), + 'off') . ''; } print ''; - + // Info $htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name; $htmltooltip .= '
' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown")); @@ -342,27 +358,33 @@ foreach ($dirmodels as $reldir) $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("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("MultiLanguage") . ': ' . yn($module->option_multilang, + 1, 1); // $htmltooltip.='
'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1); // $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1); //$htmltooltip .= '
' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1); - + print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); + print $form->textwithpicto('', $htmltooltip, 1, + 0); print ''; - + // Preview print ''; if ($module->type == 'pdf') { - print '' . img_object($langs->trans("Preview"), 'bill') . ''; - } else { - print img_object($langs->trans("PreviewNotAvailable"), 'generic'); + print '' . img_object($langs->trans("Preview"), + 'bill') . ''; + } + else { + print img_object($langs->trans("PreviewNotAvailable"), + 'generic'); } print ''; - + print "\n"; } } @@ -372,9 +394,51 @@ foreach ($dirmodels as $reldir) } } } +print ''; //} + +print '

'; + + +/* + * Document templates generators + */ +//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) +//{ +print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', ''); + + +print "\n"; +print "\n"; +print ''; +print ''; +print '\n"; +print "\n"; + +print ''; +// Active +if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { + print ''; +} +else { + print '"; +} + +print "\n"; +print '
' . $langs->trans("Name") . '' . $langs->trans("Description") . '' . $langs->trans("Status") . "
'; +print $langs->trans('AccountStatement'); +print "\n"; +print $langs->trans('AutoReportLastAccountStatement'); +print '' . "\n"; + print ''; + print img_picto($langs->trans("Enabled"), 'switch_on'); + print ''; + print '' . "\n"; + print '' . img_picto($langs->trans("Disabled"), + 'switch_off') . ''; + print "
'; dol_fiche_end(); llxFooter(); diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 40446c27217..7e4593de2b3 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -285,7 +285,7 @@ if ($mode != 'focus') print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder); } // Entity -if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder); +if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder); // Actions print ''; print "\n"; diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php new file mode 100644 index 00000000000..10ce4656c40 --- /dev/null +++ b/htdocs/admin/dolistore/ajax/image.php @@ -0,0 +1,67 @@ +. + * Copyright (C) 2008-2011 Laurent Destailleur + * + * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); + * it under the terms of the GNU General Public License as published bypliance with the License. + * the Free Software Foundation; either version 3 of the License, or + * + * 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/ + */ + +if (!defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); + + +/** + * \file htdocs/commande/info.php + * \ingroup commande + * \brief Page des informations d'une commande + */ +$res = 0; +if (!$res && file_exists("../main.inc.php")) $res = @include("../main.inc.php"); +if (!$res && file_exists("../../main.inc.php")) $res = @include("../../main.inc.php"); +if (!$res && file_exists("../../../main.inc.php")) $res = @include("../../../main.inc.php"); +if (!$res && file_exists("../../../../main.inc.php")) $res = @include("../../../../main.inc.php"); +if (!$res && file_exists("../../../dolibarr/htdocs/main.inc.php")) + $res = @include("../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only +if (!$res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) + $res = @include("../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only +if (!$res && file_exists("../../../../../dolibarr/htdocs/main.inc.php")) + $res = @include("../../../../../dolibarr/htdocs/main.inc.php"); // Used on dev env only +if (!$res) die("Include of main fails"); + +// CORE + +global $lang, $user, $conf; + + +dol_include_once('/dolistore/class/dolistore.class.php'); +$dolistore = new Dolistore(); + +$id_product = GETPOST('id_product', 'int'); +$id_image = GETPOST('id_image', 'int'); +// quality : image resize with this in the URL : "cart_default", "home_default", "large_default", "medium_default", "small_default", "thickbox_default" +$quality = GETPOST('quality', 'alpha'); + +try { + $url = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/images/products/'.$id_product.'/'.$id_image.'/'.$quality; + $api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, + $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $dolistore->debug_api); + //echo $url; + $request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); + header('Content-type:image'); + print $request['response']; +} catch (PrestaShopWebserviceException $e) { + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) die('Bad ID'); + else if ($trace[0]['args'][0] == 401) die('Bad auth key'); + else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); +} \ No newline at end of file diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php new file mode 100644 index 00000000000..bb59fa93929 --- /dev/null +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -0,0 +1,413 @@ + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +* PrestaShop Webservice Library +* @package PrestaShopWebservice +*/ + +/** + * @package PrestaShopWebservice + */ +class PrestaShopWebservice +{ + + /** @var string Shop URL */ + protected $url; + + /** @var string Authentification key */ + protected $key; + + /** @var boolean is debug activated */ + protected $debug; + + /** @var string PS version */ + protected $version; + + /** @var array compatible versions of PrestaShop Webservice */ + const PSCOMPATIBLEVERSIONMIN = '1.4.0.0'; + const PSCOMPATIBLEVERSIONMAX = '1.6.99.99'; + + /** + * PrestaShopWebservice constructor. Throw an exception when CURL is not installed/activated + * + * getMessage(); + * } + * ?> + * + * @param string $url Root URL for the shop + * @param string $key Authentification key + * @param mixed $debug Debug mode Activated (true) or deactivated (false) + */ + function __construct($url, $key, $debug = true) { + if (!extension_loaded('curl')) + throw new PrestaShopWebserviceException('Please activate the PHP extension \'curl\' to allow use of PrestaShop webservice library'); + $this->url = $url; + $this->key = $key; + $this->debug = $debug; + $this->version = 'unknown'; + } + + /** + * Take the status code and throw an exception if the server didn't return 200 or 201 code + * @param int $status_code Status code of an HTTP return + */ + protected function checkStatusCode($status_code) + { + $error_label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.'; + switch($status_code) + { + case 200: case 201: break; + case 204: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'No content'));break; + case 400: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Bad Request'));break; + case 401: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Unauthorized'));break; + case 404: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Not Found'));break; + case 405: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Method Not Allowed'));break; + case 500: throw new PrestaShopWebserviceException(sprintf($error_label, $status_code, 'Internal Server Error'));break; + default: throw new PrestaShopWebserviceException('This call to PrestaShop Web Services returned an unexpected HTTP status of:' . $status_code); + } + } + /** + * Handles a CURL request to PrestaShop Webservice. Can throw exception. + * @param string $url Resource name + * @param mixed $curl_params CURL parameters (sent to curl_set_opt) + * @return array status_code, response + */ + public function executeRequest($url, $curl_params = array()) + { + $defaultParams = array( + CURLOPT_HEADER => TRUE, + CURLOPT_RETURNTRANSFER => TRUE, + CURLINFO_HEADER_OUT => TRUE, + CURLOPT_HTTPAUTH => CURLAUTH_BASIC, + CURLOPT_USERPWD => $this->key.':', + CURLOPT_HTTPHEADER => array( 'Expect:' ) + ); + + $session = curl_init($url); + + $curl_options = array(); + foreach ($defaultParams as $defkey => $defval) + { + if (isset($curl_params[$defkey])) + $curl_options[$defkey] = $curl_params[$defkey]; + else + $curl_options[$defkey] = $defaultParams[$defkey]; + } + foreach ($curl_params as $defkey => $defval) + if (!isset($curl_options[$defkey])) + $curl_options[$defkey] = $curl_params[$defkey]; + + curl_setopt_array($session, $curl_options); + $response = curl_exec($session); + + $index = strpos($response, "\r\n\r\n"); + if ($index === false && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD') + throw new PrestaShopWebserviceException('Bad HTTP response'); + + $header = substr($response, 0, $index); + $body = substr($response, $index + 4); + + $headerArrayTmp = explode("\n", $header); + + $headerArray = array(); + foreach ($headerArrayTmp as &$headerItem) + { + $tmp = explode(':', $headerItem); + $tmp = array_map('trim', $tmp); + if (count($tmp) == 2) + $headerArray[$tmp[0]] = $tmp[1]; + } + + if (array_key_exists('PSWS-Version', $headerArray)) + { + $this->version = $headerArray['PSWS-Version']; + if ( + version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMIN, $headerArray['PSWS-Version']) == 1 || + version_compare(PrestaShopWebservice::PSCOMPATIBLEVERSIONMAX, $headerArray['PSWS-Version']) == -1 + ) + throw new PrestaShopWebserviceException('This library is not compatible with this version of PrestaShop. Please upgrade/downgrade this library'); + } + + if ($this->debug) + { + $this->printDebug('HTTP REQUEST HEADER', curl_getinfo($session, CURLINFO_HEADER_OUT)); + $this->printDebug('HTTP RESPONSE HEADER', $header); + + } + $status_code = curl_getinfo($session, CURLINFO_HTTP_CODE); + if ($status_code === 0) + throw new PrestaShopWebserviceException('CURL Error: '.curl_error($session)); + curl_close($session); + if ($this->debug) + { + if ($curl_params[CURLOPT_CUSTOMREQUEST] == 'PUT' || $curl_params[CURLOPT_CUSTOMREQUEST] == 'POST') + $this->printDebug('XML SENT', urldecode($curl_params[CURLOPT_POSTFIELDS])); + if ($curl_params[CURLOPT_CUSTOMREQUEST] != 'DELETE' && $curl_params[CURLOPT_CUSTOMREQUEST] != 'HEAD') + $this->printDebug('RETURN HTTP BODY', $body); + } + return array('status_code' => $status_code, 'response' => $body, 'header' => $header); + } + + public function printDebug($title, $content) + { + echo '
'.$title.'
'.htmlentities($content).'
'; + } + + public function getVersion() + { + return $this->version; + } + + /** + * Load XML from string. Can throw exception + * @param string $response String from a CURL response + * @return SimpleXMLElement status_code, response + */ + protected function parseXML($response) + { + if ($response != '') + { + libxml_clear_errors(); + libxml_use_internal_errors(true); + $xml = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA); + if (libxml_get_errors()) + { + $msg = var_export(libxml_get_errors(), true); + libxml_clear_errors(); + throw new PrestaShopWebserviceException('HTTP XML response is not parsable: '.$msg); + } + return $xml; + } + else + throw new PrestaShopWebserviceException('HTTP response is empty'); + } + + /** + * Add (POST) a resource + *

Unique parameter must take :

+ * 'resource' => Resource name
+ * 'postXml' => Full XML string to add resource

+ * Examples are given in the tutorial

+ * + * @param array $options Options + * @return SimpleXMLElement status_code, response + */ + public function add($options) + { + $xml = ''; + + if (isset($options['resource'], $options['postXml']) || isset($options['url'], $options['postXml'])) + { + $url = (isset($options['resource']) ? $this->url.'/api/'.$options['resource'] : $options['url']); + $xml = $options['postXml']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + } + else + throw new PrestaShopWebserviceException('Bad parameters given'); + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); + + self::checkStatusCode($request['status_code']); + return self::parseXML($request['response']); + } + + /** + * Retrieve (GET) a resource + *

Unique parameter must take :

+ * 'url' => Full URL for a GET request of Webservice (ex: http://mystore.com/api/customers/1/)
+ * OR
+ * 'resource' => Resource name,
+ * 'id' => ID of a resource you want to get

+ *

+ * + * get(array('resource' => 'orders', 'id' => 1)); + * // Here in $xml, a SimpleXMLElement object you can parse + * foreach ($xml->children()->children() as $attName => $attValue) + * echo $attName.' = '.$attValue.'
'; + * } + * catch (PrestaShopWebserviceException $ex) + * { + * echo 'Error : '.$ex->getMessage(); + * } + * ?> + *
+ * @param array $options Array representing resource to get. + * @return SimpleXMLElement status_code, response + */ + public function get($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource'])) + { + $url = $this->url.'/api/'.$options['resource']; + $url_params = array(); + if (isset($options['id'])) + $url .= '/'.$options['id']; + + $params = array('filter', 'display', 'sort', 'limit', 'id_shop', 'id_group_shop'); + foreach ($params as $p) + foreach ($options as $k => $o) + if (strpos($k, $p) !== false) + $url_params[$k] = $options[$k]; + if (count($url_params) > 0) + $url .= '?'.http_build_query($url_params); + } + else + throw new PrestaShopWebserviceException('Bad parameters given '); + + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); + self::checkStatusCode($request['status_code']);// check the response validity + return self::parseXML($request['response']); + } + + /** + * Head method (HEAD) a resource + * + * @param array $options Array representing resource for head request. + * @return SimpleXMLElement status_code, response + */ + public function head($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource'])) + { + $url = $this->url.'/api/'.$options['resource']; + $url_params = array(); + if (isset($options['id'])) + $url .= '/'.$options['id']; + + $params = array('filter', 'display', 'sort', 'limit'); + foreach ($params as $p) + foreach ($options as $k => $o) + if (strpos($k, $p) !== false) + $url_params[$k] = $options[$k]; + if (count($url_params) > 0) + $url .= '?'.http_build_query($url_params); + } + else + throw new PrestaShopWebserviceException('Bad parameters given'); + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); + self::checkStatusCode($request['status_code']);// check the response validity + return $request['header']; + } + /** + * Edit (PUT) a resource + *

Unique parameter must take :

+ * 'resource' => Resource name ,
+ * 'id' => ID of a resource you want to edit,
+ * 'putXml' => Modified XML string of a resource

+ * Examples are given in the tutorial

+ * @param array $options Array representing resource to edit. + */ + public function edit($options) + { + $xml = ''; + if (isset($options['url'])) + $url = $options['url']; + elseif ((isset($options['resource'], $options['id']) || isset($options['url'])) && $options['putXml']) + { + $url = (isset($options['url']) ? $options['url'] : $this->url.'/api/'.$options['resource'].'/'.$options['id']); + $xml = $options['putXml']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + } + else + throw new PrestaShopWebserviceException('Bad parameters given'); + + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); + self::checkStatusCode($request['status_code']);// check the response validity + return self::parseXML($request['response']); + } + + /** + * Delete (DELETE) a resource. + * Unique parameter must take :

+ * 'resource' => Resource name
+ * 'id' => ID or array which contains IDs of a resource(s) you want to delete

+ * + * delete(array('resource' => 'orders', 'id' => 1)); + * // Following code will not be executed if an exception is thrown. + * echo 'Successfully deleted.'; + * } + * catch (PrestaShopWebserviceException $ex) + * { + * echo 'Error : '.$ex->getMessage(); + * } + * ?> + * + * @param array $options Array representing resource to delete. + */ + public function delete($options) + { + if (isset($options['url'])) + $url = $options['url']; + elseif (isset($options['resource']) && isset($options['id'])) + if (is_array($options['id'])) + $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; + else + $url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; + if (isset($options['id_shop'])) + $url .= '&id_shop='.$options['id_shop']; + if (isset($options['id_group_shop'])) + $url .= '&id_group_shop='.$options['id_group_shop']; + $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); + self::checkStatusCode($request['status_code']);// check the response validity + return true; + } + + +} + +/** + * @package PrestaShopWebservice + */ +class PrestaShopWebserviceException extends Exception +{ + +} diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php new file mode 100644 index 00000000000..acf86766e25 --- /dev/null +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -0,0 +1,318 @@ +. + * + * This program is free software; you can redistribute it and/or modifyion 2.0 (the "License"); + * it under the terms of the GNU General Public License as published bypliance with the License. + * the Free Software Foundation; either version 3 of the License, or + * + * 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/ + */ + +include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +include_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/PSWebServiceLibrary.class.php'; + +/** + * Class DolistoreModel + */ +class Dolistore extends DolistoreModel +{ + // params + public $start // beginning of pagination + , $end // end of pagination + , $per_page // pagination: display per page + , $categorie // the current categorie + , $search // the search keywords + // setups + , $url // the url of this page + , $shop_url // the url of the shop + , $vat_rate // the vat rate used in the shop (prices are provided without vat) + , $lang // the integer representing the lang in the store + , $debug_api; // usefull if no dialog + + function __construct($options = array('start' => 0, 'end' => 10, 'per_page' => 50, 'categorie' => 0)) + { + global $conf, $langs; + + $this->start = $options['start']; + $this->end = $options['end']; + $this->per_page = $options['per_page']; + $this->categorie = $options['categorie']; + $this->search = $options['search']; + + $this->url = DOL_URL_ROOT.'/admin/modules.php?mode=marketplace'; + $this->shop_url = 'https://www.dolistore.com/index.php?controller=product&id_product='; + $this->vat_rate = 1.2; // 20% de TVA + $this->debug_api = false; + + if ($this->end == 0) { + $this->end = $this->per_page; + } + + $lang = explode('_', $langs->defaultlang); + $lang = $lang[0]; + $lang_array = ['fr', 'en', 'es', 'it', 'de']; + if (!in_array($lang, $lang_array)) { + $lang = 'en'; + } + $this->lang = array_search($lang, $lang_array) + 1; // 1=fr 2=en ... + + try { + $this->api = new PrestaShopWebservice($conf->global->MAIN_MODULE_DOLISTORE_API_SRV, + $conf->global->MAIN_MODULE_DOLISTORE_API_KEY, $this->debug_api); + + // Here we set the option array for the Webservice : we want products resources + $opt = array(); + $opt['resource'] = 'products'; + // make a search to limit the id returned. + if ($this->search != '') { + $opt2 = array(); + $opt2['url'] = $conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'/api/search?query='.$this->search.'&language='.$this->lang; + // Call + $xml = $this->api->get($opt2); + $products = array(); + foreach ($xml->products->children() as $product) { + $products[] = (int) $product['id']; + } + $opt['filter[id]'] = '['.implode('|', $products).']'; + } elseif ($this->categorie != 0) { + $opt2 = array(); + $opt2['resource'] = 'categories'; + $opt2['id'] = $this->categorie; + // Call + $xml = $this->api->get($opt2); + $products = array(); + foreach ($xml->category->associations->products->children() as $product) { + $products[] = (int) $product->id; + } + $opt['filter[id]'] = '['.implode('|', $products).']'; + } + $opt['display'] = '[id,name,id_default_image,id_category_default,reference,price,condition,show_price,date_add,date_upd,description_short,description,module_version,dolibarr_min,dolibarr_max]'; + $opt['sort'] = 'id_desc'; + $opt['filter[active]'] = '[1]'; + $opt['limit'] = "$this->start,$this->end"; + // Call + $xml = $this->api->get($opt); + $this->products = $xml->products->children(); + + + // Here we set the option array for the Webservice : we want categories resources + $opt = array(); + $opt['resource'] = 'categories'; + $opt['display'] = '[id,id_parent,nb_products_recursive,active,is_root_category,name,description]'; + $opt['sort'] = 'id_asc'; + // Call + $xml = $this->api->get($opt); + $this->categories = $xml->categories->children(); + } catch (PrestaShopWebserviceException $e) { + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) die('Bad ID'); + else if ($trace[0]['args'][0] == 401) die('Bad auth key'); + else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); + } + } + + function get_previous_url() + { + $param_array = array(); + if ($this->start < $this->per_page) { + $sub = 0; + } else { + $sub = $this->per_page; + } + $param_array['start'] = $this->start - $sub; + $param_array['end'] = $this->end - $sub; + if ($this->categorie != 0) { + $param_array['categorie'] = $this->categorie; + } + $param = http_build_query($param_array); + return $this->url."&".$param; + } + + function get_next_url() + { + $param_array = array(); + if (count($this->products) < $this->per_page) { + $add = 0; + } else { + $add = $this->per_page; + } + $param_array['start'] = $this->start + $add; + $param_array['end'] = $this->end + $add; + if ($this->categorie != 0) { + $param_array['categorie'] = $this->categorie; + } + $param = http_build_query($param_array); + return $this->url."&".$param; + } + + function version_compare($v1, $v2) + { + $v1 = explode('.', $v1); + $v2 = explode('.', $v2); + $ret = 0; + $level = 0; + $count1 = count($v1); + $count2 = count($v2); + $maxcount = max($count1, $count2); + while ($level < $maxcount) { + $operande1 = isset($v1[$level]) ? $v1[$level] : 'x'; + $operande2 = isset($v2[$level]) ? $v2[$level] : 'x'; + $level++; + if (strtoupper($operande1) == 'X' || strtoupper($operande2) == 'X' || $operande1 == '*' || $operande2 == '*') { + break; + } + if ($operande1 < $operande2) { + $ret = -$level; + break; + } + if ($operande1 > $operande2) { + $ret = $level; + break; + } + } + //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'
'."\n"; + return $ret; + } +} + + +/** + * Class DolistoreModel + */ +class DolistoreModel +{ + + function get_categories($parent = 0) + { + if (!isset($this->categories)) die('not possible'); + if ($parent != 0) { + $html = '
    '; + } else { + $html = ''; + } + + $nbofcateg = count($this->categories); + for ($i = 0; $i < $nbofcateg; $i++) + { + $cat = $this->categories[$i]; + if ($cat->is_root_category == 1 && $parent == 0) { + $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.'

    '; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; + } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau + $select = ($cat->id == $this->categorie) ? ' selected' : ''; + $html .= '
  • '.$cat->name->language[$this->lang].' '.$cat->nb_products_recursive.''; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; + } else { + + } + } + + if ($html == '
      ') { + return ''; + } + if ($parent != 0) { + return $html.'
    '; + } else { + return $html; + } + } + + function get_products() + { + global $langs, $conf; + $html = ""; + $parity = "pair"; + $last_month = time() - (30 * 24 * 60 * 60); + foreach ($this->products as $product) { + $parity = ($parity == "impair") ? 'pair' : 'impair'; + + // check new product ? + $newapp = ''; + if ($last_month < strtotime($product->date_add)) { + $newapp .= ''.$langs->trans('New').' '; + } + + // check updated ? + if ($last_month < strtotime($product->date_upd) && $newapp == '') { + $newapp .= ''.$langs->trans('Updated').' '; + } + + // add image or default ? + if ($product->id_default_image != '') { + $image_url = dol_buildPath('/dolistore/ajax/image.php?id_product=', 2).$product->id.'&id_image='.$product->id_default_image; + $images = ''. + ''; + } else { + $images = ''; + } + + // free or pay ? + if ($product->price > 0) { + $price = '

    '.price(round((float) $product->price * $this->vat_rate, 2)).' €

    '; + $download_link = ''; + } else { + $price = $langs->trans('Free'); + $download_link = ''; + } + + //checking versions + if ($this->version_compare($product->dolibarr_min, DOL_VERSION) <= 0) { + if ($this->version_compare($product->dolibarr_max, DOL_VERSION) >= 0) { + //compatible + $version = ''.$langs->trans('CompatibleUpTo', $product->dolibarr_max, + $product->dolibarr_min, $product->dolibarr_max).''; + $compatible = ''; + } else { + //never compatible, module expired + $version = ''.$langs->trans('NotCompatible', DOL_VERSION, + $product->dolibarr_min, $product->dolibarr_max).''; + $compatible = 'NotCompatible'; + } + } else { + //need update + $version = ''.$langs->trans('CompatibleAfterUpdate', DOL_VERSION, + $product->dolibarr_min, $product->dolibarr_max).''; + $compatible = 'NotCompatible'; + } + + //output template + $html .= ' +
    '.$newapp.$images.'
    +

    '.$product->name->language[$this->lang].'Details' + .'
    '.$version.'

    + '.dol_print_date(strtotime($product->date_upd)).' - '.$langs->trans('Référence').': '.$product->reference.' - '.$langs->trans('Id').': '.$product->id.'

    '.$product->description_short->language[$this->lang].' + '.$product->description->language[$this->lang].' + '.$price.' + '.$download_link.' + '; + } + return $html; + } + + function get_previous_link($text = '<<') + { + return "$text"; + } + + function get_next_link($text = '>>') + { + return "$text"; + } +} diff --git a/htdocs/admin/dolistore/class/init.php b/htdocs/admin/dolistore/class/init.php new file mode 100644 index 00000000000..df5773d9e7d --- /dev/null +++ b/htdocs/admin/dolistore/class/init.php @@ -0,0 +1,72 @@ +CRUD Tutorial - Customer's list + +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +* PrestaShop Webservice Library +* @package PrestaShopWebservice +*/ +// Here we define constants /!\ You need to replace this parameters +//https://dolistorecatalogpublickey1234567@vmdevwww.dolistore.com/api/ +define('DEBUG', true); // Debug mode +define('PS_SHOP_PATH', 'http://vmdevwww.dolistore.com/'); // Root path of your PrestaShop store +define('PS_WS_AUTH_KEY', 'dolistorecatalogpublickey1234567'); // Auth key (Get it in your Back Office) +require_once('./PSWebServiceLibrary.php'); +// Here we make the WebService Call +try +{ + $webService = new PrestaShopWebservice(PS_SHOP_PATH, PS_WS_AUTH_KEY, DEBUG); + + // Here we set the option array for the Webservice : we want customers resources + $opt['resource'] = 'categories'; + $opt['id'] = '1'; + + // Call + $xml = $webService->get($opt); + // Here we get the elements from children of customers markup "customer" + $resources = $xml->categories->children(); +} +catch (PrestaShopWebserviceException $e) +{ + // Here we are dealing with errors + $trace = $e->getTrace(); + if ($trace[0]['args'][0] == 404) echo 'Bad ID'; + else if ($trace[0]['args'][0] == 401) echo 'Bad auth key'; + else echo 'Other error'; +} +// We set the Title +echo "

    Categories's List

    "; +echo ''; +// if $resources is set we can lists element in it otherwise do nothing cause there's an error +if (isset($resources)) +{ + echo ''; + foreach ($resources as $resource) + { + // Iterates on the found IDs + echo ''; + } +} +echo '
    Id
    '.$resource->attributes().'
    '; +?> + \ No newline at end of file diff --git a/htdocs/admin/dolistore/css/dolistore.css b/htdocs/admin/dolistore/css/dolistore.css new file mode 100644 index 00000000000..18549c3ed83 --- /dev/null +++ b/htdocs/admin/dolistore/css/dolistore.css @@ -0,0 +1,234 @@ + +div.divsearchfield { + float: left; + margin: 4px 12px 4px 2px; + padding-left: 2px; +} + +.margeCoteGauche,.margeCote{ + padding-right: 20px!important; +} +.margeCote,.margeCoteDroite{ + padding-left: 20px!important; +} +.nomargesupinf{ + margin-top: 0; + margin-bottom: 0; +} +#category-tree-left{ + display: none; + vertical-align: top; + width: 24%; +} +#listing-content{ + box-sizing: border-box; + display: inline-block; + width: 100%; +} +.tree{ + margin: 0px 0px 0px 0px; + padding:0px; + list-style: none; line-height: 2em; font-family: Arial; +} +.tree li{ + font-size: 16px; + position: relative;list-style: none; +} +.tree li:before{ + position: absolute; + left: -15px; + top: -4px; + content: ''; + display: block; + border-left: 1px solid #ddd; + height: 1em; + border-bottom: 1px solid #ddd; + width: 10px; +} +.tree li:after{ + position: absolute; + left: -15px; + bottom: -7px; + content: ''; + display: block; + border-left: 1px solid #ddd; + height: 100%; +} + +.tree li.root{ + margin: 0px 0px 0px 0px; +} +.tree li.root:before{ + display: none; +} + +.tree li.root:after{ + display: none; +} +.tree li:last-child:after{ + display: none +} +.blockUI { + cursor: auto!important; +} +.newAppParent{ + position: relative; + overflow: hidden; + min-height: 100px; +} +.newApp, .updatedApp{ + background-color: orange; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.35); + box-sizing: border-box; + color: white; + display: block; + font-size: 18px; + font-weight: bold; + left: -34px; + padding: 5px 0; + position: absolute; + text-align: center; + text-shadow: 0 0 5px rgba(0, 0, 0, 0.35); + top: 22px; + transform: rotate(-45deg); + width: 150px; +} +.updatedApp{ + background-color: greenyellow; +} +.notcompatible { + color: red; +} +.compatibleafterupdate { + color: orange; +} +.compatible { + background-image: url("../img/compatible.png"); + background-position: left center; + background-repeat: no-repeat; + color: green; + display: inline-block; + height: 32px; + line-height: 32px; + padding-left: 35px; +} +tr.app { + height:250px; +} + +div#newsDoli.tabBar { + margin-top: 50px; + margin-right: 30px; +} +.selected { + text-decoration: underline!important; +} +.searchDolistore, .searchDolistore:hover { + padding-left: 30px; + padding-right: 30px; + font-weight: bold; +} +.searchDolistore:hover { + text-decoration: underline!important; +} + +.score{ + font-size: 16px; + font-weight: bold; +} +.formReviewArea{ + display:none; +} +.formReview div.divsearchfield{ + float: none; +} +.input100{ + box-sizing: border-box; + width: 100%; +} +.input50{ + box-sizing: border-box; + width: 49%; +} +textarea.row4{ + min-height: 100px; +} + + +.reviewList { + max-height: 150px; + overflow-y: scroll; +} + +.reviewRow{ + margin-bottom: 20px; +} +.reviewRow .reviewMarge { + float:left; + width: 220px; + padding: 0 20px 20px 0; +} +.reviewRow .score { + font-size: 48px; + display: block; + text-align: center; +} +.reviewRow .reviewDate { + color:grey; +} +.reviewRow:after{ + clear: both; + content:''; + display: block; +} +h2.appTitle small{ + font-weight: normal; +} +tr.NotCompatible{ + /* IE 8 */ + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=25)"; + + /* IE 5-7 */ + filter: alpha(opacity=25); + + /* Netscape */ + -moz-opacity: 0.25; + + /* Safari 1.x */ + -khtml-opacity: 0.25; + + /* Good browsers */ + opacity: 0.25; +} +tr.NotCompatible:hover{ + /* IE 8 */ + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + + /* IE 5-7 */ + filter: alpha(opacity=100); + + /* Netscape */ + -moz-opacity: 1; + + /* Safari 1.x */ + -khtml-opacity: 1; + + /* Good browsers */ + opacity: 1; +} +@media only screen and (min-width: 1150px) { + #categorieArea{ + display:none; + } + #category-tree-left{ + display:inline-block; + } + #listing-content{ + width: 75%; + } +} +span.details{ + font-size: 12px; + margin-left: 10px; + vertical-align: super; +} \ No newline at end of file diff --git a/htdocs/admin/dolistore/img/Download-128.png b/htdocs/admin/dolistore/img/Download-128.png new file mode 100644 index 00000000000..89756d1f012 Binary files /dev/null and b/htdocs/admin/dolistore/img/Download-128.png differ diff --git a/htdocs/admin/dolistore/img/NoImageAvailable.png b/htdocs/admin/dolistore/img/NoImageAvailable.png new file mode 100644 index 00000000000..9a88d4362da Binary files /dev/null and b/htdocs/admin/dolistore/img/NoImageAvailable.png differ diff --git a/htdocs/admin/dolistore/img/compatible.png b/htdocs/admin/dolistore/img/compatible.png new file mode 100644 index 00000000000..93a85574165 Binary files /dev/null and b/htdocs/admin/dolistore/img/compatible.png differ diff --git a/htdocs/admin/dolistore/img/dolistore.png b/htdocs/admin/dolistore/img/dolistore.png new file mode 100644 index 00000000000..d3fc61e7293 Binary files /dev/null and b/htdocs/admin/dolistore/img/dolistore.png differ diff --git a/htdocs/admin/dolistore/img/follow.png b/htdocs/admin/dolistore/img/follow.png new file mode 100644 index 00000000000..78383c1157f Binary files /dev/null and b/htdocs/admin/dolistore/img/follow.png differ diff --git a/htdocs/admin/dolistore/img/object_dolistore.png b/htdocs/admin/dolistore/img/object_dolistore.png new file mode 100644 index 00000000000..213d0e0a3b7 Binary files /dev/null and b/htdocs/admin/dolistore/img/object_dolistore.png differ diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 143ebc627f8..830b323545f 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -269,7 +269,7 @@ if ($objMod->isCoreOrExternalModule() == 'external') $modulename=$objMod->getName(); $moduledesc=$objMod->getDesc(); $moduleauthor=$objMod->getPublisher(); - +$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod))); print '
    '; @@ -449,11 +449,28 @@ if ($mode == 'feature') $text.='
    '; $text.='
    '.$langs->trans("AddTriggers").': '; + $moreinfoontriggerfile=''; if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers']) { - $text.=$langs->trans("Yes"); + $yesno='Yes'; } - else $text.=$langs->trans("No"); + else + { + $yesno='No'; + } + require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; + $interfaces = new Interfaces($db); + $triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external')?'/'.$moduledir:'').'/core/triggers')); + foreach($triggers as $triggercursor) + { + if ($triggercursor['module'] == $moduledir) + { + $yesno='Yes'; + $moreinfoontriggerfile=' ('.$triggercursor['relpath'].')'; + } + } + + $text.=$langs->trans($yesno).$moreinfoontriggerfile; $text.='
    '; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index a59d6fca3bb..2c18e9c4927 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -32,6 +32,7 @@ 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/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php'; $langs->load("errors"); $langs->load("admin"); @@ -46,6 +47,17 @@ $search_status=GETPOST('search_status','alpha'); $search_nature=GETPOST('search_nature','alpha'); $search_version=GETPOST('search_version','alpha'); + +// For dolistore search +$options = array(); +$options['per_page'] = 20; +$options['categorie'] = GETPOST('categorie', 'int') + 0; +$options['start'] = GETPOST('start', 'int') + 0; +$options['end'] = GETPOST('end', 'int') + 0; +$options['search'] = GETPOST('search_keyword', 'alpha'); +$dolistore = new Dolistore($options); + + if (! $user->admin) accessforbidden(); @@ -240,6 +252,11 @@ if ($action == 'reset' && $user->admin) * View */ +$form = new Form($db); + +$morejs = array("/admin/dolistore/js/dolistore.js.php"); +$morecss = array("/admin/dolistore/css/dolistore.css"); + // Set dir where external modules are installed if (! dol_is_dir($dirins)) { @@ -247,10 +264,8 @@ if (! dol_is_dir($dirins)) } $dirins_ok=(dol_is_dir($dirins)); -$form = new Form($db); - $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; -llxHeader('',$langs->trans("Setup"),$help_url); +llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0); $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 @@ -423,24 +438,9 @@ print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup'); if ($mode=='common') print ''.$langs->trans("ModulesDesc")."
    \n"; if ($mode=='marketplace') print ''.$langs->trans("ModulesMarketPlaceDesc")."
    \n"; if ($mode=='deploy') print ''.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."
    \n"; +if ($mode=='develop') print ''.$langs->trans("ModulesDevelopDesc")."
    \n"; - -$h = 0; - -$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common"; -$head[$h][1] = $langs->trans("AvailableModules"); -$head[$h][2] = 'common'; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace"; -$head[$h][1] = $langs->trans("ModulesMarketPlaces"); -$head[$h][2] = 'marketplace'; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy"; -$head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther"); -$head[$h][2] = 'deploy'; -$h++; +$head = modules_prepare_head(); print "
    \n"; @@ -817,7 +817,6 @@ if ($mode == 'marketplace') print ''.$langs->trans("URL").''; print ''; - print "\n"; $url='https://www.dolistore.com'; print ''; @@ -825,17 +824,57 @@ if ($mode == 'marketplace') print ''.$url.''; print ''; - - print "\n"; - $url='https://partners.dolibarr.org'; - print ''; - print ''.$langs->trans("DoliPartnersDesc").''; - print ''.$url.''; - print ''; - print "\n"; dol_fiche_end(); + + print '
    '; + + if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) + { + print ''.$langs->trans('DOLISTOREdescriptionLong').''; + + + ?> +

    + +
    + + +
    trans('Mot-cle') ?>: +
    +
    +


    + +
    +
    +
      + get_categories(); ?> +
    +
    +
    + + + + + + + + get_products($categorie); ?> + + + + + + +
    get_previous_link() ?> get_next_link() ?> trans('AchatTelechargement') ?>
    get_previous_link() ?> get_next_link() ?> trans('AchatTelechargement') ?>
    +
    + + \n"; + print "\n"; + //print ''.$langs->trans("Logo").''; + print ''.$langs->trans("DevelopYourModuleDesc").''; + print ''.$langs->trans("URL").''; + print ''; + + print "\n"; + $url='https://partners.dolibarr.org'; + print ''; + print ''.$langs->trans("DoliPartnersDesc").''; + print ''.$url.''; + print ''; + + print "\n"; + + dol_fiche_end(); +} + + + llxFooter(); $db->close(); diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 8c1b1fa5b07..66e31f0c7c1 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Juanjo Menent * @@ -103,6 +103,7 @@ else if ($action == 'delete') exit; } + /* * View */ diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 516d9e41bb2..ac520ce22b3 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -260,11 +260,11 @@ if ($result) print ''; - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Code",$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("IP",$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("User",$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Description",$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index c57a78974ed..6106fbe8dd8 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -128,12 +128,12 @@ if ($savehandler == 'files') { print ''; print ''; - print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SessionId"),$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateModification"),$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Age"),$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Raw"),$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("SessionId",$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DateModification",$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Age",$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Raw",$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -141,7 +141,7 @@ if ($savehandler == 'files') foreach ($listofsessions as $key => $sessionentry) { - + print ''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 5236315daf3..016d1ff8bb1 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -235,10 +235,10 @@ if ($mode == 'overwrite') print '
    '; print ''; - print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder); - //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre("NewTranslationStringToShow",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder); + //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); print ''; print "\n"; @@ -393,10 +393,10 @@ if ($mode == 'searchkey') print '
    '; print ''; - print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).''; - print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CurrentTranslationString"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder); - //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).''; + print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder); + print_liste_field_titre("CurrentTranslationString",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder); + //if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder); print ''; print "\n"; diff --git a/htdocs/admin/websites.php b/htdocs/admin/websites.php index e25878b3aaa..4f829db31df 100644 --- a/htdocs/admin/websites.php +++ b/htdocs/admin/websites.php @@ -133,7 +133,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) $fieldnamekey=$listfield[$f]; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } - if ($value == 'ref' && ! preg_match('/^[a-z0-9]+$/i', $_POST[$value])) + if ($value == 'ref' && ! preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value])) { $ok=0; $fieldnamekey=$listfield[$f]; @@ -247,6 +247,8 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } else { $rowidcol="rowid"; } + $db->begin(); + $website=new Website($db); $rowid=GETPOST('rowid','int'); $website->fetch($rowid); @@ -281,14 +283,41 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) $newname = dol_sanitizeFileName(GETPOST('ref','aZ09')); if ($newname != $website->ref) { - $srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref; - $destfile=DOL_DATA_ROOT.'/websites/'.$newname; - @rename($srcfile, $destfile); + $srcfile=DOL_DATA_ROOT.'/websites/'.$website->ref; + $destfile=DOL_DATA_ROOT.'/websites/'.$newname; + + if (dol_is_dir($destfile)) + { + $error++; + setEventMessages($langs->trans('ErrorDirAlreadyExists', $destfile), null, 'errors'); + } + else + { + @rename($srcfile, $destfile); + + // We must now rename $website->ref into $newname inside files + $arrayreplacement = array($website->ref.'/htmlheader.html' => $newname.'/htmlheader.html'); + $listofilestochange = dol_dir_list($destfile, 'files', 0, '\.php$'); + foreach ($listofilestochange as $key => $value) + { + dolReplaceInFile($value['fullname'], $arrayreplacement); + } + } } } else { - setEventMessages($db->error(), null, 'errors'); + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } + + if (! $error) + { + $db->commit(); + } + else + { + $db->rollback(); } } //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index a192076e88a..c9387561837 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -101,19 +101,19 @@ if ($resql) if ($optioncss != '') $param ='&optioncss='.$optioncss; $moreforfilter=''; - + print '
    '; print '
    '."\n"; - + 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"),$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Link"),'',''); - print_liste_field_titre($langs->trans("Target"),'','','','','align="center"'); - 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); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Link",'',''); + print_liste_field_titre("Target",'','','','','align="center"'); + print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Position",$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -122,7 +122,7 @@ if ($resql) { $obj = $db->fetch_object($resql); - + print ''; // Id @@ -209,7 +209,7 @@ if ($resql) } print "
     
    "; print '
    '; - + $db->free($resql); } else diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 70b2acb86b7..704f307283e 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1194,7 +1194,7 @@ class ActionComm extends CommonObject { $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':''); } - $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend; + $result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="valigntextbottom"':'class="classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1).$linkend; } if ($withpicto==1) $result.=' '; $result.=$linkstart.$libelleshort.$linkend; @@ -1498,5 +1498,32 @@ class ActionComm extends CommonObject return $this->datep && ($this->datep < ($now - $conf->agenda->warning_delay)); } + + /** + * Send reminders by emails + * CAN BE A CRON TASK + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + public function sendEmailsReminder() + { + global $conf, $langs; + + $this->output = ''; + $this->error=''; + + if (empty($conf->global->AGENDA_REMINDER_EMAIL)) + { + $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda")); + return 0; + } + + dol_syslog(__METHOD__, LOG_DEBUG); + + + + return 0; + } + } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 59755728e81..c77c4279439 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -394,17 +394,17 @@ if ($resql) 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); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("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); - if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre($langs->trans("LinkedObject"),$_SERVER["PHP_SELF"],"a.fk_element",$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("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); + if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre(""); print "\n"; diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index a13ffe61c76..5c160bfab16 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -126,14 +126,14 @@ if ($resql) print_barre_liste($title.($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,"",$num); print '
    '; - + print ''; print ''; - print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Email")); - print_liste_field_titre($langs->trans("Phone")); + print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder); + print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"p.firstname", $begin, $param,"",$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom", $begin, $param,"",$sortfield,$sortorder); + print_liste_field_titre("Email"); + print_liste_field_titre("Phone"); print "\n"; print ''; @@ -150,7 +150,7 @@ if ($resql) { $obj = $db->fetch_object($resql); - + print ''; print '
    '.img_object($langs->trans("ShowContact"),"contact"); @@ -168,9 +168,9 @@ if ($resql) $i++; } print "
    "; - + print '
    '; - + $db->free($resql); } else diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 6c580cc93d6..a2743246560 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -184,12 +184,12 @@ if ($object->fetch($id) >= 0) $morehtmlright=''; if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; - + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); print '
    '; print '
    '; - + print ''; print ''; @@ -221,7 +221,7 @@ if ($object->fetch($id) >= 0) print ""; dol_fiche_end(); - + $allowaddtarget=($object->statut == 0); @@ -232,7 +232,7 @@ if ($object->fetch($id) >= 0) //print '
    '.$langs->trans("MailTitle").''.$object->titre.'
    '; print '
    '; - + //print '
    '; print '
    '; //print '
    '; @@ -245,11 +245,11 @@ if ($object->fetch($id) >= 0) print '
     
    '; //print "\n"; print ''; - + clearstatcache(); $var = true; - + foreach ($modulesdir as $dir) { $modulenames=array(); @@ -324,7 +324,7 @@ if ($object->fetch($id) >= 0) print $obj->getDesc(); //print ''; print ''; - + try { $nbofrecipient=$obj->getNbOfRecipients(''); } @@ -345,7 +345,7 @@ if ($object->fetch($id) >= 0) } //print ''; print ''; - + //print ''; print ''; - + //print ''; print ''; - + if ($allowaddtarget) print ''; else print ''; - + //print "\n"; // print ''."\n"; } @@ -389,7 +389,7 @@ if ($object->fetch($id) >= 0) //print '
    '.$langs->trans("RecipientSelectionModules").'
    '; print '
    '; if ($allowaddtarget) @@ -362,7 +362,7 @@ if ($object->fetch($id) >= 0) } //print '
    '; print '
    '; if ($allowaddtarget) @@ -377,10 +377,10 @@ if ($object->fetch($id) >= 0) } //print '
    '; print '
    '; - + print '

    '; } @@ -412,11 +412,11 @@ if ($object->fetch($id) >= 0) } //$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets $sql .= $db->plimit($limit+1, $offset); - + $resql=$db->query($sql); if ($resql) { - + $num = $db->num_rows($resql); $param = "&id=".$object->id; @@ -436,7 +436,7 @@ if ($object->fetch($id) >= 0) $cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'id.'" class="button reposition">'.$langs->trans("TargetsReset").''; } print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit); - + print ''; print "\n\n"; @@ -447,12 +447,12 @@ if ($object->fetch($id) >= 0) print ''; print ''; print ''; - + if ($page) $param.= "&page=".$page; - + print ''; - + // Ligne des champs de filtres print ''; // EMail @@ -475,7 +475,7 @@ if ($object->fetch($id) >= 0) print ''; - + // Date sending print ''; print ''; - + print ''; - print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("OtherInformations",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Source",$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder); // Date sending if ($object->statut < 2) { @@ -504,9 +504,9 @@ if ($object->fetch($id) >= 0) } else { - print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder); + print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print ''; @@ -590,7 +590,7 @@ if ($object->fetch($id) >= 0) } else { - if ($object->statut < 2) + if ($object->statut < 2) { print '
    '; print ' '; print ''; print ' '; @@ -490,13 +490,13 @@ if ($object->fetch($id) >= 0) print $searchpicto; print '
    '; print $langs->trans("NoTargetYet"); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index fb513c99b9b..82cb53fdfbf 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -109,7 +109,7 @@ if ($result) $param = "&sall=".urlencode($sall); if ($filteremail) $param.='&filteremail='.urlencode($filteremail); - + print '
    '; if ($optioncss != '') print ''; print ''; @@ -117,9 +117,9 @@ if ($result) print ''; print ''; print ''; - + $moreforfilter = ''; - + print '
    '; print ''."\n"; @@ -142,24 +142,24 @@ if ($result) print "\n"; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder); - if (! $filteremail) print_liste_field_titre($langs->trans("NbOfEMails"),$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder); - if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); - else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder); + if (! $filteremail) print_liste_field_titre("NbOfEMails",$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder); + if (! $filteremail) print_liste_field_titre("DateLastSend",$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); + else print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("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); - + 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->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); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.label",$param,"",'',$sortfield,$sortorder); + //print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("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("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( $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"; diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 1b4036af8af..5a371554058 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -200,13 +200,13 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 6062f6033dc..9292a378327 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -73,9 +73,9 @@ $search_zip=GETPOST('search_zip','alpha'); $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country",'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); -$viewstatut=GETPOST('viewstatut'); +$viewstatut=GETPOST('viewstatut','alpha'); $optioncss = GETPOST('optioncss','alpha'); -$object_statut=GETPOST('propal_statut'); +$object_statut=GETPOST('propal_statut','alpha'); $sall=GETPOST('sall', 'alphanohtml'); $mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg")); @@ -734,7 +734,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d7199e878ec..b801756fc9e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1000,7 +1000,7 @@ class Commande extends CommonOrder $this->db->begin(); - // get extrafields so they will be clone + // get lines so they will be clone foreach($this->lines as $line) $line->fetch_optionals($line->rowid); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 8aa699fed71..205efc3ad91 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -120,11 +120,11 @@ if ($resql) print ''; print ''; - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("Town",$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("AccountancyCode",$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre @@ -146,7 +146,7 @@ if ($resql) print ''; - + print "\n"; $var=true; @@ -155,7 +155,7 @@ if ($resql) { $obj = $db->fetch_object($resql); - + print ''; print '\n"; + print '\n"; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 945cc290f54..bc0fca719d6 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1960,6 +1960,67 @@ class AccountLine extends CommonObject } + /** + * Increase/decrease operation date of a rowid + * + * @param int $rowid Id of line + * @param int $sign 1 or -1 + * @return int >0 if OK, 0 if KO + */ + function dateo_change($rowid,$sign=1) + { + $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; + $resql = $this->db->query($sql); + if ($resql) + { + $obj=$this->db->fetch_object($resql); + $newdate=$this->db->jdate($obj->dateo)+(3600*24*$sign); + + $sql = "UPDATE ".MAIN_DB_PREFIX."bank SET"; + $sql.= " dateo = '".$this->db->idate($newdate)."'"; + $sql.= " WHERE rowid = ".$rowid; + + $result = $this->db->query($sql); + if ($result) + { + if ($this->db->affected_rows($result)) + { + return 1; + } + } + else + { + dol_print_error($this->db); + return 0; + } + } + else dol_print_error($this->db); + return 0; + } + + /** + * Increase operation date of a rowid + * + * @param int $id Id of line to change + * @return int >0 if OK, 0 if KO + */ + function dateo_next($id) + { + return $this->dateo_change($id,1); + } + + /** + * Decrease operation date of a rowid + * + * @param int $id Id of line to change + * @return int >0 if OK, 0 if KO + */ + function dateo_previous($id) + { + return $this->dateo_change($id,-1); + } + + /** * Load miscellaneous information for tab "Info" * diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 6c0d1613943..7d5046d18c9 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -418,7 +418,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index 99362167a07..525b7a72e12 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -71,13 +71,20 @@ if ($cancel) } } -if ($user->rights->banque->consolidate && $action == 'dvnext') + +if ($user->rights->banque->consolidate && $action == 'donext') +{ + $al = new AccountLine($db); + $al->dateo_next($_GET["rowid"]); +}elseif ($user->rights->banque->consolidate && $action == 'doprev') +{ + $al = new AccountLine($db); + $al->dateo_previous($_GET["rowid"]); +}elseif ($user->rights->banque->consolidate && $action == 'dvnext') { $al = new AccountLine($db); $al->datev_next($_GET["rowid"]); -} - -if ($user->rights->banque->consolidate && $action == 'dvprev') +}elseif ($user->rights->banque->consolidate && $action == 'dvprev') { $al = new AccountLine($db); $al->datev_previous($_GET["rowid"]); @@ -479,6 +486,14 @@ if ($result) { print ''; } else diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 1dbe17d6a13..0e2d3b35f38 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -275,6 +275,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $refcomp=$societestatic->getNomUrl(1,'',24); $paiement = $facturestatic->getSommePaiement(); // Payment already done + $paiement+= $facturestatic->getSumDepositsUsed(); + $paiement+= $facturestatic->getSumCreditNotesUsed(); } if ($obj->family == 'social_contribution') { diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index 8ce80c9eddd..820c27dc354 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -28,9 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; -$langs->load("compta"); -$langs->load("banks"); -$langs->load("bills"); +$langs->loadLangs(array("compta","banks","bills","accountancy")); // Security check $socid = GETPOST("socid","int"); @@ -43,7 +41,8 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $search_ref = GETPOST('search_ref','int'); $search_user = GETPOST('search_user','alpha'); $search_label = GETPOST('search_label','alpha'); -$search_amount = GETPOST('search_amount','alpha'); +$search_amount_deb = GETPOST('search_amount_deb','alpha'); +$search_amount_cred = GETPOST('search_amount_cred','alpha'); $search_account = GETPOST('search_account','int'); $sortfield = GETPOST("sortfield",'alpha'); @@ -77,7 +76,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', { $search_ref=""; $search_label=""; - $search_amount=""; + $search_amount_deb=""; + $search_amount_cred=""; $search_account=''; $typeid=""; } @@ -104,7 +104,8 @@ $sql.= " WHERE v.entity = ".$conf->entity; // Search criteria if ($search_ref) $sql.=" AND v.rowid=".$search_ref; if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 1); +if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { $filtre=str_replace(":","=",$filtre); @@ -152,14 +153,14 @@ if ($result) print '
    '; print ''; print '
    '; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 565f39e62a2..b2d4f5d9a61 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1036,7 +1036,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index fa9f810b036..83ec75043c3 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -602,12 +602,12 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','','&socid='.$socid,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','','&socid='.$socid,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),'','','','','align="right"'); - print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"'); + print_liste_field_titre('Ref',$_SERVER["PHP_SELF"],'c.ref','','&socid='.$socid,'',$sortfield,$sortorder); + print_liste_field_titre('RefCustomerOrder',$_SERVER["PHP_SELF"],'c.ref_client','','&socid='.$socid,'',$sortfield,$sortorder); + print_liste_field_titre('OrderDate',$_SERVER["PHP_SELF"],'c.date_commande','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre('DeliveryDate',$_SERVER["PHP_SELF"],'c.date_livraison','','&socid='.$socid, 'align="center"',$sortfield,$sortorder); + print_liste_field_titre('Status','','','','','align="right"'); + print_liste_field_titre('GenerateBill','','','','','align="center"'); print ''; // Lignes des champs de filtre diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 3044ed9af47..8e41ccedf3f 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -605,7 +605,7 @@ if ($resql) // print '
    '; print '
    '; print ''.$langs->trans("InputReceiptNumber").': '; - print ''; // The only default value is value we just entered + print ''; // The only default value is value we just entered print '
    '; if ($options) { print $langs->trans("EventualyAddCategory").': '; @@ -649,6 +649,16 @@ if ($resql) { dol_print_error($db); } + /** + * Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) + */ + if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) { + print ' + + '; + } print '

    '; // print '
    '; } @@ -896,7 +906,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -1117,7 +1127,16 @@ if ($resql) // Date ope if (! empty($arrayfields['b.dateo']['checked'])) { - print '
    '.dol_print_date($db->jdate($objp->do),"day")."'; + print ''.dol_print_date($db->jdate($objp->do),"day").""; + print ' '; + print ''; + print ''; + print img_edit_remove() . " "; + print ''; + print img_edit_add() .""; + print ''; + print "'; print $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro); + if (! $objp->rappro) + { + print '   '; + print ''; + print img_edit_remove() . " "; + print ''; + print img_edit_add() .""; + } print '
    '."\n"; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AccountAccounting"),$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -192,11 +193,11 @@ if ($result) // Accounting account if (! empty($conf->accounting->enabled)) print ''; - // Amount - print ''; + // Debit + print ''; - // Sens - print ''; + // Credit + print ''; print '\n"; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($result); @@ -241,7 +243,7 @@ if ($result) $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($obj->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); + $accountstatic->accountancy_journal = $accountingjournal->code; } $accountstatic->label=$obj->blabel; @@ -259,16 +261,25 @@ if ($result) print ''; } - // Amount - print ""; + // Debit + print ""; + + // Credit + print ""; - // Sens - if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit"); - print ""; print ""; - print "\n"; - - $total = $total + $obj->amount; $i++; } @@ -277,7 +288,8 @@ if ($result) if (! empty($conf->banque->enabled)) $colspan++; print ''; print ''; - print '"; + print '"; + print '"; print ''; print ''; print ''; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 715d1c96627..c7d58a7070c 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -120,15 +120,15 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print '
      '; $searchpicto=$form->showFilterAndCheckAddButtons(0); @@ -205,6 +206,7 @@ if ($result) print "
    '.$accountingaccount->getNomUrl(0,1,1,'',1).'".price($obj->amount).""; + if ($obj->sens == 0) + { + print price($obj->amount); + $totalarray['totaldeb'] += $obj->amount; + } + print ""; + if ($obj->sens == 1) + { + print price($obj->amount); + $totalarray['totalcred'] += $obj->amount; + } + print "".$sens."
    '.$langs->trans("Total").''.price($total)."'.price($totalarray['totaldeb'])."'.price($totalarray['totalcred'])."
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $sql = "SELECT c.id, c.libelle as lib,"; @@ -278,14 +278,14 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $total = 0 ; print '
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) @@ -411,11 +411,11 @@ while($j<$numlt) $total = 0 ; print '
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) @@ -466,7 +466,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print "
    "; - print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); + print_fiche_titre( $langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', ''); $sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,"; $sql.= " pct.code as payment_code,"; @@ -493,13 +493,13 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $total = 0 ; print '
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 5c57603bf31..c65a7a670ae 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -69,7 +69,7 @@ if ($action == 'note') $result = $db->query($sql); } -if ($mode == 'search') +if ($mode == 'search') { $resql=$db->query($sql); if ($resql) { @@ -144,11 +144,11 @@ if ($resql) print '
    '; print ''; - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("Town",$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("AccountancyCode",$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder); print "\n"; // Lignes des champs de filtre @@ -178,7 +178,7 @@ if ($resql) { $obj = $db->fetch_object($resql); - + print ''; print '\n"; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("NbOfCheques",$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"bc.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"bc.statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index d31859705a4..f7938811057 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro * @@ -32,15 +32,15 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; $langs->load("bills"); $langs->load("compta"); // Security check -$facid =GETPOST('facid','int'); -$socid =GETPOST('socid','int'); -$userid=GETPOST('userid','int'); +$facid = GETPOST('facid','int'); +$socid = GETPOST('socid','int'); +$userid = GETPOST('userid','int'); $day = GETPOST('day','int'); $month = GETPOST('month','int'); $year = GETPOST('year','int'); @@ -270,23 +270,23 @@ if ($resql) print "\n"; print ''; - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Numero",$_SERVER["PHP_SELF"],"p.num_paiement","",$param,"",$sortfield,$sortorder); if (! empty($conf->banque->enabled)) { - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"p.amount","",$param,'align="right"',$sortfield,$sortorder); + //print_liste_field_titre("Invoices"),"","","",$param,'align="left"',$sortfield,$sortorder); $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -336,7 +336,7 @@ if ($resql) $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objp->accountancy_journal); - $accountstatic->accountancy_journal = $accountingjournal->getNomUrl(0,1,1,'',1); + $accountstatic->accountancy_journal = $accountingjournal->code; print $accountstatic->getNomUrl(1); } diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 6fcbb62b5d9..2a91ae13bfc 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -125,9 +125,9 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"'); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"'); + print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"'); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"'); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"","","",'align="center"'); print "\n"; while ($i < min($num,$limit)) diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 1a0435862ea..20d7b0232e9 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -308,9 +308,9 @@ if ($id > 0) print"\n\n"; print '
    '; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index e42e9f2325a..807ddfee700 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -133,12 +133,12 @@ if ($resql) print ''."\n"; print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Person",$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder); + print_liste_field_titre("FeesKilometersOrAmout",$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -178,7 +178,7 @@ if ($resql) $soc = new Societe($db); if ($obj->socid) $soc->fetch($obj->socid); - + print ''; // Id print ''; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 7d3eb290ab8..d5374fb1806 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -748,6 +748,15 @@ class Facture extends CommonInvoice // Charge facture source $facture=new Facture($this->db); + + $this->fetch_optionals(); + if(!empty($this->array_options)){ + $facture->array_options = $this->array_options; + } + + foreach($this->lines as &$line){ + $line->fetch_optionals();//fetch extrafields + } $facture->fk_facture_source = $this->fk_facture_source; $facture->type = $this->type; diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 56f89a83154..fd43cc42982 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -39,6 +39,8 @@ $ref=GETPOST("ref",'alpha'); * View */ +$form = new Form($db); + $title = $langs->trans('InvoiceCustomer') . " - " . $langs->trans('Info'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 13e9a22d717..a4840dd37be 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -979,7 +979,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5d97c056560..6a3c9a5702b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -855,10 +855,10 @@ if (! GETPOST('action','aZ09')) print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print '
    '.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.'
    '; print ''; - print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder); + print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder); + print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder); + print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder); + print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index be0e96bb4c1..b8ea972dc52 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -102,10 +102,10 @@ if ($resql) print '
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder); + print_liste_field_titre("AmountTTC",$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index b5767a6f0bc..01787ca3372 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -373,7 +373,7 @@ if ($action == 'new') { $paymentstatic=new Paiement($db); $accountlinestatic=new AccountLine($db); - + $lines = array(); $now=dol_now(); @@ -474,7 +474,7 @@ if ($action == 'new') $moreforfilter=''; print '
    '; print '
    '."\n"; - + print ''; print ''."\n"; print '\n"; @@ -529,18 +529,18 @@ if ($action == 'new') print ' '; } print ''; - + print '' ; print ''; - + $i++; } } print "
    '.$langs->trans("DateChequeReceived").''.$langs->trans("ChequeNumber")."'; print ''; print '
    "; print ''; - + print '
    '; if ($user->rights->banque->cheque) { @@ -563,15 +563,15 @@ else $accountstatic->fetch($object->account_id); $linkback=''.$langs->trans("BackToList").''; - + $morehtmlref=''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - + + print '
    '; print '
    '; - + print ''; print ''; print ''; */ - + print ''; @@ -648,7 +648,7 @@ else print ''; - + // List of cheques $sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,"; $sql.= " b.dateo as date, b.datec as datec, b.banque,"; @@ -670,16 +670,16 @@ else print '
    '; @@ -626,7 +626,7 @@ else print '
    '.$langs->trans('Account').''; print $accountstatic->getNomUrl(1); print '
    '; $param="&id=".$object->id; - + print ''; - print_liste_field_titre($langs->trans("Cheques"),'','','','','width="30"'); - print_liste_field_titre($langs->trans("DateChequeReceived"),$_SERVER["PHP_SELF"],"b.dateo,b.rowid", "",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero"),$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CheckTransmitter"),$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Bank"),$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Cheques",'','','','','width="30"'); + print_liste_field_titre("DateChequeReceived",$_SERVER["PHP_SELF"],"b.dateo,b.rowid", "",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Numero",$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("CheckTransmitter",$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Bank",$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Payment",$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("LineRecord",$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; $i=1; @@ -692,7 +692,7 @@ else if (! isset($accounts[$objp->bid])) $accounts[$objp->bid]=0; $accounts[$objp->bid] += 1; - + print ''; print ''; print ''; // Date operation @@ -735,13 +735,13 @@ else { print 'rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').''; } - if ($objp->statut == 2) + if ($objp->statut == 2) { print '   '.img_picto($langs->trans('CheckRejected'),'statut8').''; } print ''; print ''; - + $i++; } } @@ -751,7 +751,7 @@ else print $langs->trans("None"); print ''; } - + print "
    '.$i.''.dol_print_date($db->jdate($objp->date),'day').'
    "; print "
    "; } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 3e2b43b7f34..d08b6c734cc 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -172,12 +172,12 @@ if ($resql) print "
    '; print ''; - print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="right"'); + print_liste_field_titre("Lines",$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd); + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$urladd); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="right"'); print_liste_field_titre(''); print "\n"; @@ -354,7 +354,7 @@ if ($id > 0) print ''; $total += $obj->amount; - + $i++; } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index dd453bd7f4e..04ec746d7f6 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -106,14 +106,14 @@ if ($resql) } print ''; - + print '
    '; print ''; - print_liste_field_titre($langs->trans("Bill"), $_SERVER["PHP_SELF"]); - print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"]); - print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "", "", $param, 'align="right"'); - print_liste_field_titre($langs->trans("DateRequest"), $_SERVER["PHP_SELF"], "", "", $param, 'align="center"'); + print_liste_field_titre("Bill", $_SERVER["PHP_SELF"]); + print_liste_field_titre("Company", $_SERVER["PHP_SELF"]); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"'); + print_liste_field_titre("DateRequest", $_SERVER["PHP_SELF"], "", "", $param, 'align="center"'); print_liste_field_titre(''); print ''; @@ -136,7 +136,7 @@ if ($resql) while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - + print ''; // Ref facture @@ -157,7 +157,7 @@ if ($resql) print ''; print ''; - + print ''; $i++; } diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 996a1aabe88..437af529ad9 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -171,16 +171,16 @@ if ($result) print ''; $massactionbutton=''; - + print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit); - + print"\n\n"; print '
    '.dol_print_date($db->jdate($obj->date_demande),'day').'
    '; print ''; - print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("StatusDebitCredit"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"p.ref",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("StatusDebitCredit",$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -194,12 +194,12 @@ if ($result) $invoicetmp->id = $obj->facid; $invoicetmp->ref = $obj->ref; - + $thirdpartytmp->id = $obj->socid; $thirdpartytmp->name = $obj->name; - + print ''; - + print "\n"; @@ -228,13 +228,13 @@ if ($result) } print ""; - + print ""; - + print "\n"; $total += $obj->total_ttc; - + $i++; } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 6251a6f6521..245903101cf 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -149,13 +149,13 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"]); - print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref"); - print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom"); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"'); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'align="center"'); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","","",'align="right"'); + print_liste_field_titre("Line",$_SERVER["PHP_SELF"]); + print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref"); + print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom"); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"'); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'align="center"'); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"pl.amount","","",'align="right"'); print_liste_field_titre(''); print "\n"; diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 0f737a50f22..3c18207f451 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -89,9 +89,9 @@ if ($result) print"\n\n"; print '
    "; print $invoicetmp->getNomUrl(1); print "
    '; print ''; - print_liste_field_titre($langs->trans("Line"),$_SERVER["PHP_SELF"],"p.ref",'',$urladd); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd); - print_liste_field_titre($langs->trans("Reason"),$_SERVER["PHP_SELF"],"pr.motif","",$urladd); + print_liste_field_titre("Line",$_SERVER["PHP_SELF"],"p.ref",'',$urladd); + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",'',$urladd); + print_liste_field_titre("Reason",$_SERVER["PHP_SELF"],"pr.motif","",$urladd); print "\n"; $total = 0; @@ -110,7 +110,7 @@ if ($result) print ''; print "\n"; - + $i++; } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 632efaf5d43..4e14233fbfc 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -177,12 +177,12 @@ if ($date_endyear) $param.='&date_endyear='.$date_startyear; print '
    '.$rej->motifs[$obj->motif].'
    '; print ''; print_liste_field_titre(''); -print_liste_field_titre($langs->trans("Name"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); +print_liste_field_titre("Name", $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); if ($modecompta == 'CREANCES-DETTES') { - print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder); } -print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder); +print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder); print "\n"; /* diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 5aa5d29aa54..9a5c352b739 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -197,13 +197,13 @@ if ($result) print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Employee",$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 50dd4d430ed..8723541efda 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -154,7 +154,7 @@ if ($resql) print ''; print ''; print ''; - + if ($year) { $center=($year?"".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":""); @@ -177,7 +177,7 @@ if ($resql) { print '
    '; print '
    '."\n"; - + print ''; // Ref print '\n"; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"periode","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("DateDue",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"cs.paye","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; - + $i=0; $totalarray=array(); while ($i < min($num,$limit)) @@ -258,7 +258,7 @@ if ($resql) if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->amount; - + // Due date print ''; @@ -285,7 +285,7 @@ if ($resql) print ''; print ''; } - + print '
    '; @@ -209,16 +209,16 @@ if ($resql) print "
    '.dol_print_date($db->jdate($obj->date_ech), 'day').'
    '; print ''; } diff --git a/htdocs/compta/sociales/info.php b/htdocs/compta/sociales/info.php index 91334134a2c..b67c844a7b9 100644 --- a/htdocs/compta/sociales/info.php +++ b/htdocs/compta/sociales/info.php @@ -60,6 +60,8 @@ if ($action == 'setlib' && $user->rights->tax->charges->creer) * View */ +$form = new Form($db); + if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } $title = $langs->trans("SocialContribution") . ' - ' . $langs->trans("Info"); diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index bd4b3efc8b7..0f197b9495b 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -116,14 +116,14 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print ''; - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LabelContrib"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("TypeContrib"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("LabelContrib",$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("TypeContrib",$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $sql = "SELECT c.id, c.libelle as lib,"; @@ -246,12 +246,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $total = 0 ; print '
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) @@ -348,12 +348,12 @@ while($j<$numlt) $total = 0 ; print '
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) @@ -430,12 +430,12 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) $total = 0 ; print '
    '; print ''; - print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; $var=1; while ($i < $num) diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index c3c717df2e0..23b63afeb22 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -190,13 +190,13 @@ if ($result) print "\n"; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateValue"),$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"t.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"t.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DateValue",$_SERVER["PHP_SELF"],"dv","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"t.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index d66e4cc1ebd..03b6a0645f7 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -659,7 +659,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -667,9 +667,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $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.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'],$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder); +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.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'],$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'],$_SERVER["PHP_SELF"],"p.import_key","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c13571dd6cb..ce3915cf2ee 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1482,7 +1482,7 @@ else $sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,"; $sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,"; $sql.= " cd.fk_unit,"; - $sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity"; + $sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; $sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id; @@ -1513,7 +1513,7 @@ else if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) { print ''; - // Libelle + // Label if ($objp->fk_product > 0) { print '\n"; + print '\n"; } // TVA print ''; - 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); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("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); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); // Add to agenda if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 202a598d8ae..71912714b90 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011-2015 Juanjo Menent + * Copyright (C) 2017 Ferran Marcet * * 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 @@ -419,7 +420,7 @@ function dol_get_next_week($day, $week, $month, $year) { $tmparray = dol_get_first_day_week($day, $month, $year); - $time=dol_mktime(12,0,0,$month,$tmparray['first_day'],$year,1,0); + $time=dol_mktime(12,0,0,$tmparray['first_month'],$tmparray['first_day'],$tmparray['first_year'],1,0); $time+=24*60*60*7; $tmparray=dol_getdate($time,true); diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0b8282ad5b6..3fe6d5887f4 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -284,6 +284,90 @@ function dol_dir_list_in_database($path, $filter="", $excludefilter=null, $sortc } +/** + * Complete $filearray with data from database. + * This will call doldir_list_indatabase to complate filearray. + * + * @param array $filearray Array of files get using dol_dir_list + * @param string $relativedir Relative dir from DOL_DATA_ROOT + * @return void + */ +function completeFileArrayWithDatabaseInfo(&$filearray, $relativedir) +{ + global $db, $user; + + $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); + + //var_dump($filearray); + //var_dump($filearrayindatabase); + + // Complete filearray with properties found into $filearrayindatabase + foreach($filearray as $key => $val) + { + $found=0; + // Search if it exists into $filearrayindatabase + foreach($filearrayindatabase as $key2 => $val2) + { + if ($filearrayindatabase[$key2]['name'] == $filearray[$key]['name']) + { + $filearray[$key]['position_name']=($filearrayindatabase[$key2]['position']?$filearrayindatabase[$key2]['position']:'0').'_'.$filearrayindatabase[$key2]['name']; + $filearray[$key]['position']=$filearrayindatabase[$key2]['position']; + $filearray[$key]['cover']=$filearrayindatabase[$key2]['cover']; + $filearray[$key]['acl']=$filearrayindatabase[$key2]['acl']; + $filearray[$key]['rowid']=$filearrayindatabase[$key2]['rowid']; + $filearray[$key]['label']=$filearrayindatabase[$key2]['label']; + $found=1; + break; + } + } + + if (! $found) // This happen in transition toward version 6, or if files were added manually into os dir. + { + $filearray[$key]['position']='999999'; // File not indexed are at end. So if we add a file, it will not replace an existing position + $filearray[$key]['cover']=0; + $filearray[$key]['acl']=''; + + $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $filearray[$key]['fullname']); + if (! preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file + { + dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it"); + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; + $ecmfile=new EcmFiles($db); + + // Add entry into database + $filename = basename($rel_filename); + $rel_dir = dirname($rel_filename); + $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); + $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); + + $ecmfile->filepath = $rel_dir; + $ecmfile->filename = $filename; + $ecmfile->label = md5_file(dol_osencode($filearray[$key]['fullname'])); // $destfile is a full path to file + $ecmfile->fullpath_orig = $filearray[$key]['fullname']; + $ecmfile->gen_or_uploaded = 'unknown'; + $ecmfile->description = ''; // indexed content + $ecmfile->keyword = ''; // keyword content + $result = $ecmfile->create($user); + if ($result < 0) + { + setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } + else + { + $filearray[$key]['rowid']=$result; + } + } + else + { + $filearray[$key]['rowid']=0; // Should not happened + } + } + } + + /*var_dump($filearray);*/ +} + + /** * Fast compare of 2 files identified by their properties ->name, ->date and ->size * @@ -588,7 +672,7 @@ function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1) } /** - * Copy a dir to another dir. + * Copy a dir to another dir. This include recursive subdirectories. * * @param string $srcfile Source file (a directory) * @param string $destfile Destination file (a directory) @@ -630,7 +714,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep $dir_handle=opendir($ossrcfile); while ($file=readdir($dir_handle)) { - if ($file!="." && $file!="..") + if ($file != "." && $file != ".." && ! is_link($ossrcfile."/".$file)) { if (is_dir($ossrcfile."/".$file)) { @@ -679,7 +763,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayrep * Move a file into another name. * Note: * - This function differs from dol_move_uploaded_file, because it can be called in any context. - * - Database of files is updated. + * - Database indexes for files are updated. * - Test on antivirus is done only if param testvirus is provided and an antivirus was set. * * @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory) @@ -742,7 +826,7 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvi // Rename entry into ecm database $rel_filetorenamebefore = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $srcfile); $rel_filetorenameafter = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $destfile); - if (! preg_match('/(\/temp\/|\/thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file + if (! preg_match('/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file { $rel_filetorenamebefore = preg_replace('/^[\\/]/', '', $rel_filetorenamebefore); $rel_filetorenameafter = preg_replace('/^[\\/]/', '', $rel_filetorenameafter); @@ -999,7 +1083,8 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } /** - * Remove a file or several files with a mask + * Remove a file or several files with a mask. + * This delete file physically but also database indexes. * * @param string $file File to delete or mask of files to delete * @param int $disableglob Disable usage of glob like * so function is an exact delete function that will return error if no file found @@ -1154,7 +1239,7 @@ function dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$ if ($item != "." && $item != "..") { - if (is_dir(dol_osencode("$dir/$item"))) + if (is_dir(dol_osencode("$dir/$item")) && ! is_link(dol_osencode("$dir/$item"))) { $count=dol_delete_dir_recursive("$dir/$item", $count, $nophperrors, 0, $countdeleted); } @@ -1239,16 +1324,17 @@ function dol_delete_preview($object) /** * Create a meta file with document file into same directory. - * This should allow "grep" search. - * This feature is enabled only if option MAIN_DOC_CREATE_METAFILE is set. + * This make "grep" search possible. + * This feature to generate the meta file is enabled only if option MAIN_DOC_CREATE_METAFILE is set. * * @param CommonObject $object Object - * @return int 0 if we did nothing, >0 success, <0 error + * @return int 0 if do nothing, >0 if we update meta file too, <0 if KO */ function dol_meta_create($object) { global $conf; + // Create meta file if (empty($conf->global->MAIN_DOC_CREATE_METAFILE)) return 0; // By default, no metafile. // Define parent dir of elements @@ -1266,9 +1352,9 @@ function dol_meta_create($object) { $object->fetch_thirdparty(); - $facref = dol_sanitizeFileName($object->ref); - $dir = $dir . "/" . $facref; - $file = $dir . "/" . $facref . ".meta"; + $objectref = dol_sanitizeFileName($object->ref); + $dir = $dir . "/" . $objectref; + $file = $dir . "/" . $objectref . ".meta"; if (! is_dir($dir)) { @@ -1283,15 +1369,15 @@ function dol_meta_create($object) DATE=\"" . dol_print_date($object->date,'') . "\" NB_ITEMS=\"" . $nblignes . "\" CLIENT=\"" . $client . "\" - TOTAL_HT=\"" . $object->total_ht . "\" - TOTAL_TTC=\"" . $object->total_ttc . "\"\n"; + AMOUNT_WO_TAX=\"" . $object->total_ht . "\" + AMOUNT_INC_TAX=\"" . $object->total_ttc . "\"\n"; for ($i = 0 ; $i < $nblignes ; $i++) { //Pour les articles $meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\" - ITEM_" . $i . "_TOTAL_HT=\"" . $object->lines[$i]->total_ht . "\" - ITEM_" . $i . "_TVA=\"" .$object->lines[$i]->tva_tx . "\" + ITEM_" . $i . "_AMOUNT_WO_TAX=\"" . $object->lines[$i]->total_ht . "\" + ITEM_" . $i . "_VAT=\"" .$object->lines[$i]->tva_tx . "\" ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($object->lines[$i]->desc)) . "\" "; } @@ -1305,6 +1391,10 @@ function dol_meta_create($object) return 1; } + else + { + dol_syslog('FailedToDetectDirInDolMetaCreateFor'.$object->element, LOG_WARNING); + } return 0; } @@ -1343,20 +1433,21 @@ function dol_init_file_process($pathtoscan='', $trackid='') /** - * Get and save an upload file (for example after submitting a new file a mail form). + * Get and save an upload file (for example after submitting a new file a mail form). Database index of file is also updated if donotupdatesession is set. * All information used are in db, conf, langs, user and _FILES. * Note: This function can be used only into a HTML page context. * * @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename) * @param int $allowoverwrite 1=Allow overwrite existing file - * @param int $donotupdatesession 1=Do no edit _SESSION variable + * @param int $donotupdatesession 1=Do no edit _SESSION variable but update database index. 0=Update _SESSION and not database index. * @param string $varfiles _FILES var name * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param string $link Link to add (to add a link instead of a file) * @param string $trackid Track id (used to prefix name of session vars to avoid conflict) + * @param int $generatethumbs 1=Generate also thumbs for uploaded image files * @return int <=0 if KO, >0 if OK */ -function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='') +function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='', $generatethumbs=1) { global $db,$user,$conf,$langs; @@ -1407,16 +1498,19 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; // Generate thumbs. - if (image_format_supported($destfull) == 1) + if ($generatethumbs) { - // Create thumbs - // We can't use $object->addThumbs here because there is no $object known + if (image_format_supported($destfull) == 1) + { + // Create thumbs + // We can't use $object->addThumbs here because there is no $object known - // Used on logon for example - $imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); - // Create mini thumbs for image (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + // Used on logon for example + $imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); + // Create mini thumbs for image (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + } } // Update session @@ -1433,7 +1527,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { $rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dir); - if (! preg_match('/[\\/]temp[\\/]/', $rel_dir)) // If not a tmp dir + if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir { $filename = basename($destfile); $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9ce2d4bb1db..19a97cbf9cf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1345,7 +1345,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (! empty($object->label)) $morehtmlref.='
    '.$object->label.'
    '; } - if ($object->element != 'product' && $object->element != 'bookmark') + if ($object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories') { $morehtmlref.='
    '; $morehtmlref.=$object->getBannerAddress('refaddress',$object); diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index d9d7d0d9730..e6f69da1d93 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -347,7 +347,7 @@ function dolRotateImage($file_path) * @param int $quality Quality of compression (0=worst, 100=best) * @param string $outdir Directory where to store thumb * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format) - * @return string Full path of thumb or '' if it fails + * @return string Full path of thumb or '' if it fails or 'Error...' if it fails */ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0) { diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 1df10e6a9c7..48e31235476 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -31,19 +31,21 @@ * @param string $module Module name * @param string $objectname Name of object * @param string $newmask New mask - * @return int <0 if KO, >0 if OK + * @param string $readdir Directory source (use $destdir when not defined) + * @return int <=0 if KO, >0 if OK */ -function rebuildObjectClass($destdir, $module, $objectname, $newmask) +function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='') { global $db, $langs; if (empty($objectname)) return -1; + if (empty($readdir)) $readdir=$destdir; - $pathoffiletoeditsrc=$destdir.'/class/'.strtolower($objectname).'.class.php'; - $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'; + $pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; + $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); if (! dol_is_file($pathoffiletoeditsrc)) { - //$pathoffiletoeditsrc=DOL_DOCUMENT_ROOT.'/modulebuilder/template/class/myobject.class.php'; + $langs->load("errors"); setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); return -1; } @@ -58,7 +60,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask) else return -1; // Backup old file - dol_copy($pathoffiletoeditsrc, $pathoffiletoeditsrc.'.back', $newmask, 1); + dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1); // Edit class files $contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); @@ -110,6 +112,8 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask) $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass); + dol_mkdir(dirname($pathoffiletoedittarget)); + //file_put_contents($pathoffiletoedittmp, $contentclass); file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass); @chmod($pathoffiletoedittarget, octdec($newmask)); @@ -130,17 +134,31 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask) * @param string $module Module name * @param string $objectname Name of object * @param string $newmask New mask - * @return int <0 if KO, >0 if OK + * @param string $readdir Directory source (use $destdir when not defined) + * @return int <=0 if KO, >0 if OK */ -function rebuildObjectSql($destdir, $module, $objectname, $newmask) +function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='') { global $db, $langs; if (empty($objectname)) return -1; + if (empty($readdir)) $readdir=$destdir; + + $pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; + + // Edit .sql file + $pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($objectname).'.sql'; + $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); + if (! dol_is_file($pathoffiletoeditsrc)) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); + return -1; + } try { - dol_include_once(strtolower($module).'/class/'.strtolower($objectname).'.class.php'); + include_once $pathoffiletoclasssrc; if (class_exists($objectname)) $object=new $objectname($db); else return -1; } @@ -149,11 +167,10 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask) print $e->getMessage(); } - // Edit .sql file - $pathoffiletoeditsrc=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql'); - $pathoffiletoedittarget=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.sql'); + // Backup old file + dol_copy($pathoffiletoedittarget, $pathoffiletoedittarget.'.back', $newmask, 1); - $contentsql = file_get_contents($pathoffiletoeditsrc, 'r'); + $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $i=0; $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n"; @@ -179,10 +196,10 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask) // Edit .key.sql file - $pathoffiletoeditsrc=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'); - $pathoffiletoedittarget=dol_osencode($destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'); + $pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'; + $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); - $contentsql = file_get_contents($pathoffiletoeditsrc, 'r'); + $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $i=0; $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n"; @@ -202,6 +219,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask) $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql); + dol_mkdir(dirname($pathoffiletoedittarget)); + file_put_contents($pathoffiletoedittarget, $contentsql); @chmod($pathoffiletoedittarget, octdec($newmask)); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 19063ae79c2..5b344056efb 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -748,7 +748,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $pdf->MultiCell($tmplength, 3, $outputlangs->convToOutputCharset($content), 0, 'C', 0); $pdf->SetXY($curx, $cury + 1); $curx += $tmplength; - $pdf->SetFont('', 'B', $default_font_size - 4); + $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent); $pdf->MultiCell($tmplength, 3, $outputlangs->transnoentities($val), 0, 'C', 0); if (empty($onlynumber)) { $pdf->line($curx, $cury + 1, $curx, $cury + 7); @@ -794,6 +794,7 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default $pdf->MultiCell(100, 3, $val, 0, 'L', 0); $tmpy=$pdf->getStringHeight(100, $val); $cury+=$tmpy; + $cur+=1; } else if (! $usedetailedbban) $cury+=1; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 7048b8570c6..b01637d7b08 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -52,7 +52,7 @@ function product_prepare_head($object) $head[$h][2] = 'price'; $h++; } - + if (! empty($object->status_buy) || (! empty($conf->margin->enabled) && ! empty($object->status))) // If margin is on and product on sell, we may need the cost price even if product os not on purchase { if ((! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) @@ -102,7 +102,7 @@ function product_prepare_head($object) $prodcomb = new ProductCombination($db); - if ($prodcomb->fetchByFkProductChild($object->id) == -1) + if ($prodcomb->fetchByFkProductChild($object->id) == -1) { $head[$h][0] = DOL_URL_ROOT."/variants/combinations.php?id=".$object->id; $head[$h][1] = $langs->trans('ProductCombinations'); @@ -184,7 +184,7 @@ function productlot_prepare_head($object) global $db, $langs, $conf, $user; $langs->load("products"); $langs->load("productbatch"); - + $h = 0; $head = array(); @@ -208,7 +208,7 @@ function productlot_prepare_head($object) $head[$h][2] = 'info'; $h++; */ - + return $head; } @@ -301,9 +301,9 @@ function show_stats_for_company($product,$socid) global $conf,$langs,$user,$db; $nblines = 0; - - print '
    '; - print ''; + + print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 366413c376f..607b107de2c 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1140,19 +1140,19 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks= print ''; print_liste_field_titre($title.' '.$num.'',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); + print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("OpportunityAmount","","","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("OpportunityStatus","","","","",'align="right"',$sortfield,$sortorder); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { - print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder); - if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre($langs->trans("PlannedWorkload"),"","","","",'align="right"',$sortfield,$sortorder); - if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre($langs->trans("ProgressDeclared"),"","","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Tasks","","","","",'align="right"',$sortfield,$sortorder); + if (! in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload","","","","",'align="right"',$sortfield,$sortorder); + if (! in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared","","","","",'align="right"',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status","","","","",'align="right"',$sortfield,$sortorder); print "\n"; while ($i < $num) diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 248c3bde43e..817fd2be8da 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -166,7 +166,7 @@ function dol_loginfunction($langs,$conf,$mysoc) } $conf_css = $themepath."?lang=".$langs->defaultlang; - // Select templates + // Select templates dir if (! empty($conf->modules_parts['tpl'])) // Using this feature slow down application { $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/')); @@ -205,6 +205,7 @@ function dol_loginfunction($langs,$conf,$mysoc) // Should be an array with differents options in $hookmanager->resArray $parameters=array('entity' => GETPOST('entity','int')); $reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters); // Note that $action and $object may have been modified by some hooks. resArray is filled by hook. + $morelogincontent = $hookmanager->resArray['options']; // TODO Use here a resprints // Login $login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin)); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index fe84d1a15ec..6fbfbec3bf6 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2006-2007 Yannick Warnier * Copyright (C) 2011 Regis Houssin - * Copyright (C) 2012-2016 Juanjo Menent + * Copyright (C) 2012-2017 Juanjo Menent * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2012-2014 Raphaël Doursenaud * Copyright (C) 2015 Marcos García @@ -583,11 +583,11 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire { $oldrowid=$assoc['rowid']; $list[$assoc['rate']]['totalht'] += $assoc['total_ht']; + $list[$assoc['rate']]['vat'] += $assoc['total_vat']; $list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1']; $list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2']; } - $list[$assoc['rate']]['vat'] = $assoc['total_vat']; $list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc']; $list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment'; $list[$assoc['rate']]['datef'][] = $assoc['datef']; diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index a60be612e2d..4396b5a862c 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -27,6 +27,7 @@ * * @param string $content Content string * @return void + * @see dolWebsiteSaveContent */ function dolWebsiteOutput($content) { @@ -87,7 +88,61 @@ function dolWebsiteOutput($content) /** - * Clean an HTML page to report only content, so we can include it into another page + * Convert a page content to have correct links into a new html content. + * Used to ouput the page on the Preview. + * + * @param Website $website Web site object + * @param string $content Content to replace + * @return boolean True if OK + */ +function dolWebsiteReplacementOfLinks($website, $content) +{ + // Replace php code. Note $content may come from database and does not contains body tags. + $content = preg_replace('/<\?php[^\?]+\?>\n*/ims', '...php...', $content); + + // Replace relative link / with dolibarr URL + $content = preg_replace('/(href=")\/\"/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$website->ref.'&pageid='.$website->fk_default_home.'"', $content, -1, $nbrep); + // Replace relative link /xxx.php with dolibarr URL + $content = preg_replace('/(href=")\/?([^\"]*)(\.php\")/', '\1'.DOL_URL_ROOT.'/websites/index.php?website='.$website->ref.'&pageref=\2"', $content, -1, $nbrep); + + $content = preg_replace('/url\((["\']?)medias\//', 'url(\1'.DOL_URL_ROOT.'/viewimage.php?modulepart=medias&file=', $content, -1, $nbrep); + + // ]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/ if (empty($includehtmlcontentopened)) $includehtmlcontentopened=0; $includehtmlcontentopened++; @@ -111,7 +164,18 @@ function dolIncludeHtmlContent($contentfile) print 'ERROR: RECURSIVE CONTENT LEVEL. Depth of recursive call is more than the limit of '.$MAXLEVEL.".\n"; return; } + // file_get_contents is not possible. We must execute code with include + //$content = file_get_contents($fullpathfile); + //print preg_replace(array('/^.*]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/ + + ob_start(); $res = include $fullpathfile; // Include because we want to execute code content + $tmpoutput = ob_get_contents(); + ob_end_clean(); + + print "\n".''."\n"; + print preg_replace(array('/^.*]*>/ims','/<\/body>.*$/ims'), array('', ''), $tmpoutput); + if (! $res) { print 'ERROR: FAILED TO INCLUDE PAGE '.$contentfile.".\n"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7715d09d2b5..38232a73876 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -808,8 +808,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - $newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"),1,$user->rights->fournisseur->facture->lire, 'suppliers_bills_list'); + $newmenu->add("/fourn/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer, '', $mainmenu, 'suppliers_bills_create'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"),1,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"),2,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index a2d9bbe05dc..c6b652e265e 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -178,6 +178,8 @@ class CommActionRapport if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; } } diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 699b186a9d2..9941742d8d7 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -249,6 +249,8 @@ class pdf_ban extends ModeleBankAccountDoc if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 3dc615d9deb..e44ab8cafd8 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -396,6 +396,8 @@ class pdf_sepamandate extends ModeleBankAccountDoc if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index dc8681a85fd..1e539a2019f 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -193,6 +193,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + $outputlangs->charset_output=$sav_charset_output; return 1; // Pas d'erreur } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 9e26b31b0ce..9ff01c9f5b5 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -275,9 +275,9 @@ class doc_generic_order_odt extends ModelePDFCommandes dol_mkdir($conf->commande->dir_temp); - // If BILLING contact defined on invoice, we use it + // If CUSTOMER contact defined on order, we use it $usecontact=false; - $arrayidcontact=$object->getIdContact('external','BILLING'); + $arrayidcontact=$object->getIdContact('external','CUSTOMER'); if (count($arrayidcontact) > 0) { $usecontact=true; @@ -289,7 +289,11 @@ class doc_generic_order_odt extends ModelePDFCommandes { // 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->thirdparty; + else { + $socobject = $object->thirdparty; + // 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 { @@ -356,8 +360,12 @@ class doc_generic_order_odt extends ModelePDFCommandes $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 order 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_objet,$array_other); + $tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other,$array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook @@ -459,6 +467,8 @@ class doc_generic_order_odt extends ModelePDFCommandes $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index a3ae305549d..3a2ad2776c5 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -603,6 +603,8 @@ class pdf_einstein extends ModelePDFCommandes if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index f9dac51389f..eeb267512d4 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -454,6 +454,8 @@ class doc_generic_contract_odt extends ModelePDFContract $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index c06882fa121..646d00afe7b 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -396,6 +396,8 @@ class pdf_strato extends ModelePDFContract if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; } else diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 5e557f95f33..24027375528 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -259,6 +259,8 @@ class html_cerfafr extends ModeleDon if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; } else diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 2693a4f013a..77a5677c003 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -510,6 +510,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 72b9a7e6def..68795126487 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -359,6 +359,8 @@ class pdf_merou extends ModelePdfExpedition if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; } else diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 3f7a73a650c..ae0b95ecc78 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -567,6 +567,8 @@ class pdf_rouget extends ModelePdfExpedition if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // No error } else diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index e4ad7b7db36..6182b5afca3 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -474,6 +474,8 @@ class pdf_standard extends ModeleExpenseReport if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index a8baaab2282..79b848c5773 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -474,6 +474,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 226679d7d00..63c795546fb 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -568,7 +568,7 @@ class pdf_crabe extends ModelePDFFactures if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); - if ($prev_progress > 0) // Compute progress from previous situation + if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) // Compute progress from previous situation { if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; else $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; @@ -701,6 +701,8 @@ class pdf_crabe extends ModelePDFFactures if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // No error } else diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 4d889f84902..f333fcafd79 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -392,6 +392,8 @@ class pdf_soleil extends ModelePDFFicheinter if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; } else diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index 1f8e06eb04d..eeba25962cb 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -566,6 +566,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // pas d'erreur } else diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index c97da24d174..6fd8ecfee70 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -418,6 +418,8 @@ class pdf_standard extends CommonStickerGenerator @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + // Output to http stream if (empty($nooutput)) { diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index cfdd15fcc00..496d054d86c 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -56,9 +56,6 @@ class modAccounting extends DolibarrModules $this->special = 0; $this->picto = 'accounting'; - // Defined if the directory /mymodule/inc/triggers/ contains triggers or not - // $this->triggers = 1; - // Data directories to create when module is enabled $this->dirs = array('/accounting/temp'); diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 041892c35ee..ade0e2c7e75 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -53,7 +53,8 @@ class modAdherent extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Management of members of a foundation or association"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto='user'; @@ -75,119 +76,119 @@ class modAdherent extends DolibarrModules //----------- $this->const = array(); $r=0; - + $this->const[$r][0] = "ADHERENT_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "standard"; $this->const[$r][3] = 'Name of PDF model of member'; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_RESIL"; $this->const[$r][1] = "texte"; $this->const[$r][2] = "Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt"; $this->const[$r][3] = "Mail de résiliation"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_VALID"; $this->const[$r][1] = "texte"; $this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n"; $this->const[$r][3] = "Mail de validation"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_VALID_SUBJECT"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "Votre adhésion a été validée"; $this->const[$r][3] = "Sujet du mail de validation"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_RESIL_SUBJECT"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "Résiliation de votre adhésion"; $this->const[$r][3] = "Sujet du mail de résiliation"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_FROM"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = ""; $this->const[$r][3] = "From des mails"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_COTIS"; $this->const[$r][1] = "texte"; $this->const[$r][2] = "Bonjour %FIRSTNAME%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée"; $this->const[$r][3] = "Mail de validation de cotisation"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAIL_COTIS_SUBJECT"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "Reçu de votre cotisation"; $this->const[$r][3] = "Sujet du mail de validation de cotisation"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_CARD_HEADER_TEXT"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "%YEAR%"; $this->const[$r][3] = "Texte imprimé sur le haut de la carte adhérent"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_CARD_FOOTER_TEXT"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "%COMPANY%"; $this->const[$r][3] = "Texte imprimé sur le bas de la carte adhérent"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_CARD_TEXT"; $this->const[$r][1] = "texte"; $this->const[$r][2] = "%FULLNAME%\r\nID: %ID%\r\n%EMAIL%\r\n%ADDRESS%\r\n%ZIP% %TOWN%\r\n%COUNTRY%"; $this->const[$r][3] = "Text to print on member cards"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_MAILMAN_ADMINPW"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = ""; $this->const[$r][3] = "Mot de passe Admin des liste mailman"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_BANK_ACCOUNT"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = ""; $this->const[$r][3] = "ID du Compte banquaire utilise"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_BANK_CATEGORIE"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = ""; $this->const[$r][3] = "ID de la catégorie bancaire des cotisations"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_ETIQUETTE_TYPE"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "L7163"; $this->const[$r][3] = "Type of address sheets"; $this->const[$r][4] = 0; $r++; - + $this->const[$r][0] = "ADHERENT_ETIQUETTE_TEXT"; $this->const[$r][1] = "texte"; $this->const[$r][2] = "%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%"; $this->const[$r][3] = "Text to print on member address sheets"; $this->const[$r][4] = 0; $r++; - + // Boxes //------- $this->boxes = array(0=>array('file'=>'box_members.php','enabledbydefaulton'=>'Home')); @@ -260,8 +261,8 @@ class modAdherent extends DolibarrModules // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - - + + // Exports //-------- $r=0; @@ -325,8 +326,8 @@ class modAdherent extends DolibarrModules $this->import_regex_array[$r]=array('a.civility'=>'code@'.MAIN_DB_PREFIX.'c_civility','a.fk_adherent_type'=>'rowid@'.MAIN_DB_PREFIX.'adherent_type','a.morphy'=>'(phy|mor)','a.statut'=>'^[0|1]','a.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','a.datefin'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r]=array('a.civility'=>"MR",'a.lastname'=>'Smith','a.firstname'=>'John','a.login'=>'jsmith','a.pass'=>'passofjsmith','a.fk_adherent_type'=>'1','a.morphy'=>'"mor" or "phy"','a.societe'=>'JS company','a.address'=>'21 jump street','a.zip'=>'55000','a.town'=>'New York','a.country'=>'1','a.email'=>'jsmith@example.com','a.birth'=>'1972-10-10','a.statut'=>"0 or 1",'a.note_public'=>"This is a public comment on member",'a.note_private'=>"This is private comment on member",'a.datec'=>dol_print_date($now,'%Y-%m-%d'),'a.datefin'=>dol_print_date(dol_time_plus_duree($now, 1, 'y'),'%Y-%m-%d')); } - - + + /** * Function called when module is enabled. * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. @@ -338,16 +339,16 @@ class modAdherent extends DolibarrModules function init($options='') { global $conf,$langs; - + // Permissions $this->remove($options); - + //ODT template /* $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt'; $dirodt=DOL_DATA_ROOT.'/doctemplates/orders'; $dest=$dirodt.'/template_order.odt'; - + if (file_exists($src) && ! file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -360,12 +361,12 @@ class modAdherent extends DolibarrModules return 0; } }*/ - + $sql = array( "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type='member' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','member',".$conf->entity.")" ); - + return $this->_init($sql,$options); - } + } } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index dc8b16fecc8..a42c3001b44 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -55,7 +55,8 @@ class modAgenda extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking."; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; @@ -105,6 +106,13 @@ class modAgenda extends DolibarrModules //------ $this->boxes = array(0=>array('file'=>'box_actions.php','enabledbydefaulton'=>'Home')); + // Cronjobs + //------------ + $this->cronjobs = array( + 0=>array('label'=>'SendEmailsReminders', 'jobtype'=>'method', 'class'=>'comm/action/class/actioncomm.class.php', 'objectname'=>'ActionComm', 'method'=>'sendEmailsReminder', 'parameters'=>'', 'comment'=>'SendEMailsReminder', 'frequency'=>10, 'unitfrequency'=>60, 'priority'=>10, 'status'=>1, 'test'=>'1'), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) + ); + // Permissions //------------ $this->rights = array(); diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 0bb858fa07a..69df9843630 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -48,7 +48,8 @@ class modBarcode extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des codes barres"; - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 2; $this->picto='barcode'; diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index 3125627c007..f26c5fe525f 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -47,7 +47,8 @@ class modBlockedLog extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable a log on some business events into a non reversible log. This module may be mandatory for some countries."; - $this->version = 'development'; // 'development', 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index 506eb99b540..01a80d0b702 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -42,7 +42,7 @@ class modCollab extends DolibarrModules $this->db = $db; $this->numero = 30000; - + // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "portal"; @@ -50,7 +50,8 @@ class modCollab extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the public collaboration features, like shared pad, shared online sheets, etc..."; - $this->version = 'development'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 7f949501023..55f0f96c546 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -50,7 +50,8 @@ class modCron extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the Dolibarr cron service"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) @@ -94,18 +95,18 @@ class modCron extends DolibarrModules //------ $this->boxes = array(); - // Permissions - $this->rights = array(); // Permission array used by this module - $this->rights_class = 'cron'; - $r=0; - // Cronjobs $this->cronjobs = array( 0=>array('label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>10, 'status'=>1, 'test'=>true), 1=>array('label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>20, 'status'=>0, 'test'=>in_array($db->type, array('mysql','mysqli'))), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24) ); - + + // Permissions + $this->rights = array(); // Permission array used by this module + $this->rights_class = 'cron'; + $r=0; + $this->rights[$r][0] = 23001; $this->rights[$r][1] = 'Read cron jobs'; $this->rights[$r][3] = 0; diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 881dd27e414..08564e241aa 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -49,7 +49,8 @@ class modDon extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des dons"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; // Name of png file (without png) used for this module. @@ -135,12 +136,12 @@ class modDon extends DolibarrModules $this->rights[3][2] = 'd'; $this->rights[3][3] = 0; $this->rights[3][4] = 'supprimer'; - - + + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } diff --git a/htdocs/core/modules/modDynamicPrices.class.php b/htdocs/core/modules/modDynamicPrices.class.php index cb6544f4d29..21aa3644e3e 100644 --- a/htdocs/core/modules/modDynamicPrices.class.php +++ b/htdocs/core/modules/modDynamicPrices.class.php @@ -45,7 +45,8 @@ class modDynamicPrices extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the usage of math expressions for prices"; - $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) @@ -83,6 +84,6 @@ class modDynamicPrices extends DolibarrModules $this->rights = array(); $this->rights_class = 'dynamicprices'; $r=0; - + } } diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index cbaf141809f..571c2b2e28a 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -54,9 +54,6 @@ class modExpenseReport extends DolibarrModules $this->special = 0; $this->picto='trip'; - // Defined if the directory /mymodule/inc/triggers/ contains triggers or not - $this->triggers = 0; - // Data directories to create when module is enabled. $this->dirs = array("/expensereport/temp"); $r=0; @@ -114,56 +111,56 @@ class modExpenseReport extends DolibarrModules $this->rights[$r][3] = 0; $this->rights[$r][4] = 'lire'; $r++; - + $this->rights[$r][0] = 772; $this->rights[$r][1] = 'Create/modify expense reports'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'creer'; $r++; - + $this->rights[$r][0] = 773; $this->rights[$r][1] = 'Delete expense reports'; $this->rights[$r][2] = 'd'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'supprimer'; $r++; - + $this->rights[$r][0] = 775; $this->rights[$r][1] = 'Approve expense reports'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'approve'; $r++; - + $this->rights[$r][0] = 776; $this->rights[$r][1] = 'Pay expense reports'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'to_paid'; $r++; - + $this->rights[$r][0] = 777; $this->rights[$r][1] = 'Read expense reports of everybody'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 1; $this->rights[$r][4] = 'readall'; $r++; - + $this->rights[$r][0] = 778; $this->rights[$r][1] = 'Create expense reports for everybody'; $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'writeall_advance'; $r++; - + $this->rights[$r][0] = 779; $this->rights[$r][1] = 'Export expense reports'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'export'; $r++; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. diff --git a/htdocs/core/modules/modExport.class.php b/htdocs/core/modules/modExport.class.php index cc0090c2fc8..70efc2c165f 100644 --- a/htdocs/core/modules/modExport.class.php +++ b/htdocs/core/modules/modExport.class.php @@ -48,8 +48,8 @@ class modExport extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Outils d'exports de donnees Dolibarr (via un assistant)"; - // Possible values for version are: 'experimental' or 'dolibarr' or version - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto = 'technic'; @@ -90,11 +90,11 @@ class modExport extends DolibarrModules $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'creer'; - - + + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } } diff --git a/htdocs/core/modules/modExternalRss.class.php b/htdocs/core/modules/modExternalRss.class.php index 7ae60e5e9eb..e3f4a538c4d 100644 --- a/htdocs/core/modules/modExternalRss.class.php +++ b/htdocs/core/modules/modExternalRss.class.php @@ -49,7 +49,8 @@ class modExternalRss extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Ajout de files d'informations RSS dans les ecrans Dolibarr"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 1; $this->picto='rss'; diff --git a/htdocs/core/modules/modFckeditor.class.php b/htdocs/core/modules/modFckeditor.class.php index 8752c553a77..54e1eadd735 100644 --- a/htdocs/core/modules/modFckeditor.class.php +++ b/htdocs/core/modules/modFckeditor.class.php @@ -49,7 +49,8 @@ class modFckeditor extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Editeur WYSIWYG"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 2; // Name of png file (without png) used for this module. diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index 9ce003c1a5b..d57800872fd 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -69,9 +69,6 @@ class modHoliday extends DolibarrModules // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' $this->picto='holiday'; - // Defined if the directory /mymodule/inc/triggers/ contains triggers or not - $this->triggers = 0; - // Data directories to create when module is enabled. // Example: this->dirs = array("/mymodule/temp"); $this->dirs = array(); @@ -173,11 +170,11 @@ class modHoliday extends DolibarrModules $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $r++; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + // Exports $r=1; diff --git a/htdocs/core/modules/modImport.class.php b/htdocs/core/modules/modImport.class.php index 2efebb58d80..18696ef4b11 100644 --- a/htdocs/core/modules/modImport.class.php +++ b/htdocs/core/modules/modImport.class.php @@ -48,8 +48,8 @@ class modImport extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Outils d'imports de donnees Dolibarr (via un assistant)"; - // Possible values for version are: 'experimental' or 'dolibarr' or version - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto = 'technic'; @@ -85,11 +85,11 @@ class modImport extends DolibarrModules $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; $this->rights[$r][4] = 'run'; - - + + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } } diff --git a/htdocs/core/modules/modLabel.class.php b/htdocs/core/modules/modLabel.class.php index 05e98d36454..4f7cb8cacbb 100644 --- a/htdocs/core/modules/modLabel.class.php +++ b/htdocs/core/modules/modLabel.class.php @@ -48,7 +48,8 @@ class modLabel extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des etiquettes"; - $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 2; $this->picto='label'; diff --git a/htdocs/core/modules/modLdap.class.php b/htdocs/core/modules/modLdap.class.php index 31f51d5d956..27174a7dda0 100644 --- a/htdocs/core/modules/modLdap.class.php +++ b/htdocs/core/modules/modLdap.class.php @@ -46,7 +46,8 @@ class modLdap extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Synchronisation Ldap"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) $this->special = 1; diff --git a/htdocs/core/modules/modMailing.class.php b/htdocs/core/modules/modMailing.class.php index 45d2685abe4..64966e2105c 100644 --- a/htdocs/core/modules/modMailing.class.php +++ b/htdocs/core/modules/modMailing.class.php @@ -48,7 +48,8 @@ class modMailing extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Gestion des EMailings"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 0; $this->picto='email'; @@ -130,7 +131,7 @@ class modMailing extends DolibarrModules // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } diff --git a/htdocs/core/modules/modMailmanSpip.class.php b/htdocs/core/modules/modMailmanSpip.class.php index 3900c0549b9..209dcba3d2b 100644 --- a/htdocs/core/modules/modMailmanSpip.class.php +++ b/htdocs/core/modules/modMailmanSpip.class.php @@ -48,7 +48,8 @@ class modMailmanSpip extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Mailman or Spip interface for member module"; - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 1; @@ -76,10 +77,10 @@ class modMailmanSpip extends DolibarrModules // Permissions $this->rights = array(); $this->rights_class = 'clicktodial'; - + // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. - + } } diff --git a/htdocs/core/modules/modModuleBuilder.class.php b/htdocs/core/modules/modModuleBuilder.class.php index dabfda48518..944664f2339 100644 --- a/htdocs/core/modules/modModuleBuilder.class.php +++ b/htdocs/core/modules/modModuleBuilder.class.php @@ -47,7 +47,8 @@ class modModuleBuilder extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "A tool to help developers to build their own module."; - $this->version = 'experimental'; // 'development', 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index 72c90ca7a6d..a4a56e1da0d 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -45,7 +45,9 @@ class modNotification extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "EMail notifications (push) on business Dolibarr events"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->descriptionlong = 'Module600Long'; + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 1; $this->picto='email'; diff --git a/htdocs/core/modules/modOauth.class.php b/htdocs/core/modules/modOauth.class.php index 4be01e561fe..4d64c666c60 100644 --- a/htdocs/core/modules/modOauth.class.php +++ b/htdocs/core/modules/modOauth.class.php @@ -52,7 +52,8 @@ class modOauth extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Enable OAuth authentication"; - $this->version = 'dolibarr'; // 'development' or 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version + $this->version = 'dolibarr'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) $this->special = 1; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 2fc7d10fe5a..50c93f07220 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -52,7 +52,8 @@ class modReceiptPrinter extends DolibarrModules $this->name = preg_replace('/^mod/i','',get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "ReceiptPrinterDesc"; - $this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or 'dolibarr_deprecated' or version + $this->version = 'development'; $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) $this->special = 1; diff --git a/htdocs/core/modules/modSkype.class.php b/htdocs/core/modules/modSkype.class.php index ca9179d5fa3..4c7d862cf66 100644 --- a/htdocs/core/modules/modSkype.class.php +++ b/htdocs/core/modules/modSkype.class.php @@ -48,7 +48,8 @@ class modSkype extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable Skype links into contacts"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modSyslog.class.php b/htdocs/core/modules/modSyslog.class.php index fc8ad99abf8..6ef7648531a 100644 --- a/htdocs/core/modules/modSyslog.class.php +++ b/htdocs/core/modules/modSyslog.class.php @@ -52,7 +52,7 @@ class modSyslog extends DolibarrModules // Can be enabled / disabled only in the main company $this->core_enabled = true; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modWebServices.class.php b/htdocs/core/modules/modWebServices.class.php index 59e934500b6..f4383bc6dc5 100644 --- a/htdocs/core/modules/modWebServices.class.php +++ b/htdocs/core/modules/modWebServices.class.php @@ -44,7 +44,8 @@ class modWebServices extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the Dolibarr web services server"; - $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modWebServicesClient.class.php b/htdocs/core/modules/modWebServicesClient.class.php index c5365ba4459..2dd0ee871c5 100644 --- a/htdocs/core/modules/modWebServicesClient.class.php +++ b/htdocs/core/modules/modWebServicesClient.class.php @@ -44,7 +44,8 @@ class modWebServicesClient extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable the web service client to call external supplier web services"; - $this->version = 'experimental'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/modWebsites.class.php b/htdocs/core/modules/modWebsites.class.php index 2c8e2e608a5..d6d984193d9 100644 --- a/htdocs/core/modules/modWebsites.class.php +++ b/htdocs/core/modules/modWebsites.class.php @@ -50,7 +50,8 @@ class modWebsites extends DolibarrModules // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); $this->description = "Enable to build and serve public websites with CMS features"; - $this->version = 'development'; // 'experimental' or 'dolibarr' or version + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version + $this->version = 'experimental'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 6411e97c423..78898735f0c 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -326,8 +326,6 @@ class pdf_standardlabel extends CommonStickerGenerator if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); - - // Output to http stream clearstatcache(); @@ -346,6 +344,8 @@ class pdf_standardlabel extends CommonStickerGenerator readfile($file); + $this->result = array('fullpath'=>$file); + return 1; } } diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 4605b81de5e..faa62d45431 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -367,8 +367,6 @@ class pdf_tcpdflabel extends CommonStickerGenerator if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); - - // Output to http stream clearstatcache(); @@ -387,6 +385,8 @@ class pdf_tcpdflabel extends CommonStickerGenerator readfile($file); + $this->result = array('fullpath'=>$file); + return 1; } } 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 index 811a99d5b2a..c7eed903e8e 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -483,6 +483,8 @@ class doc_generic_product_odt extends ModelePDFProduct $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 29df1127242..62f8624110f 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -542,6 +542,8 @@ class pdf_standard extends ModelePDFProduct if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else 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 e050bf8e3eb..be4f5898f85 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 @@ -1066,6 +1066,8 @@ class doc_generic_project_odt extends ModelePDFProjects $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 334846ab69b..b2ad0f26c0e 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -154,11 +154,11 @@ class pdf_baleine extends ModelePDFProjects $task = new Task($this->db); $tasksarray = $task->getTasksArray(0,0,$object->id); - if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines + if (! $object->id > 0) // Special case when used with object = specimen, we may return all lines { $tasksarray=array_slice($tasksarray, 0, min(5, count($tasksarray))); } - + $object->lines=$tasksarray; $nblignes=count($object->lines); @@ -329,6 +329,8 @@ class pdf_baleine extends ModelePDFProjects if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 2b58cd59c09..8a288c547d5 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -33,16 +33,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; -if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; -if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; -if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture-rec.class.php'; +if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; +if (! empty($conf->ficheinter->enabled)) require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; +if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; +if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -223,7 +224,7 @@ class pdf_beluga extends ModelePDFProjects $iniY = $tab_top + 7; $curY = $tab_top + 7; $nexY = $tab_top + 7; - + $listofreferent=array( 'propal'=>array( 'name'=>"Proposals", @@ -311,7 +312,7 @@ class pdf_beluga extends ModelePDFProjects 'margin'=>'minus', 'disableamount'=>1, 'test'=>$conf->expensereport->enabled && $user->rights->expensereport->lire, - 'lang'=>'trip'), + 'lang'=>'trip'), 'agenda'=>array( 'name'=>"Agenda", 'title'=>"ListActionsAssociatedProject", @@ -322,8 +323,8 @@ class pdf_beluga extends ModelePDFProjects 'test'=>$conf->agenda->enabled && $user->rights->agenda->allactions->read, 'lang'=>'agenda') ); - - + + foreach ($listofreferent as $key => $value) { $title=$value['title']; @@ -333,13 +334,13 @@ class pdf_beluga extends ModelePDFProjects $qualified=$value['test']; $langstoload=$value['lang']; $langs->load($langstoload); - + if ($qualified) { //var_dump("$key, $tablename, $datefieldname, $dates, $datee"); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); //var_dump($elementarray); - + $num = count($elementarray); if ($num >= 0) { @@ -347,7 +348,7 @@ class pdf_beluga extends ModelePDFProjects $curY = $nexY; $pdf->SetXY($this->posxref, $curY); $pdf->MultiCell($this->posxstatut - $this->posxref, 3, $outputlangs->transnoentities($title), 0, 'L'); - + $selectList = $formproject->select_element($tablename, $project->thirdparty->id); $nexY = $pdf->GetY() + 1; $curY = $nexY; @@ -356,7 +357,9 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetXY($this->posxdate, $curY); $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, $outputlangs->transnoentities("Date"), 1, 'C'); $pdf->SetXY($this->posxsociety, $curY); - $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $outputlangs->transnoentities("ThirdParty"), 1, 'L'); + $titlethirdparty=$outputlangs->transnoentities("ThirdParty"); + if ($classname == 'ExpenseReport') $titlethirdparty=$langs->trans("User"); + $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $titlethirdparty, 1, 'L'); if (empty($value['disableamount'])) { $pdf->SetXY($this->posxamountht, $curY); $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, $outputlangs->transnoentities("AmountHTShort"), 1, 'R'); @@ -368,30 +371,39 @@ class pdf_beluga extends ModelePDFProjects } $pdf->SetXY($this->posxstatut, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R'); - + if (is_array($elementarray) && count($elementarray) > 0) { $nexY = $pdf->GetY(); $curY = $nexY; - + $total_ht = 0; $total_ttc = 0; $num = count($elementarray); for ($i = 0; $i < $num; $i ++) { + $idofelement=$elementarray[$i]; + if ($classname == 'ExpenseReport') + { + // We get id of expense report + $expensereportline=new ExpenseReportLine($this->db); + $expensereportline->fetch($idofelement); + $idofelement = $expensereportline->fk_expensereport; + } + $element = new $classname($this->db); - $element->fetch($elementarray[$i]); + $element->fetch($idofelement); $element->fetch_thirdparty(); // print $classname; - + $qualifiedfortotal = true; if ($key == 'invoice') { if ($element->close_code == 'replaced') $qualifiedfortotal = false; // Replacement invoice } - + $pdf->SetXY($this->posxref, $curY); $pdf->MultiCell($this->posxdate - $this->posxref, 3, $element->ref, 1, 'L'); - + // Date if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') $date = $element->date_commande; @@ -404,15 +416,23 @@ class pdf_beluga extends ModelePDFProjects if (empty($date)) $date = $element->datev; // Fiche inter } - + $pdf->SetXY($this->posxdate, $curY); $pdf->MultiCell($this->posxsociety - $this->posxdate, 3, dol_print_date($date, 'day'), 1, 'C'); - + $pdf->SetXY($this->posxsociety, $curY); if (is_object($element->thirdparty)) + { $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $element->thirdparty->name, 1, 'L'); - - // Amount without tax + } + elseif ($classname == 'ExpenseReport') + { + $fuser=new User($this->db); + $fuser->fetch($element->fk_user_author); + $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L'); + } + + // Amount without tax if (empty($value['disableamount'])) { $pdf->SetXY($this->posxamountht, $curY); $pdf->MultiCell($this->posxamountttc - $this->posxamountht, 3, (isset($element->total_ht) ? price($element->total_ht) : ' '), 1, 'R'); @@ -422,7 +442,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetXY($this->posxamountht, $curY); $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R'); } - + // Status if ($element instanceof CommonInvoice) { // This applies for Facture and FactureFournisseur @@ -432,7 +452,7 @@ class pdf_beluga extends ModelePDFProjects } $pdf->SetXY($this->posxstatut, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputstatut, 1, 'R', false, 1, '', '', true, 0, true); - + if ($qualifiedfortotal) { $total_ht = $total_ht + $element->total_ht; $total_ttc = $total_ttc + $element->total_ttc; @@ -440,7 +460,7 @@ class pdf_beluga extends ModelePDFProjects $nexY = $pdf->GetY(); $curY = $nexY; } - + if (empty($value['disableamount'])) { $curY = $nexY; $pdf->SetXY($this->posxref, $curY); @@ -483,6 +503,8 @@ class pdf_beluga extends ModelePDFProjects if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else 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 187018e0031..17e08dd4fd3 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 @@ -829,6 +829,8 @@ class doc_generic_task_odt extends ModelePDFTask $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 130aa90ecfd..372edb5e5de 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -494,6 +494,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 250796dd9d5..602375c62ed 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -451,8 +451,6 @@ class pdf_azur extends ModelePDFPropales // Description of product line $curX = $this->posxdesc-1; - $showpricebeforepagebreak=1; - $pdf->startTransaction(); pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); @@ -761,6 +759,8 @@ class pdf_azur extends ModelePDFPropales if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 406e07b094d..cdf64b59f10 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -276,7 +276,9 @@ class pdf_paiement if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); - + + $this->result = array('fullpath'=>$file); + return 1; } diff --git a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php index f220c51b59d..14eb5db43b4 100644 --- a/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement_fourn.class.php @@ -275,6 +275,8 @@ class pdf_paiement_fourn if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index edee43b274c..539d5df8c2a 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -459,6 +459,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else 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 20f77c68a0e..a90365de47d 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -539,6 +539,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else 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 c882ed89800..8b8a9e3d832 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -110,17 +110,17 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ($conf->global->PRODUCT_USE_UNITS) { - $this->posxtva=99; + $this->posxtva=95; $this->posxup=114; - $this->posxqty=130; + $this->posxqty=132; $this->posxunit=147; } else { - $this->posxtva=112; + $this->posxtva=110; $this->posxup=126; $this->posxqty=145; } - //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxup = $this->posxtva; // posxtva is picture position reference $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { @@ -167,6 +167,44 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $outputlangs->load("products"); $outputlangs->load("orders"); + $nblignes = count($object->lines); + + // Loop on each lines to detect if there is at least one image to show + $realpatharray=array(); + if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE)) + { + for ($i = 0 ; $i < $nblignes ; $i++) + { + if (empty($object->lines[$i]->fk_product)) continue; + + $objphoto = new Product($this->db); + $objphoto->fetch($object->lines[$i]->fk_product); + + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) + { + $pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/"; + $dir = $conf->product->dir_output.'/'.$pdir; + } + else + { + $pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/'; + $dir = $conf->product->dir_output.'/'.$pdir; + } + + $realpath=''; + foreach ($objphoto->liste_photos($dir,1) as $key => $obj) + { + $filename=$obj['photo']; + //if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette']; + $realpath = $dir.$filename; + break; + } + + if ($realpath) $realpatharray[$i]=$realpath; + } + } + if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva; + if ($conf->fournisseur->dir_output.'/commande') { $object->fetch_thirdparty(); @@ -338,16 +376,52 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); + // Define size of image if we need it + $imglinesize=array(); + if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]); + $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(); + $showpricebeforepagebreak=1; + $posYAfterImage=0; + $posYAfterDescription=0; + + // We start with Photo of product line + if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on 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($pageposbefore+1); + + $curY = $tab_top_newpage; + $showpricebeforepagebreak=0; + } + + if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) + { + $curX = $this->posxpicture-1; + $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi + // $pdf->Image does not increase value return by getY, so we save it manually + $posYAfterImage=$curY+$imglinesize['height']; + } // 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,1); + if ($posYAfterImage > 0) + { + $descWidth = $this->posxpicture-$curX; + } + else + { + $descWidth = $this->posxtva-$curX; + } + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc,1); + $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak { @@ -355,7 +429,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $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,1); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc,1); $posyafter=$pdf->GetY(); if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text { @@ -472,6 +546,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0; $this->tva[$vatrate] += $tvaligne; + if ($posYAfterImage > $posYAfterDescription) $nexY=$posYAfterImage; // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) @@ -563,6 +638,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else @@ -924,7 +1001,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); + $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxtva-3, $tab_top+1); @@ -932,7 +1009,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } } - $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); + $pdf->line($this->posxup, $tab_top, $this->posxup, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxup-1, $tab_top+1); diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 6fbfb4b1bf4..2b657dbd962 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -442,6 +442,8 @@ class pdf_standard extends ModelePDFSuppliersPayments if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 212685ba519..4f445501669 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -486,6 +486,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else 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 a7e8952c604..5f3f9550179 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -108,7 +108,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->posxqty=145; $this->posxdiscount=162; $this->postotalht=174; - if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxtva=$this->posxup; + if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) || ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) $this->posxup=$this->posxtva; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images if ($this->page_largeur < 210) // To work with US executive format { @@ -357,7 +357,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posYAfterDescription=0; // We start with Photo of product line - if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page + if (!empty($imglinesize['width']) && !empty($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo too high, we moved completely on new page { $pdf->AddPage('','',true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); @@ -368,7 +368,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $showpricebeforepagebreak=0; } - if (isset($imglinesize['width']) && isset($imglinesize['height'])) + if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) { $curX = $this->posxpicture-1; $pdf->Image($realpatharray[$i], $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi @@ -380,7 +380,15 @@ class pdf_aurore extends ModelePDFSupplierProposal $curX = $this->posxdesc-1; $pdf->startTransaction(); - pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); + if ($posYAfterImage > 0) + { + $descWidth = $this->posxpicture-$curX; + } + else + { + $descWidth = $this->posxtva-$curX; + } + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc,1); $pageposafter=$pdf->getPage(); if ($pageposafter > $pageposbefore) // There is a pagebreak @@ -389,7 +397,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $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->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc); + pdf_writelinedesc($pdf,$object,$i,$outputlangs,$descWidth,3,$curX,$curY,$hideref,$hidedesc); $pageposafter=$pdf->getPage(); $posyafter=$pdf->GetY(); @@ -597,6 +605,8 @@ class pdf_aurore extends ModelePDFSupplierProposal if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); + $this->result = array('fullpath'=>$file); + return 1; // Pas d'erreur } else @@ -1131,20 +1141,10 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); } - if (! empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE)) - { - $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height); - if (empty($hidetop)) - { - //$pdf->SetXY($this->posxpicture-1, $tab_top+1); - //$pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C'); - } - } - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { - //$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); - $pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height); + $pdf->line($this->posxtva, $tab_top, $this->posxtva, $tab_top + $tab_height); + //$pdf->line($this->posxtva-2, $tab_top, $this->posxtva-2, $tab_top + $tab_height); if (empty($hidetop)) { $pdf->SetXY($this->posxtva-5, $tab_top+1); 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 index b7079dde30e..38d9ce62f50 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -408,6 +408,8 @@ class doc_generic_user_odt extends ModelePDFUser $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else 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 index 35367052796..453bde8515f 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -485,6 +485,8 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $odfHandler=null; // Destroy object + $this->result = array('fullpath'=>$file); + return 1; // Success } else diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 62821372e56..ce63a3a0902 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -173,6 +173,9 @@ global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?> +multicompany->enabled) { ?> + +global->MAIN_FEATURES_LEVEL >= 2) { ?> +multicompany->enabled) { ?> + +global->MAIN_FEATURES_LEVEL >= 2) { ?> '; print ''; print ''; if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print ''; +if ($conf->multicompany->enabled) { + print ''; +} print ''; print "\n"; @@ -68,6 +71,9 @@ if (count($extrafields->attribute_type)) print '\n"; print '\n"; if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) print '\n"; // Add hidden option on not working feature. Why hide if user can't see it. + if ($conf->multicompany->enabled) { + print ''; + } print '\n"; print ""; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 9cddb8d183d..35f6f857526 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -17,7 +17,7 @@ */ // Need global variable $title to be defined by caller (like dol_loginfunction) - +// Caller can also set $morelogincontent = array(['options']=>array('js'=>..., 'table'=>...); header('Cache-Control: Public, must-revalidate'); header("Content-type: text/html; charset=".$conf->file->character_set_client); @@ -49,7 +49,7 @@ print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disable ?> -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).'\')"'; ?>> +global->MAIN_LOGIN_BACKGROUND)?'':' style="background-size: cover; background-image: url(\''.DOL_URL_ROOT.'/viewimage.php?cache=1&noalt=1&modulepart=mycompany&file='.urlencode($conf->global->MAIN_LOGIN_BACKGROUND).'\')"'; ?>> dol_use_jmobile)) { ?> + form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, $nameforformuserfile); +} +else print ' '; + +print ''; +// End Add new file area + + print ''; // End top panel, toolbar ?> -
    +
    '; if ($action == 'delete_section') { print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1); - } // End confirm @@ -430,7 +440,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti // Manual section $htmltooltip=$langs->trans("ECMAreaDesc2"); - + if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { print '
    '; @@ -1521,19 +1521,21 @@ else $productstatic->type=$objp->ptype; $productstatic->ref=$objp->pref; $productstatic->entity=$objp->pentity; - $text = $productstatic->getNomUrl(1,'',20); - if ($objp->label) + $productstatic->label=$objp->plabel; + $text = $productstatic->getNomUrl(1,'',20); + if ($objp->plabel) { $text .= ' - '; - $productstatic->ref=$objp->label; - $text .= $productstatic->getNomUrl(0,'',16); + //$productstatic->ref=$objp->label; + //$text .= $productstatic->getNomUrl(0,'',16); + $text .= $objp->plabel; } $description = $objp->description; // Add description in form if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) { - $text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'
    '.dol_htmlentitiesbr($objp->description):''; + $text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'
    '.dol_htmlentitiesbr($objp->description):''; $description = ''; // Already added into main visible desc } @@ -1543,7 +1545,7 @@ else } else { - print '
    '.dol_htmlentitiesbr($objp->description)."'.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."'; @@ -2043,7 +2045,7 @@ else if ($user->rights->contrat->creer) print ''; else print ''; } - if ($object->statut == 1 && $nbofservices) + if ($object->statut == 1) { if ($user->rights->contrat->creer) print ''; else print ''; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 0c3ee14666a..bf31ef4070c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1278,7 +1278,7 @@ class Contrat extends CommonObject //// End call triggers } } - + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) // For avoid conflicts if trigger used { $result=$this->insertExtraFields(); @@ -1831,13 +1831,13 @@ class Contrat extends CommonObject $text.=':     '; } $text.=($mode == 7?'
    ':''); - $text.=($mode != 7 || $this->nbofserviceswait > 0) ? $this->nbofserviceswait.' '.$line->LibStatut(0,3).(($this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; + $text.=($mode != 7 || $this->nbofserviceswait > 0) ? ($this->nbofserviceswait.$line->LibStatut(0,3)).(($mode != 7 || $this->nbofservicesopened || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; $text.=($mode == 7?'
    ':''); - $text.=($mode != 7 || $this->nbofservicesopened > 0) ? $this->nbofservicesopened.' '.$line->LibStatut(4,3,0).(($this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; + $text.=($mode != 7 || $this->nbofservicesopened > 0) ? ($this->nbofservicesopened.$line->LibStatut(4,3,0)).(($mode != 7 || $this->nbofservicesexpired || $this->nbofservicesclosed)?'   ':'') : ''; $text.=($mode == 7?'
    ':''); - $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? $this->nbofservicesexpired.' '.$line->LibStatut(4,3,1).(($this->nbofservicesclosed)?'   ':'') : ''; + $text.=($mode != 7 || $this->nbofservicesexpired > 0) ? ($this->nbofservicesexpired.$line->LibStatut(4,3,1)).(($mode != 7 || $this->nbofservicesclosed)?'   ':'') : ''; $text.=($mode == 7?'
    ':''); - $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? $this->nbofservicesclosed.' '.$line->LibStatut(5,3) : ''; + $text.=($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.$line->LibStatut(5,3)) : ''; $text.=($mode == 7?'
    ':''); return $text; } diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 35cca237b21..95ab0b9ca25 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -39,8 +39,10 @@ $result = restrictedArea($user, 'contrat', $id, ''); /* -* View -*/ + * View + */ + +$form = new Form($db); llxHeader('',$langs->trans("Contract"),""); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index d53bc0a3ee1..e38fa6ceab3 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -544,7 +544,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 6534ef1e362..51061b4b6ad 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -223,7 +223,7 @@ if ($mode == "5") $sql.= " AND cd.statut = 5"; if ($filter == "expired") $sql.= " AND cd.date_fin_validite < '".$db->idate($now)."'"; if ($filter == "notexpired") $sql.= " AND cd.date_fin_validite >= '".$db->idate($now)."'"; if ($search_name) $sql.= " AND s.nom LIKE '%".$db->escape($search_name)."%'"; -if ($search_contract) $sql.= " AND c.rowid = '".$db->escape($search_contract)."'"; +if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract)."%' "; if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; $filter_dateouvertureprevue=dol_mktime(0,0,0,$opouvertureprevuemonth,$opouvertureprevueday,$opouvertureprevueyear); @@ -374,7 +374,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index b34cbe886ab..278a931b437 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -174,7 +174,9 @@ if ($action == 'add') (GETPOST('perms', 'alpha')?GETPOST('perms', 'alpha'):''), (GETPOST('list', 'alpha')?1:0), (GETPOST('ishidden', 'alpha')?1:0), - GETPOST('computed_value','alpha') + GETPOST('computed_value','alpha'), + (GETPOST('entitycurrentorall', 'alpha')?0:'') + ); if ($result > 0) { @@ -335,7 +337,8 @@ if ($action == 'update') (GETPOST('list', 'alpha')?1:0), (GETPOST('ishidden', 'alpha')?1:0), GETPOST('default_value','alpha'), - GETPOST('computed_value','alpha') + GETPOST('computed_value','alpha'), + (GETPOST('entitycurrentorall', 'alpha')?0:'') ); if ($result > 0) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index f4a55352f96..df1c45f66dd 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -91,6 +91,8 @@ if (! $error && $massaction == 'confirm_presend') } //var_dump($listofobjectthirdparties);exit; + + // Loop on each thirdparty foreach ($listofobjectthirdparties as $thirdpartyid) { $result = $thirdparty->fetch($thirdpartyid); @@ -100,62 +102,90 @@ if (! $error && $massaction == 'confirm_presend') exit; } - // Define recipient $sendto and $sendtocc + $sendto=''; + $sendtocc=''; + $sendtobcc=''; + $sendtoid = array(); + + // Define $sendto + $receiver=$_POST['receiver']; + if (! is_array($receiver)) + { + if ($receiver == '-1') $receiver=array(); + else $receiver=array($receiver); + } + $tmparray=array(); if (trim($_POST['sendto'])) { - // Recipient is provided into free text - $sendto = trim($_POST['sendto']); - $sendtoid = 0; + // Recipients are provided into free text + $tmparray[] = trim($_POST['sendto']); } - elseif ($_POST['receiver'] != '-1') + if (count($receiver)>0) { - // Recipient was provided from combo list - if ($_POST['receiver'] == 'thirdparty') // Id of third party - { - $sendto = $thirdparty->email; - $sendtoid = 0; - } - else // Id du contact - { - $sendto = $thirdparty->contact_get_property((int) $_POST['receiver'],'email'); - $sendtoid = $_POST['receiver']; - } + foreach($receiver as $key=>$val) + { + // Recipient was provided from combo list + if ($val == 'thirdparty') // Id of third party + { + $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + } + elseif ($val) // Id du contact + { + $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); + $sendtoid[] = $val; + } + } } + $sendto=implode(',',$tmparray); + + // Define $sendtocc + $receivercc=$_POST['receivercc']; + if (! is_array($receivercc)) + { + if ($receivercc == '-1') $receivercc=array(); + else $receivercc=array($receivercc); + } + $tmparray=array(); if (trim($_POST['sendtocc'])) { - $sendtocc = trim($_POST['sendtocc']); + $tmparray[] = trim($_POST['sendtocc']); } - elseif ($_POST['receivercc'] != '-1') + if (count($receivercc) > 0) { - // Recipient was provided from combo list - if ($_POST['receivercc'] == 'thirdparty') // Id of third party - { - $sendtocc = $thirdparty->email; - } - else // Id du contact - { - $sendtocc = $thirdparty->contact_get_property((int) $_POST['receivercc'],'email'); - } + foreach($receivercc as $key=>$val) + { + // Recipient was provided from combo list + if ($val == 'thirdparty') // Id of third party + { + $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + } + elseif ($val) // Id du contact + { + $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); + //$sendtoid[] = $val; TODO Add also id of contact in CC ? + } + } } + $sendtocc=implode(',',$tmparray); - //var_dump($listofobjectref[$thirdpartyid]); // Array of invoice for this thirdparty - + //var_dump($listofobjectref);exit; $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); $listofqualifiedinvoice=array(); $listofqualifiedref=array(); foreach($listofobjectref[$thirdpartyid] as $objectid => $object) { - //var_dump($object); //var_dump($thirdpartyid.' - '.$objectid.' - '.$object->statut); if ($objectclass == 'Facture' && $object->statut != Facture::STATUS_VALIDATED) { + $langs->load("errors"); $nbignored++; $resaction.='
    '.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$object->ref).'

    '; continue; // Payment done or started or canceled } if ($objectclass == 'Commande' && $object->statut == Commande::STATUS_DRAFT) { + $langs->load("errors"); $nbignored++; $resaction.='
    '.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$object->ref).'

    '; continue; @@ -209,6 +239,7 @@ if (! $error && $massaction == 'confirm_presend') //var_dump($listofqualifiedref); } + // Loop on each qualified invoice of the thirdparty if (count($listofqualifiedinvoice) > 0) { $langs->load("commercial"); @@ -409,26 +440,26 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se $outputlangs->setDefaultLang($newlang); } - if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) { + if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) + { // Create output dir if not exists - dol_mkdir($diroutputmassaction); - - // Defined name of merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/','_',$filename); - - // Save merged file - if ($filter=='paye:0') - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; + dol_mkdir($diroutputmassaction); + + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/','_',$filename); + + // Save merged file + if ($filter=='paye:0') + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; if (count($files)>0) { - $now=dol_now(); $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; @@ -443,14 +474,13 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se if (! empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); } else { setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } - } else { // Create empty PDF @@ -488,18 +518,18 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se // Save merged file if ($filter=='paye:0') { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); } if ($year) $filename.='_'.$year; if ($month) $filename.='_'.$month; if ($pagecount) { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $pdf->Output($file,'F'); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $pdf->Output($file,'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 709d07c0832..203bd71e645 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -32,7 +32,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); - if (! isset($mode) || $mode != 'noajax') // For ajax call { require_once '../../main.inc.php'; @@ -40,11 +39,12 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmdirectory.class.php'; - $action=GETPOST('action','aZ09'); - $file=urldecode(GETPOST('file')); - $section=GETPOST("section"); - $module=GETPOST("module"); - $urlsource=GETPOST("urlsource"); + $action=GETPOST('action','aZ09'); + $file=urldecode(GETPOST('file','alpha')); + $section=GETPOST("section",'alpha'); + $module=GETPOST("module",'alpha'); + $urlsource=GETPOST("urlsource",'alpha'); + $search_doc_ref=GETPOST('search_doc_ref','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -56,7 +56,9 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="name"; - $upload_dir = dirname(str_replace("../","/", $conf->ecm->dir_output.'/'.$file)); + $rootdirfordoc = $conf->ecm->dir_output; + + $upload_dir = dirname(str_replace("../", "/", $rootdirfordoc.'/'.$file)); $ecmdir = new EcmDirectory($db); $result=$ecmdir->fetch($section); @@ -68,7 +70,9 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call } else // For no ajax call { - $ecmdir = new EcmDirectory($db); + $rootdirfordoc = $conf->ecm->dir_output; + + $ecmdir = new EcmDirectory($db); $relativepath=''; if ($section > 0) { @@ -80,7 +84,7 @@ else // For no ajax call } } $relativepath=$ecmdir->getRelativePath(); - $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; + $upload_dir = $rootdirfordoc.'/'.$relativepath; } if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php'; @@ -95,8 +99,7 @@ if ($user->societe_id > 0) $socid = $user->societe_id; //print 'xxx'.$upload_dir; // Security: -// On interdit les remontees de repertoire ainsi que les pipe dans -// les noms de fichiers. +// On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers. if (preg_match('/\.\./',$upload_dir) || preg_match('/[<>|]/',$upload_dir)) { dol_syslog("Refused to deliver file ".$upload_dir); @@ -105,6 +108,16 @@ if (preg_match('/\.\./',$upload_dir) || preg_match('/[<>|]/',$upload_dir)) exit; } +// Check permissions +if ($modulepart == 'ecm') +{ + if (! $user->rights->ecm->read) accessforbidden(); +} +if ($modulepart == 'medias') +{ + // Always allowed +} + /* * Action @@ -153,7 +166,7 @@ if ($type == 'directory') $excludefiles = array('^SPECIMEN\.pdf$','^\.','(\.meta|_preview.*\.png)$','^temp$','^payments$','^CVS$','^thumbs$'); $sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC); - // Right area. If module is defined, we are in automatic ecm. + // Right area. If module is defined here, we are in automatic ecm. $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport'); // TODO change for multicompany sharing @@ -188,35 +201,65 @@ if ($type == 'directory') if (in_array($module, $automodules)) { $param.='&module='.$module; + if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; + $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty. - $filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1); - $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url); + $filter=preg_quote($search_doc_ref, '/'); + $filearray=dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting,1); + + $perm=$user->rights->ecm->upload; + + $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$perm,1,$textifempty,$maxlengthname,$url,1); } // Manual list else { - $relativepath=$ecmdir->getRelativePath(); - $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; + if ($module == 'medias') + { + $relativepath=GETPOST('file','alpha'); + $upload_dir = $dolibarr_main_data_root.'/medias/'.$relativepath; + } + else + { + $relativepath=$ecmdir->getRelativePath(); + $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; + } // If $section defined with value 0 - if ($section === '0') + if (($section === '0' || empty($section)) && ($module != 'medias')) { $filearray=array(); } - else $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview.*\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); + else + { + $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','(\.meta|_preview.*\.png)$','^temp$','^CVS$'),$sortfield, $sorting,1); + } if ($section) { $param.='§ion='.$section; + if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref; + $textifempty = $langs->trans('NoFileFound'); } else if ($section === '0') $textifempty='
    '.$langs->trans("DirNotSynchronizedSyncFirst").'

    '; else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")); - $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url); + if ($module == 'medias') + { + $modulepart='medias'; + $perm=($user->rights->websites->creer || $user->rights->emailing->creer); + } + else + { + $modulepart='ecm'; + $perm=$user->rights->ecm->upload; + } + + $formfile->list_of_documents($filearray,'',$modulepart,$param,1,$relativepath,$perm,1,$textifempty,$maxlengthname,'',$url); } } diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 14b05c75905..c376bee9da3 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -45,13 +45,14 @@ if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/','',$selecteddir); $langs->load("ecm"); -// Define selecteddir (fullpath). +// Define fullpathselecteddir. +$fullpathselecteddir=''; if ($modulepart == 'ecm') $fullpathselecteddir=$conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); +if ($modulepart == 'medias') $fullpathselecteddir=$dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); // Security: -// On interdit les remontees de repertoire ainsi que les pipe dans -// les noms de fichiers. +// On interdit les remontees de repertoire ainsi que les pipe dans les noms de fichiers. if (preg_match('/\.\./',$fullpathselecteddir) || preg_match('/[<>|]/',$fullpathselecteddir)) { dol_syslog("Refused to deliver file ".$original_file); @@ -63,9 +64,12 @@ if (preg_match('/\.\./',$fullpathselecteddir) || preg_match('/[<>|]/',$fullpaths // Check permissions if ($modulepart == 'ecm') { - if (! $user->rights->ecm->read) accessforbidden(); + if (! $user->rights->ecm->read) accessforbidden(); +} +if ($modulepart == 'medias') +{ + // Always allowed } - /* @@ -97,7 +101,8 @@ foreach($sqltree as $keycursor => $val) if (file_exists($fullpathselecteddir)) { $files = @scandir($fullpathselecteddir); - if ($files) + + if ($files) { natcasesort($files); if ( count($files) > 2 ) /* The 2 accounts for . and .. */ diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index 65620c5429c..e5bfb674e8f 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -71,3 +71,27 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ exit; } +if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'donext') +{ + // Increase date + $al = new AccountLine($db); + $al->dateo_next(GETPOST('rowid','int')); + $al->fetch(GETPOST('rowid','int')); + + print ''.dol_print_date($db->jdate($al->dateo),"day").''; + + exit; +} + +if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $action == 'doprev') +{ + // Decrease date + $al =new AccountLine($db); + $al->dateo_previous(GETPOST('rowid','int')); + $al->fetch(GETPOST('rowid','int')); + + print ''.dol_print_date($db->jdate($al->dateo),"day").''; + + exit; +} + diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index ccdcfbdbe5a..1795f7c6f2f 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -27,7 +27,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; /** - * Class to manage the box to show last services lines + * Class to manage the box to show last contracted products/services lines */ class box_services_contracts extends ModeleBoxes { @@ -72,6 +72,8 @@ class box_services_contracts extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; + $form = new Form($db); + $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max)); if ($user->rights->service->lire && $user->rights->contrat->lire) @@ -79,11 +81,12 @@ class box_services_contracts extends ModeleBoxes $contractstatic=new Contrat($db); $contratlignestatic=new ContratLigne($db); $thirdpartytmp = new Societe($db); + $productstatic = new Product($db); $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as contract_status,"; - $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut, cd.label, cd.description, cd.product_type as type,"; - $sql.= " p.rowid as product_id, p.ref as product_ref"; + $sql.= " cd.rowid as cdid, cd.label, cd.description, cd.tms as datem, cd.statut, cd.product_type as type,"; + $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as plabel, p.fk_product_type as ptype, p.entity"; $sql.= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contrat as c ON s.rowid = c.fk_soc"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; @@ -140,8 +143,41 @@ class box_services_contracts extends ModeleBoxes } } + // Label + if ($objp->product_id > 0) + { + $productstatic->id=$objp->product_id; + $productstatic->type=$objp->ptype; + $productstatic->ref=$objp->product_ref; + $productstatic->entity=$objp->pentity; + $productstatic->label=$objp->plabel; + $text = $productstatic->getNomUrl(1,'',20); + if ($objp->plabel) + { + $text .= ' - '; + //$productstatic->ref=$objp->label; + //$text .= $productstatic->getNomUrl(0,'',16); + $text .= $objp->plabel; + } + $description = $objp->description; + + // Add description in form + if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) + { + //$text .= (! empty($objp->description) && $objp->description!=$objp->plabel)?'
    '.dol_htmlentitiesbr($objp->description):''; + $description = ''; // Already added into main visible desc + } + + $s = $form->textwithtooltip($text,$description,3,'','',$cursorline,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):'')); + } + else + { + $s = img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description); + } + + $this->info_box_contents[$i][] = array('td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', - 'text' => $contratlignestatic->getNomUrl(1), + 'text' => $s, 'asis' => 1 ); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1961cbb7af6..535200ab95a 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -374,13 +374,12 @@ abstract class CommonDocGenerator $array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs), $array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs), $array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs), - $array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs), + $array_key.'_total_ht'=>price2num($object->total_ht), $array_key.'_total_vat'=>(! empty($object->total_vat)?price2num($object->total_vat):price2num($object->total_tva)), $array_key.'_total_localtax1'=>price2num($object->total_localtax1), $array_key.'_total_localtax2'=>price2num($object->total_localtax2), $array_key.'_total_ttc'=>price2num($object->total_ttc), - $array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()), $array_key.'_multicurrency_code' => price2num($object->multicurrency_code), $array_key.'_multicurrency_tx' => price2num($object->multicurrency_tx), @@ -411,18 +410,29 @@ abstract class CommonDocGenerator $array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT') ); + if (method_exists($object, 'getTotalDiscount')) { + $resarray[$array_key.'_total_discount_ht_locale'] = price($object->getTotalDiscount(), 0, $outputlangs); + $resarray[$array_key.'_total_discount_ht'] = price2num($object->getTotalDiscount()); + } else { + $resarray[$array_key.'_total_discount_ht_locale'] = ''; + $resarray[$array_key.'_total_discount_ht'] = ''; + } + // Add vat by rates - foreach ($object->lines as $line) + if (is_array($object->lines) && count($object->lines)>0) { - // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility - if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; - $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; - $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); - // $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example) - $vatformated=vatrate($line->tva_tx); - if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0; - $resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva; - $resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]); + foreach ($object->lines as $line) + { + // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility + if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; + $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; + $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); + // $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example) + $vatformated=vatrate($line->tva_tx); + if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0; + $resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva; + $resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]); + } } // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 53de8e56eb8..0693b3dd336 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3876,7 +3876,7 @@ abstract class CommonObject * * @param string $modelspath Relative folder where generators are placed * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example. - * @param Translate $outputlangs Language to use + * @param Translate $outputlangs Output language to use * @param int $hidedetails 1 to hide details. 0 by default * @param int $hidedesc 1 to hide product description. 0 by default * @param int $hideref 1 to hide product reference. 0 by default @@ -3885,7 +3885,7 @@ abstract class CommonObject */ protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null) { - global $conf, $langs; + global $conf, $langs, $user; $srctemplatepath=''; @@ -3903,7 +3903,6 @@ abstract class CommonObject $srctemplatepath=$tmp[1]; } - // Search template files $file=''; $classname=''; $filefound=0; $dirmodels=array('/'); @@ -3995,7 +3994,10 @@ abstract class CommonObject $arrayofrecords = array(); // The write_file of templates of adherent class need this $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); } - else $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); + else + { + $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); + } if ($resultwritefile > 0) { @@ -4005,6 +4007,58 @@ abstract class CommonObject require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_delete_preview($this); + // Index file in database + if (! empty($obj->result['fullpath'])) + { + $destfull = $obj->result['fullpath']; + $upload_dir = dirname($destfull); + $destfile = basename($destfull); + $rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dir); + + if (! preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir + { + $filename = basename($destfile); + $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); + $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); + + include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; + $ecmfile=new EcmFiles($this->db); + $result = $ecmfile->fetch(0, '', ($rel_dir?$rel_dir.'/':'').$filename); + if ($result > 0) + { + $ecmfile->label = md5_file(dol_osencode($destfull)); + $ecmfile->fullpath_orig = ''; + $ecmfile->gen_or_uploaded = 'generated'; + $ecmfile->description = ''; // indexed content + $ecmfile->keyword = ''; // keyword content + $result = $ecmfile->update($user); + if ($result < 0) + { + setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } + } + else + { + $ecmfile->filepath = $rel_dir; + $ecmfile->filename = $filename; + $ecmfile->label = md5_file(dol_osencode($destfull)); + $ecmfile->fullpath_orig = ''; + $ecmfile->gen_or_uploaded = 'generated'; + $ecmfile->description = ''; // indexed content + $ecmfile->keyword = ''; // keyword content + $result = $ecmfile->create($user); + if ($result < 0) + { + setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); + } + } + } + } + else + { + dol_syslog('Method ->write_file was called on object '.get_class($obj).' and return a success but the return array ->result["fullpath"] was not set.', LOG_WARNING); + } + // Success in building document. We build meta file. dol_meta_create($this); @@ -4153,7 +4207,7 @@ abstract class CommonObject if (! is_array($optionsArray)) { - // $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page. + // If $extrafields is not a known object, we initialize it. Best practice is to have $extrafields defined into card.php or list.php page. // TODO Use of existing extrafield is not yet ready (must mutualize code that use extrafields in form first) // global $extrafields; //if (! is_object($extrafields)) @@ -4174,7 +4228,7 @@ abstract class CommonObject if ($table_element == 'categorie') $table_element = 'categories'; // For compatibility // Request to get complementary values - if (count($optionsArray) > 0) + if (is_array($optionsArray) && count($optionsArray) > 0) { $sql = "SELECT rowid"; foreach ($optionsArray as $name => $label) @@ -4881,7 +4935,7 @@ abstract class CommonObject else { $queryarray[$field] = (int) price2num($this->{$field}); - if (empty($queryarray[$field])) $queryarray[$field]=0; // May be rest to null later if property 'nullifempty' is on for this field. + if (empty($queryarray[$field])) $queryarray[$field]=0; // May be reset to null later if property 'notnull' is -1 for this field. } } else if($this->isFloat($info)) @@ -4895,7 +4949,7 @@ abstract class CommonObject } if ($info['type'] == 'timestamp' && empty($queryarray[$field])) unset($queryarray[$field]); - if (! empty($info['nullifempty']) && empty($queryarray[$field])) $queryarray[$field] = null; + if (! empty($info['notnull']) && $info['notnull'] == -1 && empty($queryarray[$field])) $queryarray[$field] = null; } return $queryarray; @@ -4985,7 +5039,7 @@ abstract class CommonObject $fieldvalues = $this->set_save_query(); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now); if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id; - unset($fieldvalues['rowid']); // We suppose the field rowid is reserved field for autoincrement field. + unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. $keys=array(); $values = array(); @@ -5002,7 +5056,7 @@ abstract class CommonObject $sql.= ' ('.implode( ", ", $keys ).')'; $sql.= ' VALUES ('.implode( ", ", $values ).')'; - $res = $this->db->query( $sql ); + $res = $this->db->query($sql); if ($res===false) { $error++; $this->errors[] = $this->db->lasterror(); @@ -5030,57 +5084,6 @@ abstract class CommonObject } } - /** - * Load an object from its id and create a new one in database - * - * @param User $user User that creates - * @param int $fromid Id of object to clone - * @return int New id of clone - */ - public function createFromCloneCommon(User $user, $fromid) - { - global $user, $langs; - - $error = 0; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $object = new self($this->db); - - $this->db->begin(); - - // Load source object - $object->fetchCommon($fromid); - // Reset some properties - unset($object->id); - unset($object->fk_user_creat); - unset($object->import_key); - - // Clear fields - $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... - - // Create clone - $result = $object->createCommon($user); - - // Other options - if ($result < 0) { - $error++; - $this->error = $object->error; - $this->errors = $object->errors; - dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); - } - - // End - if (!$error) { - $this->db->commit(); - return $object->id; - } else { - $this->db->rollback(); - return -1; - } - } /** * Load object in memory from the database diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 77c24ff4109..15a17feaea8 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -579,6 +579,9 @@ class Conf $conf->global->AGENDA_DEFAULT_FILTER_TYPE='0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on. } + $conf->global->MAIN_MODULE_DOLISTORE_API_SRV='https://www.dolistore.com'; + $conf->global->MAIN_MODULE_DOLISTORE_API_KEY='dolistorecatalogpublickey1234567'; + // For backward compatibility if (isset($this->product)) $this->produit=$this->product; if (isset($this->facture)) $this->invoice=$this->facture; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index eaf72ffff71..e67fe9ee224 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -63,7 +63,7 @@ class DolEditor * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') * @param int $readonly 0=Read/Edit, 1=Read only */ - function __construct($htmlname,$content,$width='',$height=200,$toolbarname='Basic',$toolbarlocation='In',$toolbarstartexpanded=false,$uselocalbrowser=true,$okforextendededitor=true,$rows=0,$cols=0,$readonly=0) + function __construct($htmlname, $content, $width='', $height=200, $toolbarname='Basic', $toolbarlocation='In', $toolbarstartexpanded=false, $uselocalbrowser=true, $okforextendededitor=true, $rows=0, $cols=0, $readonly=0) { global $conf,$langs; @@ -282,11 +282,10 @@ class DolEditor $out.= ($this->height?' height: '.$this->height.'px; ':''); //$out.=" min-height: 100px;"; $out.= '">'; - /*$out.= preg_replace(array('/^<\?php/','/\?>$/'), array('<?php','?>'), $this->content); */ - $out.= htmlentities($this->content); + $out.= htmlspecialchars($this->content); $out.= ''; $out.= ''; $out.= '"; + } + + // Zone de saisie manuelle de la date + $retstring.='trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript + $retstring.='>'; + + // Icone calendrier + if (! $disabled) + { + /* Not required. Managed by option buttonImage of jquery + $retstring.=img_object($langs->trans("SelectDate"),'calendarday','id="'.$prefix.'id" class="datecallink"'); + $retstring.="";*/ + } + else + { + $retstring.=''; + } + + $retstring.=''."\n"; + $retstring.=''."\n"; + $retstring.=''."\n"; + } else { - print "Bad value of MAIN_POPUP_CALENDAR"; + $retstring.="Bad value of MAIN_POPUP_CALENDAR"; } } // Show date with combo selects @@ -5892,18 +5943,22 @@ class Form $object->next_prev_filter.=$hookmanager->resPrint; } - //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; - $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); - - $navurl = $_SERVER["PHP_SELF"]; - // Special case for project/task page - if ($paramid == 'project_ref') + $previous_ref = $next_ref = ''; + if ($shownav) { - $navurl = preg_replace('/\/tasks\/(task|contact|time|note|document).php/','/tasks.php',$navurl); - $paramid='ref'; + //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; + $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); + + $navurl = $_SERVER["PHP_SELF"]; + // Special case for project/task page + if ($paramid == 'project_ref') + { + $navurl = preg_replace('/\/tasks\/(task|contact|time|note|document)\.php/','/tasks.php',$navurl); + $paramid='ref'; + } + $previous_ref = $object->ref_previous?'':''; + $next_ref = $object->ref_next?'':''; } - $previous_ref = $object->ref_previous?'':''; - $next_ref = $object->ref_next?'':''; //print "xx".$previous_ref."x".$next_ref; $ret.='
    '; @@ -5957,6 +6012,10 @@ class Form { $ret.=$object->label; } + else if ($object->element == 'ecm_directories') + { + $ret.=''; + } else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); @@ -6327,40 +6386,40 @@ class Form } return $out; } - + /** * Return HTML to show the select categories of expense category - * + * * @param string $selected preselected category * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line * @param array $excludeid id to exclude * @param string $target htmlname of target select to bind event * @param int $default_selected default category to select if fk_c_type_fees change = EX_KME - * @param array $params param to give + * @param array $params param to give * @return string */ function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array()) { global $db,$conf,$langs; - + $sql = 'SELECT rowid, label FROM '.MAIN_DB_PREFIX.'c_exp_tax_cat WHERE active = 1'; $sql.= ' AND entity IN (0,'.getEntity('').')'; if (!empty($excludeid)) $sql.= ' AND rowid NOT IN ('.implode(',', $excludeid).')'; $sql.= ' ORDER BY label'; - + $resql = $db->query($sql); if ($resql) { $out = ''; - + if (!empty($target)) { $sql = "SELECT c.id FROM ".MAIN_DB_PREFIX."c_type_fees as c WHERE c.code = 'EX_KME' AND c.active = 1"; @@ -6376,19 +6435,19 @@ class Form var current_val = $(this).val(); if (current_val == '.$obj->id.') {'; if (!empty($default_selected) || !empty($selected)) $out.= '$("select[name='.$htmlname.']").val("'.($default_selected > 0 ? $default_selected : $selected).'");'; - + $out.= ' $("select[name='.$htmlname.']").change(); } }); $("select[name='.$htmlname.']").change(function() { - + if ($("select[name='.$target.']").val() == '.$obj->id.') { // get price of kilometer to fill the unit price var data = '.json_encode($params).'; data.fk_c_exp_tax_cat = $(this).val(); - + $.ajax({ method: "POST", dataType: "json", @@ -6409,20 +6468,20 @@ class Form }); '; } - } + } } } else { dol_print_error($db); } - + return $out; } - + /** * Return HTML to show the select ranges of expense range - * + * * @param string $selected preselected category * @param string $htmlname name of HTML select list * @param integer $useempty 1=Add empty line @@ -6431,16 +6490,16 @@ class Form function selectExpenseRanges($selected='', $htmlname='fk_range', $useempty=0) { global $db,$conf,$langs; - + $sql = 'SELECT rowid, range_ik FROM '.MAIN_DB_PREFIX.'c_exp_tax_range'; $sql.= ' WHERE entity = '.$conf->entity.' AND active = 1'; - + $resql = $db->query($sql); if ($resql) { $out = ''; if ($useempty) $out.= ''; if ($allchoice) $out.= ''; - + $field = 'code'; if ($useid) $field = 'id'; - + while ($obj = $db->fetch_object($resql)) { $key = $langs->trans($obj->code); @@ -6493,9 +6552,9 @@ class Form { dol_print_error($db); } - + return $out; } - + } diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index a6ec8db928a..7b312ea784a 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -194,11 +194,11 @@ class FormActions print '
    '; print ''; print ''; - print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], '', $page, $param, ''); - print_liste_field_titre($langs->trans('Action'), $_SERVER["PHP_SELF"], '', $page, $param, ''); - print_liste_field_titre($langs->trans('Type'), $_SERVER["PHP_SELF"], '', $page, $param, ''); - print_liste_field_titre($langs->trans('Date'), $_SERVER["PHP_SELF"], '', $page, $param, ''); - print_liste_field_titre($langs->trans('By'), $_SERVER["PHP_SELF"], '', $page, $param, ''); + print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], '', $page, $param, ''); + print_liste_field_titre('Action', $_SERVER["PHP_SELF"], '', $page, $param, ''); + print_liste_field_titre('Type', $_SERVER["PHP_SELF"], '', $page, $param, ''); + print_liste_field_titre('Date', $_SERVER["PHP_SELF"], '', $page, $param, ''); + print_liste_field_titre('By', $_SERVER["PHP_SELF"], '', $page, $param, ''); print_liste_field_titre('', $_SERVER["PHP_SELF"], '', $page, $param, 'align="right"'); print ''; print "\n"; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 040ae1ba96e..9d01a3c70b2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -68,7 +68,7 @@ class FormFile * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). 2 should never be used. * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files - * @param string $htmlname Name and id of HTML form + * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @return int <0 if KO, >0 if OK */ function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile') @@ -212,7 +212,7 @@ class FormFile if (empty($res)) { - print '
    '; + print '
    '; print $out; print '
    '; } @@ -835,9 +835,9 @@ class FormFile $out=''; $this->infofiles=array('nboffiles'=>0,'extensions'=>array(),'files'=>array()); - //if (! empty($conf->dol_use_jmobile)) return ''; + $filterforfilesearch = preg_quote(basename($modulesubdir),'/').'[^\-]+'; - $file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir),'/').'[^\-]+', '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) + $file_list=dol_dir_list($filedir, 'files', 0, $filterforfilesearch, '\.meta$|\.png$'); // Get list of files starting with name of ref (but not followed by "-" to discard uploaded files) // For ajax treatment $out.= ''."\n"; @@ -903,6 +903,7 @@ class FormFile /** * Show list of documents in $filearray (may be they are all in same directory but may not) + * This also sync database if $upload_dir is defined. * * @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this. * @param Object $object Object on which document is linked to. @@ -922,9 +923,10 @@ class FormFile * @param string $sortfield Sort field ('name', 'size', 'position', ...) * @param string $sortorder Sort order ('ASC' or 'DESC') * @param int $disablemove 1=Disable move button, 0=Position move is possible. + * @param int $addfilterfields Add line with filters * @return int <0 if KO, nb of files shown if OK */ - function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1) + function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0) { global $user, $conf, $langs, $hookmanager; global $bc,$bcdd; @@ -1006,10 +1008,22 @@ class FormFile print '
    '; print '
    '."\n"; + if (! empty($addfilterfields)) + { + print ''; + print ''; + print ''; + print ''; + if (empty($useinecm)) print ''; + print ''; + if (! $disablemove) print ''; + print "\n"; + } + print ''; - print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre('Documents2',$url,"name","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre('Size',$url,"size","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('Date',$url,"date","",$param,'align="center"',$sortfield,$sortorder); if (empty($useinecm)) print_liste_field_titre('',$url,"","",$param,'align="center"'); print_liste_field_titre(''); if (! $disablemove) print_liste_field_titre(''); @@ -1018,78 +1032,10 @@ class FormFile // Get list of files stored into database for same relative directory if ($relativedir) { - $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); - - //var_dump($filearray); - //var_dump($filearrayindatabase); - - // Complete filearray with properties found into $filearrayindatabase - foreach($filearray as $key => $val) - { - $found=0; - // Search if it exists into $filearrayindatabase - foreach($filearrayindatabase as $key2 => $val2) - { - if ($filearrayindatabase[$key2]['name'] == $filearray[$key]['name']) - { - $filearray[$key]['position_name']=($filearrayindatabase[$key2]['position']?$filearrayindatabase[$key2]['position']:'0').'_'.$filearrayindatabase[$key2]['name']; - $filearray[$key]['position']=$filearrayindatabase[$key2]['position']; - $filearray[$key]['cover']=$filearrayindatabase[$key2]['cover']; - $filearray[$key]['acl']=$filearrayindatabase[$key2]['acl']; - $filearray[$key]['rowid']=$filearrayindatabase[$key2]['rowid']; - $filearray[$key]['label']=$filearrayindatabase[$key2]['label']; - $found=1; - break; - } - } - - if (! $found) // This happen in transition towerd version 6, or if files were added manually into os dir. - { - $filearray[$key]['position']='999999'; // File not indexed are at end. So if we add a file, it will not replace an existing position - $filearray[$key]['cover']=0; - $filearray[$key]['acl']=''; - - $rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $filearray[$key]['fullname']); - if (! preg_match('/(\/temp\/|\/thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file - { - dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it"); - include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $ecmfile=new EcmFiles($this->db); - - // Add entry into database - $filename = basename($rel_filename); - $rel_dir = dirname($rel_filename); - $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); - $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); - - $ecmfile->filepath = $rel_dir; - $ecmfile->filename = $filename; - $ecmfile->label = md5_file(dol_osencode($filearray[$key]['fullname'])); // $destfile is a full path to file - $ecmfile->fullpath_orig = $filearray[$key]['fullname']; - $ecmfile->gen_or_uploaded = 'unknown'; - $ecmfile->description = ''; // indexed content - $ecmfile->keyword = ''; // keyword content - $result = $ecmfile->create($user); - if ($result < 0) - { - setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings'); - } - else - { - $filearray[$key]['rowid']=$result; - } - } - else - { - $filearray[$key]['rowid']=0; // Should not happened - } - } - } - - /*var_dump($filearray); - var_dump($sortfield); - var_dump($sortorder);*/ + completeFileArrayWithDatabaseInfo($filearray, $relativedir); + /*var_dump($sortfield); + var_dump($sortorder);*/ if ($sortfield && $sortorder) { $filearray=dol_sort_array($filearray, $sortfield, $sortorder); @@ -1291,28 +1237,54 @@ class FormFile * @param int $useinecm Change output for use in ecm module * @param int $textifempty Text to show if filearray is empty * @param int $maxlength Maximum length of file name shown - * @param string $url Full url to use for click links ('' = autodetect) + * @param string $url Full url to use for click links ('' = autodetect) + * @param int $addfilterfields Add line with filters * @return int <0 if KO, nb of files shown if OK */ - function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='') + function list_of_autoecmfiles($upload_dir,$filearray,$modulepart,$param,$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$url='',$addfilterfields=0) { - global $user, $conf, $langs; + global $user, $conf, $langs, $form; global $bc; global $sortfield, $sortorder; + global $search_doc_ref; dol_syslog(get_class($this).'::list_of_autoecmfiles upload_dir='.$upload_dir.' modulepart='.$modulepart); // Show list of documents if (empty($useinecm)) print load_fiche_titre($langs->trans("AttachedFiles")); if (empty($url)) $url=$_SERVER["PHP_SELF"]; + + if (! empty($addfilterfields)) + { + print ''; + print ''; + } + + print '
    '; print '
    '."\n"; + + if (! empty($addfilterfields)) + { + print ''; + print ''; + print ''; + print ''; + print ''; + // Action column + print ''; + print "\n"; + } + print ''; $sortref="fullname"; if ($modulepart == 'invoice_supplier') $sortref='level1name'; - print_liste_field_titre($langs->trans("Ref"),$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Documents2",$url,"name","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Size",$url,"size","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Date",$url,"date","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre('','',''); print ''."\n"; @@ -1404,20 +1376,20 @@ class FormFile $id=0; $ref=''; $label=''; // To show ref or specific information according to view to show (defined by $module) - if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices - if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices + if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } - if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} - if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); } + if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} + if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:'');} if (! $id && ! $ref) continue; $found=0; @@ -1449,20 +1421,23 @@ class FormFile if (! $found > 0 || ! is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) continue; // We do not show orphelins files - print ''."\n"; print ''; print ''; + + // File print ''; @@ -1490,12 +1465,15 @@ class FormFile if (count($filearray) == 0) { - print ''; } print "
    '; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
    '; if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document'); else print $langs->trans("ObjectDeleted",($id?$id:$ref)); - $filename=dol_sanitizeFileName($ref); + //$modulesubdir=dol_sanitizeFileName($ref); + $modulesubdir=dirname($relativefile); + //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref); $filedir=$file['path']; //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; //print $formfile->getDocumentsLink($modulepart, $filename, $filedir); print ''; //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; print ''.dol_print_size($file['size'],1,1).'
    '; + print '
    '; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print '
    "; + print '
    '; + + if (! empty($addfilterfields)) print ''; // Fin de zone } diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php index ef64ac8d8e5..a34754b8d4c 100644 --- a/htdocs/core/class/interfaces.class.php +++ b/htdocs/core/class/interfaces.class.php @@ -120,7 +120,7 @@ class Interfaces if (! $qualified) { - dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG); + //dol_syslog(get_class($this)."::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled", LOG_DEBUG); continue; } @@ -325,8 +325,9 @@ class Interfaces { $module=preg_replace('/^mod/i','',$reg[2]); $constparam='MAIN_MODULE_'.strtoupper($module); - if (strtolower($reg[2]) == 'all') $disabledbymodule=0; + if (strtolower($module) == 'all') $disabledbymodule=0; else if (empty($conf->global->$constparam)) $disabledbymodule=2; + $triggers[$j]['module']=strtolower($module); } // We set info of modules diff --git a/htdocs/core/js/blockUI.js b/htdocs/core/js/blockUI.js index c72ad69580d..6abcc706e25 100644 --- a/htdocs/core/js/blockUI.js +++ b/htdocs/core/js/blockUI.js @@ -23,7 +23,7 @@ // Examples $(document).ready(function() { // override these in your code to change the default behavior and style - $.blockUI.events = { + /*$.blockUI.events = { // styles applied when using $.growlUI dolEventValidCSS: { @@ -59,7 +59,7 @@ $(document).ready(function() { 'border-radius': '10px' } - }; + };*/ $.dolEventValid = function(title, message, timeout, onClose) { var $m = $('
    '); @@ -67,7 +67,7 @@ $(document).ready(function() { if (message) $m.append('

    '+message+'

    '); if (timeout == undefined) timeout = 3000; $.blockUI({ - message: $m, fadeIn: 200, fadeOut: 700, centerY: false, + message: $m, fadeIn: 0, fadeOut: 0, centerY: false, timeout: timeout, showOverlay: false, onUnblock: onClose, css: $.blockUI.events.dolEventValidCSS @@ -80,7 +80,7 @@ $(document).ready(function() { if (message) $m.append('

    '+message+'

    '); if (timeout == undefined) timeout = 0; $.blockUI({ - message: $m, fadeIn: 200, centerY: false, + message: $m, fadeIn: 0, centerY: false, timeout: timeout, showOverlay: false, onUnblock: onClose, css: $.blockUI.events.dolEventErrorCSS @@ -98,7 +98,6 @@ $(document).ready(function() { '-webkit-border-radius': '10px', '-moz-border-radius': '10px', 'border-radius': '10px', - opacity: .5, color: '#fff' } }); diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index 478d66f2c2a..55055792510 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -46,7 +46,7 @@ else header('Cache-Control: no-cache'); ?> /* - * ================================================================= + * ================================================================= * Purpose: * Pour la saisie des dates par calendrier Input: base "/theme/eldy" dateFieldID * "dateo" Nom du champ format "dd/MM/yyyy" Format issu de Dolibarr de @@ -63,7 +63,7 @@ function showDP(base,dateFieldID,format,codelang) showDP.datefieldID=dateFieldID; // Must be after the close var dateField=getObjectFromID(dateFieldID); - + // get positioning var thetop=getTop(dateField)+dateField.offsetHeight; @@ -86,7 +86,7 @@ function showDP(base,dateFieldID,format,codelang) showDP.box.style.position="absolute"; showDP.box.style.top=thetop + "px"; showDP.box.style.left=theleft + "px"; - + if (dateField.value) // Si il y avait valeur initiale dans champ { selDate=getDateFromFormat(dateField.value,format); @@ -129,7 +129,7 @@ function resetDP(base,dateFieldID,format,codelang) var dateField=getObjectFromID(dateFieldID); dateField.value = formatDate(new Date(), format); dpChangeDay(dateFieldID,format); - + var alreadybox=getObjectFromID("DPCancel"); if (alreadybox) showDP(base,dateFieldID,format,codelang); } @@ -147,25 +147,26 @@ function loadMonth(base,month,year,ymd,codelang) } var req=null; - + req=loadXMLDoc(theURL,null,false); if (req.responseText == '') alert('Failed to get URL '.theURL); // alert(theURL+' - '+req.responseText); // L'url doit avoir la meme racine // que la pages et elements sinon pb de securite. - showDP.box.innerHTML=req.responseText; + showDP.box.innerHTML=req.responseText; } function closeDPBox() { document.body.removeChild(showDP.box); displaySelectBoxes(); - showDP.box=null; - showDP.datefieldID=null; + showDP.box=null; + showDP.datefieldID=null; } function dpChangeDay(dateFieldID,format) { showDP.datefieldID=dateFieldID; + console.log("Call dpChangeDay, we save date into detailed fields."); var thefield=getObjectFromID(showDP.datefieldID); var thefieldday=getObjectFromID(showDP.datefieldID+"day"); @@ -200,7 +201,7 @@ function dpClickDay(year,month,day,format) var thefieldmonth=getObjectFromID(showDP.datefieldID+"month"); var thefieldyear=getObjectFromID(showDP.datefieldID+"year"); - var dt = new Date(year, month-1, day); + var dt = new Date(year, month-1, day); thefield.value=formatDate(dt,format); if(thefield.onchange) thefield.onchange.call(thefield); @@ -238,7 +239,7 @@ function getTop(theitem){ offsetTop += offsetTrail.offsetTop; offsetTrail = offsetTrail.offsetParent; } - if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") + if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") offsetTop += document.body.TopMargin; return offsetTop; } @@ -251,7 +252,7 @@ function getLeft(theitem){ offsetLeft += offsetTrail.offsetLeft; offsetTrail = offsetTrail.offsetParent; } - if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") + if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") offsetLeft += document.body.leftMargin; return offsetLeft; } @@ -260,16 +261,16 @@ function getLeft(theitem){ // Create XMLHttpRequest object and load url // Used by calendar or other ajax processes // Return req built or false if error -function loadXMLDoc(url,readyStateFunction,async) +function loadXMLDoc(url,readyStateFunction,async) { // req must be defined by caller with // var req = false; - + // branch for native XMLHttpRequest object (Mozilla, Safari...) if (window.XMLHttpRequest) { req = new XMLHttpRequest(); - + // if (req.overrideMimeType) { // req.overrideMimeType('text/xml'); // } @@ -286,7 +287,7 @@ function loadXMLDoc(url,readyStateFunction,async) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} - } + } } // If XMLHttpRequestObject req is ok, call URL @@ -321,9 +322,9 @@ function loadXMLDoc(url,readyStateFunction,async) */ function hideSelectBoxes() { var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); - if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) - { - for(var i = 0; i < document.all.length; i++) + if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) + { + for(var i = 0; i < document.all.length; i++) { if(document.all[i].tagName) if(document.all[i].tagName == "SELECT") @@ -337,9 +338,9 @@ function hideSelectBoxes() { */ function displaySelectBoxes() { var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); - if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) - { - for(var i = 0; i < document.all.length; i++) + if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE 6") > -1) + { + for(var i = 0; i < document.all.length; i++) { if(document.all[i].tagName) if(document.all[i].tagName == "SELECT") @@ -351,7 +352,7 @@ function displaySelectBoxes() { /* - * ================================================================= + * ================================================================= * Function: * formatDate (javascript object Date(), format) Purpose: Returns a date in the * output format specified. The format string can use the following tags: Field | @@ -366,10 +367,10 @@ function displaySelectBoxes() { function formatDate(date,format) { // alert('formatDate date='+date+' format='+format); - + // Force parametres en chaine format=format+""; - + var result=""; var year=date.getYear()+""; if (year.length < 4) { year=""+(year-0+1900); } @@ -402,7 +403,7 @@ function formatDate(date,format) else if (substr == 'mm') { result=result+(minute<0||minute>9?"":"0")+minute; } else if (substr == 'ss') { result=result+(seconde<0||seconde>9?"":"0")+seconde; } else { result=result+substr; } - + i+=substr.length; } @@ -412,22 +413,22 @@ function formatDate(date,format) /* - * ================================================================= + * ================================================================= * Function: * getDateFromFormat(date_string, format_string) Purpose: This function takes a * date string and a format string. It parses the date string with format and it * returns the date as a javascript Date() object. If date does not match - * format, it returns 0. The format string can use the following tags: + * format, it returns 0. The format string can use the following tags: * Field | Tags * -------------+----------------------------------- - * Year | yyyy (4 digits), yy (2 digits) - * Month | MM (2 digits) - * Day of Month | dd (2 digits) - * Hour (1-12) | hh (2 digits) - * Hour (0-23) | HH (2 digits) - * Minute | mm (2 digits) + * Year | yyyy (4 digits), yy (2 digits) + * Month | MM (2 digits) + * Day of Month | dd (2 digits) + * Hour (1-12) | hh (2 digits) + * Hour (0-23) | HH (2 digits) + * Minute | mm (2 digits) * Second | ss (2 digits) - * Author: Laurent Destailleur + * Author: Laurent Destailleur * Licence: GPL * ================================================================== */ @@ -440,7 +441,7 @@ function getDateFromFormat(val,format) format=format+""; if (val == '') return 0; - + var now=new Date(); var year=now.getYear(); if (year.length < 4) { year=""+(year-0+1900); } var month=now.getMonth()+1; @@ -466,37 +467,37 @@ function getDateFromFormat(val,format) } // alert('substr='+substr); - if (substr == "yyyy") year=getIntegerInString(val,d,4,4); - if (substr == "yy") year=""+(getIntegerInString(val,d,2,2)-0+1900); - if (substr == "MM" ||substr == "M") - { - month=getIntegerInString(val,d,1,2); - d -= 2- month.length; - } - if (substr == "dd") - { - day=getIntegerInString(val,d,1,2); - d -= 2- day.length; - } - if (substr == "HH" ||substr == "hh" ) - { - hour=getIntegerInString(val,d,1,2); - d -= 2- hour.length; - } - if (substr == "mm"){ - minute=getIntegerInString(val,d,1,2); - d -= 2- minute.length; - } - if (substr == "ss") - { - seconde=getIntegerInString(val,d,1,2); - d -= 2- seconde.length; - } - + if (substr == "yyyy") year=getIntegerInString(val,d,4,4); + if (substr == "yy") year=""+(getIntegerInString(val,d,2,2)-0+1900); + if (substr == "MM" ||substr == "M") + { + month=getIntegerInString(val,d,1,2); + d -= 2- month.length; + } + if (substr == "dd") + { + day=getIntegerInString(val,d,1,2); + d -= 2- day.length; + } + if (substr == "HH" ||substr == "hh" ) + { + hour=getIntegerInString(val,d,1,2); + d -= 2- hour.length; + } + if (substr == "mm"){ + minute=getIntegerInString(val,d,1,2); + d -= 2- minute.length; + } + if (substr == "ss") + { + seconde=getIntegerInString(val,d,1,2); + d -= 2- seconde.length; + } + i+=substr.length; d+=substr.length; } - + // Check if format param are ok if (year==null||year<1) { return 0; } if (month==null||(month<1)||(month>12)) { return 0; } @@ -504,15 +505,15 @@ function getDateFromFormat(val,format) if (hour==null||(hour<0)||(hour>24)) { return 0; } if (minute==null||(minute<0)||(minute>60)) { return 0; } if (seconde==null||(seconde<0)||(seconde>60)) { return 0; } - + // alert(year+' '+month+' '+day+' '+hour+' '+minute+' '+seconde); return new Date(year,month-1,day,hour,minute,seconde); } /* - * ================================================================= + * ================================================================= * Function: - * stringIsInteger(string) + * stringIsInteger(string) * Purpose: Return true if string is an integer * ================================================================== */ @@ -530,9 +531,9 @@ function stringIsInteger(str) } /* - * ================================================================= + * ================================================================= * Function: - * getIntegerInString(string,pos,minlength,maxlength) + * getIntegerInString(string,pos,minlength,maxlength) * Purpose: Return part of string from position i that is integer * ================================================================== */ @@ -549,10 +550,10 @@ function getIntegerInString(str,i,minlength,maxlength) /* - * ================================================================= + * ================================================================= * Purpose: - * Clean string to have it url encoded - * Input: s + * Clean string to have it url encoded + * Input: s * Author: Laurent Destailleur * Licence: GPL * ================================================================== @@ -566,11 +567,11 @@ function urlencode(s) { /* - * ================================================================= + * ================================================================= * Purpose: * Applique un delai avant execution. Used for autocompletion of companies. - * Input: funct, delay - * Author: Regis Houssin + * Input: funct, delay + * Author: Regis Houssin * Licence: GPL * ================================================================== */ @@ -581,11 +582,11 @@ function urlencode(s) { /* - * ================================================================= + * ================================================================= * Purpose: * Clean values of a "Sortable.serialize". Used by drag and drop. - * Input: expr - * Author: Regis Houssin + * Input: expr + * Author: Regis Houssin * Licence: GPL * ================================================================== */ @@ -599,12 +600,12 @@ function cleanSerialize(expr) { /* - * ================================================================= + * ================================================================= * Purpose: Display a temporary message in input text fields (For showing help message on * input field). * Input: fieldId * Input: message - * Author: Regis Houssin + * Author: Regis Houssin * Licence: GPL * ================================================================== */ @@ -617,11 +618,11 @@ function displayMessage(fieldId,message) { } /* - * ================================================================= + * ================================================================= * Purpose: Hide a temporary message in input text fields (For showing help message on - * input field). - * Input: fiedId - * Input: message + * input field). + * Input: fiedId + * Input: message * Author: Regis Houssin * Licence: GPL * ================================================================== @@ -673,7 +674,7 @@ function setConstant(url, code, input, entity, strict) { $(newvalue).removeClass("butAction"); $(newvalue).addClass("butActionRefused"); } - }); + }); // Show another element } else if (type == "showhide" || type == "show") { $.each(data, function(key, value) { @@ -734,7 +735,7 @@ function delConstant(url, code, input, entity, strict) { $(newvalue).removeClass("butActionRefused"); $(newvalue).addClass("butAction"); } - }); + }); // Hide another element } else if (type == "showhide" || type == "hide") { $.each(data, function(key, value) { @@ -816,13 +817,13 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, } } -/* - * ================================================================= +/* + * ================================================================= * This is to allow to transform all select box into ajax autocomplete box - * with just one line: + * with just one line: * $(function() { $( "#idofmylist" ).combobox(); }); - * Do not use it on large combo boxes - * ================================================================= + * Do not use it on large combo boxes + * ================================================================= */ (function( $ ) { $.widget( "ui.combobox", { @@ -933,11 +934,11 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, /** * Function to output a dialog bog for copy/paste - * + * * @param string text Text to put into copy/paste area * @param string text2 Text to put under the copy/paste area */ -function copyToClipboard(text,text2) +function copyToClipboard(text,text2) { text = text.replace(/
    /g,"\n"); var newElem = '

    '+text2; @@ -951,7 +952,7 @@ function copyToClipboard(text,text2) /** * Show a popup HTML page. Use the "window.open" function. - * + * * @param string url Url * @param string title Title of popup * @return boolean False @@ -982,15 +983,17 @@ function newpopup(url,title) { function document_preview(file, type, title) { var ValidImageTypes = ["image/gif", "image/jpeg", "image/png"]; + var showOriginalSizeButton = false; + console.log("document_preview A click was done. file="+file+", type="+type+", title="+title); - + if ($.inArray(type, ValidImageTypes) < 0) { var width='85%'; var object_width='100%'; var height = $( window ).height()*0.90; var object_height='98%'; - show_preview(); + show_preview('notimage'); } else { var object_width=0; @@ -1004,23 +1007,38 @@ function document_preview(file, type, title) width = $( window ).width()*0.90; if(object_width < width){ + console.log("Object width is small, we set width of popup according to image width."); width = object_width + 30 } height = $( window ).height()*0.85; if(object_height < height){ + console.log("Object height is small, we set height of popup according to image height."); height = object_height + 80 } + else + { + showOriginalSizeButton = true; + } - show_preview(); + show_preview('image'); }; img.src = file; } - function show_preview(){ - /* console.log("file="+file+" type="+type+" width="+width+" height="+height); */ + function show_preview(mode) { + /* console.log("mode="+mode+" file="+file+" type="+type+" width="+width+" height="+height); */ var newElem = ''; + optionsbuttons = {} + if (mode == 'image' && showOriginalSizeButton) + { + optionsbuttons = { + "trans("OriginalSize")); ?>": function() { console.log("Click on original size"); jQuery(".ui-dialog-content.ui-widget-content > object").css({ "max-height": "none" }); }, + "trans("Close")); ?>": function() { $( this ).dialog( "close" ); } + }; + } + $("#dialogforpopup").html(newElem); $("#dialogforpopup").dialog({ closeOnEscape: true, @@ -1028,19 +1046,25 @@ function document_preview(file, type, title) width: width, height: height, modal: true, - title: title + title: title, + buttons: optionsbuttons }); + + if (showOriginalSizeButton) + { + jQuery(".ui-dialog-content.ui-widget-content > object").css({ "max-height": "100%", "width": "auto", "margin-left": "auto", "margin-right": "auto", "display": "block" }); + } } } /* - * Provide a function to get an URL GET parameter in javascript - * + * Provide a function to get an URL GET parameter in javascript + * * @param string name Name of parameter * @param mixed valueifnotfound Value if not found * @return string Value */ -function getParameterByName(name, valueifnotfound) +function getParameterByName(name, valueifnotfound) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), @@ -1098,7 +1122,7 @@ function getParameterByName(name, valueifnotfound) } })(); -// Another solution, easier, to build a javascript rounding function +// Another solution, easier, to build a javascript rounding function function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + decimals) + "e-" + decimals); } @@ -1146,10 +1170,10 @@ function price2numjs(amount) { amount = amount.replace(dec, '.'); //console.log("amount before="+amount+" rouding="+rounding) var res = Math.round10(amount, - rounding); - // Other solution is + // Other solution is // var res = dolroundjs(amount, rounding) console.log("res="+res) return res; } - + diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index b640f4cc81b..ba725d3e226 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -90,7 +90,7 @@ if (! ($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['H if (arr.length > 0) { var audio = null; global->AGENDA_NOTIFICATION_SOUND)) { + if (! empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');'; } ?> diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 04393fa4d29..d2c466287ff 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -146,7 +146,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker $buf = fgets($fp, 4096); // Test if request must be ran only for particular database or version (if yes, we must remove the -- comment) - if (preg_match('/^--\sV(MYSQL|PGSQL|)([0-9\.]+)/i',$buf,$reg)) + if (preg_match('/^--\sV(MYSQL|PGSQL)([^\s]*)/i',$buf,$reg)) { $qualified=1; @@ -159,20 +159,29 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='',$oker // restrict on version if ($qualified) { - - $versionrequest=explode('.',$reg[2]); - //print var_dump($versionrequest); - //print var_dump($versionarray); - if (! count($versionrequest) || ! count($versionarray) || versioncompare($versionrequest,$versionarray) > 0) - { - $qualified=0; - } + if (! empty($reg[2])) + { + if (is_numeric($reg[2])) // This is a version + { + $versionrequest=explode('.',$reg[2]); + //print var_dump($versionrequest); + //print var_dump($versionarray); + if (! count($versionrequest) || ! count($versionarray) || versioncompare($versionrequest,$versionarray) > 0) + { + $qualified=0; + } + } + else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE + { + if (empty($conf->db->dolibarr_main_db_collation) || ($reg[2] != strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)))) $qualified=0; + } + } } if ($qualified) { // Version qualified, delete SQL comments - $buf=preg_replace('/^--\sV(MYSQL|PGSQL|)([0-9\.]+)/i','',$buf); + $buf=preg_replace('/^--\sV(MYSQL|PGSQL)([^\s]*)/i','',$buf); //print "Ligne $i qualifi?e par version: ".$buf.'
    '; } } @@ -523,6 +532,43 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not } + + +/** + * Prepare array with list of tabs + * + * @return array Array of tabs to show + */ +function modules_prepare_head() +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common"; + $head[$h][1] = $langs->trans("AvailableModules"); + $head[$h][2] = 'common'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace"; + $head[$h][1] = $langs->trans("ModulesMarketPlaces"); + $head[$h][2] = 'marketplace'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy"; + $head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther"); + $head[$h][2] = 'deploy'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=develop"; + $head[$h][1] = $langs->trans("ModulesDevelopYourModule"); + $head[$h][2] = 'develop'; + $h++; + + return $head; +} + + /** * Prepare array with list of tabs * @@ -545,10 +591,17 @@ function security_prepare_head() $h++; $head[$h][0] = DOL_URL_ROOT."/admin/security_file.php"; - $head[$h][1] = $langs->trans("Files"); + $head[$h][1] = $langs->trans("Files").' ('.$langs->trans("Upload").')'; $head[$h][2] = 'file'; $h++; + /* + $head[$h][0] = DOL_URL_ROOT."/admin/security_file_download.php"; + $head[$h][1] = $langs->trans("Files").' ('.$langs->trans("Download").')'; + $head[$h][2] = 'filedownload'; + $h++; + */ + $head[$h][0] = DOL_URL_ROOT."/admin/proxy.php"; $head[$h][1] = $langs->trans("ExternalAccess"); $head[$h][2] = 'proxy'; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 5ac0982a3a0..0a4ad9ffcc9 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -412,6 +412,14 @@ function agenda_prepare_head() $head[$h][2] = 'autoactions'; $h++; + if ($conf->global->MAIN_FEATURES_LEVEL > 0) + { + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_reminder.php"; + $head[$h][1] = $langs->trans("Reminders"); + $head[$h][2] = 'reminders'; + $h++; + } + $head[$h][0] = DOL_URL_ROOT."/admin/agenda_xcal.php"; $head[$h][1] = $langs->trans("ExportCal"); $head[$h][2] = 'xcal'; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c0e5e896872..ae4dfe1c2e4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -749,10 +749,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $colspan=9; print '
    '.$langs->trans("Referers").'
    '.$langs->trans("Referers").''.$langs->trans("NbOfThirdParties").''.$langs->trans("NbOfObjectReferers").''.$langs->trans("TotalQuantity").'
    trans("Hidden"); ?>>
    trans("AllEntities"); ?>>
    trans("ByDefaultInList"); ?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 6f049c506a3..5a9a5b43d93 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -143,6 +143,9 @@ $list=$extrafields->attribute_list[$attrname]; if (! empty($conf->global->MAIN_CAN_HIDE_EXTRAFIELDS)) { $ishidden=$extrafields->attribute_hidden[$attrname]; } +if ($conf->multicompany->enabled) { + $entitycurrentorall=$extrafields->attribute_entityid[$attrname]; +} if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_array($param)) { @@ -232,6 +235,9 @@ else global->MAIN_CAN_HIDE_EXTRAFIELDS)) { ?>
    trans("Hidden"); ?>>
    trans("AllEntities"); ?>>
    trans("ByDefaultInList"); ?> diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index a6d7e735735..f989ce448b5 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -49,6 +49,9 @@ print ''.$langs->trans("ComputedFormula").''.$langs->trans("Required").''.$langs->trans("AlwaysEditable").''.$langs->trans("Hidden").''.$langs->trans("Entities").' 
    '.yn($extrafields->attribute_required[$key])."'.yn($extrafields->attribute_alwayseditable[$key])."'.yn($extrafields->attribute_hidden[$key])."'.($extrafields->attribute_entityid[$key]==0?$langs->trans("All"):$extrafields->attribute_entitylabel[$key]).''.img_edit().''; print "  ".img_delete()."
    '; @@ -615,7 +625,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti // End left panel ?> -
    +
    -
    -use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) || ! empty($section)) -{ - if (empty($section) || $section == -1) - { - ?> - - form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48, null, '', 0, '', 0, 'formuserfile'); -} -else print ' '; - - - -// End Add new file area -?> -
    use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { include DOL_DOCUMENT_ROOT.'/ecm/tpl/enablefiletreeajax.tpl.php'; diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index b613d336fc4..3fa2bc1dc7a 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -23,9 +23,6 @@ * \brief Main page for ECM section area */ -if (! defined('REQUIRE_JQUERY_LAYOUT')) define('REQUIRE_JQUERY_LAYOUT','1'); -if (! defined('REQUIRE_JQUERY_BLOCKUI')) define('REQUIRE_JQUERY_BLOCKUI', 1); - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/ecm.lib.php'; @@ -50,10 +47,12 @@ $result = restrictedArea($user, 'ecm', 0); // Get parameters $socid=GETPOST('socid','int'); $action=GETPOST('action','aZ09'); -$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int"); -$module=GETPOST("module"); +$section=GETPOST('section','int')?GETPOST('section','int'):GETPOST('section_id','int'); +$module=GETPOST('module','alpha'); if (! $section) $section=0; -$section_dir=GETPOST('section_dir'); +$section_dir=GETPOST('section_dir','alpha'); + +$search_doc_ref=GETPOST('search_doc_ref','alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -88,57 +87,15 @@ $error=0; * Actions */ -// Upload file -if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC)) +// Purge search criteria +if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { - // Define relativepath and upload_dir - $relativepath=''; - if ($ecmdir->id) $relativepath=$ecmdir->getRelativePath(); - else $relativepath=$section_dir; - $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; - - if (empty($_FILES['userfile']['tmp_name'])) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); - } - - if (! $error) - { - if (dol_mkdir($upload_dir) >= 0) - { - $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),0, 0, $_FILES['userfile']['error']); - if (is_numeric($resupload) && $resupload > 0) - { - $result=$ecmdir->changeNbOfFiles('+'); - } - else - { - $langs->load("errors"); - if ($resupload < 0) // Unknown error - { - setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); - } - else if (preg_match('/ErrorFileIsInfectedWithAVirus/',$resupload)) // Files infected by a virus - { - setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); - } - else // Known error - { - setEventMessages($langs->trans($resupload), null, 'errors'); - } - } - } - else - { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCreateDir",$upload_dir), null, 'errors'); - } - } + $search_doc_ref=''; } + // Add directory if ($action == 'add' && $user->rights->ecm->setup) { @@ -154,7 +111,6 @@ if ($action == 'add' && $user->rights->ecm->setup) } else { - //TODO: Translate setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors'); $action = "create"; } @@ -203,6 +159,8 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes') } // Refresh directory view +// This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized. +// To refresh content of dir with cache, just open the dir in edit mode. if ($action == 'refreshmanual') { $ecmdirtmp = new EcmDirectory($db); @@ -348,8 +306,9 @@ if ($action == 'refreshmanual') //print $_SESSION["dol_screenheight"]; $maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 466)?($_SESSION["dol_screenheight"]-136):660; // Also into index.php file -$morejs=array(); -if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs=array("/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"); +//$morejs=array(); +$morejs=array('includes/jquery/plugins/blockUI/jquery.blockUI.js','core/js/blockUI.js'); // Used by ecm/tpl/enabledfiletreeajax.tpl.pgp +if (empty($conf->global->MAIN_ECM_DISABLE_JS)) $morejs[]="/includes/jquery/plugins/jqueryFileTree/jqueryFileTree.js"; llxHeader($moreheadcss.$moreheadjs,$langs->trans("ECMArea"),'','','','',$morejs,'',0,0); @@ -395,8 +354,10 @@ if ($action == 'delete' && empty($conf->use_javascript_ajax)) $classviewhide='inline-block'; + + $head = ecm_prepare_dasboard_head(''); -dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), 1, ''); +dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), -1, ''); // Start container of all panels @@ -407,11 +368,11 @@ dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans '; +print '
    '; // Toolbar $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'&section='.$section:''))); -print ''; +print ''; print ''; print ''; @@ -497,7 +458,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti } -// End left banner +// End left panel ?>
    @@ -523,7 +484,7 @@ include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php'; // End of page -dol_fiche_end(1); +dol_fiche_end(); if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index bbcbb7090a4..aadf3fdba22 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -24,6 +24,10 @@ '."\n"; print ''."\n"; } - // jQuery blockUI - if (! empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) || defined('REQUIRE_JQUERY_BLOCKUI')) - { - print ''."\n"; - print ''."\n"; - print ''."\n"; - } // Flot if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && ! defined('DISABLE_JQUERY_FLOT')) { @@ -1311,7 +1302,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (! defined('DISABLE_BROWSER_NOTIF')) { $enablebrowsernotif=false; - if (! empty($conf->agenda->enabled) && ! empty($conf->global->AGENDA_NOTIFICATION)) $enablebrowsernotif=true; + if (! empty($conf->agenda->enabled) && ! empty($conf->global->AGENDA_REMINDER_BROWSER)) $enablebrowsernotif=true; if ($conf->browser->layout == 'phone') $enablebrowsernotif=false; if ($enablebrowsernotif) { @@ -1327,7 +1318,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // Add datepicker default options if (! defined('DISABLE_DATE_PICKER')) { - print ''."\n"; + print ''."\n"; } // JS forced by modules (relative url starting with /) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 6c3a246ad0d..9867a3da5ec 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -184,26 +184,26 @@ if ($result) print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1); if ($conf->global->MARGIN_TYPE == "1") - $labelcostprice=$langs->trans('BuyingPrice'); + $labelcostprice='BuyingPrice'; else // value is 'costprice' or 'pmp' - $labelcostprice=$langs->trans('CostPrice'); + $labelcostprice='CostPrice'; $i = 0; print ""; print ''; if ($agentid > 0) - print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'',$sortfield,$sortorder); + print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"s.nom","","&agentid=".$agentid,'',$sortfield,$sortorder); else - print_liste_field_titre($langs->trans("SalesRepresentative"),$_SERVER["PHP_SELF"],"u.lastname","","&agentid=".$agentid,'',$sortfield,$sortorder); + print_liste_field_titre("SalesRepresentative",$_SERVER["PHP_SELF"],"u.lastname","","&agentid=".$agentid,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"],"selling_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Margin",$_SERVER["PHP_SELF"],"marge","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"],"","","&agentid=".$agentid,'align="right"',$sortfield,$sortorder); print "\n"; $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 58fee8c3ea6..5f6f46c4b2b 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -218,9 +218,9 @@ if ($result) { print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); if ($conf->global->MARGIN_TYPE == "1") - $labelcostprice=$langs->trans('BuyingPrice'); + $labelcostprice='BuyingPrice'; else // value is 'costprice' or 'pmp' - $labelcostprice=$langs->trans('CostPrice'); + $labelcostprice='CostPrice'; $moreforfilter=''; @@ -246,12 +246,12 @@ if ($result) { print "\n"; print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "", "", $param, 'width=20%', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("UnitPriceHT"), $_SERVER["PHP_SELF"], "d.subprice", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", $param, 'width=20%', $sortfield, $sortorder); + print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "d.subprice", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"], "d.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $param, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("AmountTTC", $_SERVER["PHP_SELF"], "d.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'',$param,'align="center"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 643fdcb4704..85f13a881ab 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -216,27 +216,27 @@ if ($result) print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1); if ($conf->global->MARGIN_TYPE == "1") - $labelcostprice=$langs->trans('BuyingPrice'); + $labelcostprice='BuyingPrice'; else // value is 'costprice' or 'pmp' - $labelcostprice=$langs->trans('CostPrice'); + $labelcostprice='CostPrice'; $i = 0; print "
    "; print ''; if (! empty($client)) { - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$socid,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$socid,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$socid,'',$sortfield,$sortorder); + print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&socid=".$socid,'align="center"',$sortfield,$sortorder); } else - print_liste_field_titre($langs->trans("Customer"),$_SERVER["PHP_SELF"],"s.nom","","&socid=".$socid,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"s.nom","","&socid=".$socid,'',$sortfield,$sortorder); + print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"],"selling_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&socid=".$socid,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Margin",$_SERVER["PHP_SELF"],"marge","","&socid=".$socid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"],"","","&socid=".$socid,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 77f7e23c84f..9d52b25de36 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -207,9 +207,9 @@ if ($result) //var_dump($conf->global->MARGIN_TYPE); if ($conf->global->MARGIN_TYPE == "1") - $labelcostprice=$langs->trans('BuyingPrice'); + $labelcostprice='BuyingPrice'; else // value is 'costprice' or 'pmp' - $labelcostprice=$langs->trans('CostPrice'); + $labelcostprice='CostPrice'; $moreforfilter=''; @@ -219,20 +219,20 @@ if ($result) print ''; if ($id > 0) { - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$id,'',$sortfield,$sortorder); + print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&id=".$id,'align="center"',$sortfield,$sortorder); } else { - print_liste_field_titre($langs->trans("ProductService"),$_SERVER["PHP_SELF"],"p.ref","","&id=".$id,'',$sortfield,$sortorder); + print_liste_field_titre("ProductService",$_SERVER["PHP_SELF"],"p.ref","","&id=".$id,'',$sortfield,$sortorder); } - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"],"selling_price","","&id=".$id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($labelcostprice,$_SERVER["PHP_SELF"],"buying_price","","&id=".$id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Margin",$_SERVER["PHP_SELF"],"marge","","&id=".$id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"],"","","&id=".$id,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 907e927c5fd..9175736d5db 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -68,7 +68,7 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { $result = $object->fetch($id, $ref); - + $title = $langs->trans('ProductServiceCard'); $helpurl = ''; $shortlabel = dol_trunc($object->label,16); @@ -96,12 +96,12 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'margin', $titre, -1, $picto); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref'); - - + + print '
    '; - + print '
    '; print '
    '; @@ -125,10 +125,10 @@ if ($id > 0 || ! empty($ref)) } print "
    "; - + print '
    '; print '
    '; - + dol_fiche_end(); @@ -167,24 +167,24 @@ if ($id > 0 || ! empty($ref)) print_barre_liste($langs->trans("MarginDetails"),$page,$_SERVER["PHP_SELF"],"&id=$object->id",$sortfield,$sortorder,'',0,0,''); $i = 0; - + print '
    '; print ''; print ''; - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$object->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$object->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SellingPrice"),$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("BuyingPrice"),$_SERVER["PHP_SELF"],"buying_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","&id=".$object->id,'',$sortfield,$sortorder); + print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&id=".$object->id,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("SellingPrice",$_SERVER["PHP_SELF"],"selling_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("BuyingPrice",$_SERVER["PHP_SELF"],"buying_price","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Qty",$_SERVER["PHP_SELF"],"d.qty","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Margin",$_SERVER["PHP_SELF"],"marge","","&id=".$object->id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"],"","","&id=".$object->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&id=".$object->id,'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; @@ -196,7 +196,7 @@ if ($id > 0 || ! empty($ref)) $var=True; while ($i < $num /*&& $i < $conf->liste_limit*/) { $objp = $db->fetch_object($result); - + $marginRate = ($objp->buying_price != 0)?(100 * $objp->marge / $objp->buying_price):'' ; $markRate = ($objp->selling_price != 0)?(100 * $objp->marge / $objp->selling_price):'' ; @@ -229,7 +229,7 @@ if ($id > 0 || ! empty($ref)) } // affichage totaux marges - + $totalMargin = $cumul_vente - $cumul_achat; if ($totalMargin < 0) { diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index d7257a3cb1d..bc8928bdc6e 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -92,14 +92,14 @@ if ($socid > 0) dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"), -1, 'company'); $linkback = ''.$langs->trans("BackToList").''; - + dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
    '; - + print '
    '; print '
    '; - + if ($object->client) { print '
    '; @@ -138,14 +138,14 @@ if ($socid > 0) } print "
    "; - + print '
    '; print '
    '; dol_fiche_end(); - + print '
    '; - + $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; $sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,"; @@ -179,16 +179,16 @@ if ($socid > 0) print ""; print ''; - print_liste_field_titre($langs->trans("Invoice"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$_REQUEST["socid"],'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SoldAmount"),$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PurchasedAmount"),$_SERVER["PHP_SELF"],"buying_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Margin"),$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&socid=".$_REQUEST["socid"],'',$sortfield,$sortorder); + print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder); + print_liste_field_titre("SoldAmount",$_SERVER["PHP_SELF"],"selling_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PurchasedAmount",$_SERVER["PHP_SELF"],"buying_price","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Margin",$_SERVER["PHP_SELF"],"marge","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARGIN_RATES)) - print_liste_field_titre($langs->trans("MarginRate"),$_SERVER["PHP_SELF"],"","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarginRate",$_SERVER["PHP_SELF"],"","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); if (! empty($conf->global->DISPLAY_MARK_RATES)) - print_liste_field_titre($langs->trans("MarkRate"),$_SERVER["PHP_SELF"],"","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre("MarkRate",$_SERVER["PHP_SELF"],"","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","","&socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder); print "\n"; $cumul_achat = 0; @@ -206,7 +206,7 @@ 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):'' ; - + print ''; print ''; print '"; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 06a9b4037d7..0ba9bbaa071 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -13,6 +13,9 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * + * You can also make a direct call the page with parameter like this: + * htdocs/modulebuilder/index.php?module=Inventory@/pathtodolibarr/htdocs/product */ /** @@ -54,6 +57,16 @@ if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessfor // Dir for custom dirs $tmp=explode(',', $dolibarr_main_document_root_alt); $dirins = $tmp[0]; +$dirread = $dirins; +$forceddirread = 0; + +$tmpdir = explode('@', $module); +if (! empty($tmpdir[1])) +{ + $module=$tmpdir[0]; + $dirread=$tmpdir[1]; + $forceddirread=1; +} $FILEFLAG='modulebuilder.txt'; @@ -119,7 +132,6 @@ if ($dirins && $action == 'initmodule' && $modulename) dol_delete_file($destdir.'/img/object_myobject.png'); dol_delete_file($destdir.'/class/myobject.class.php'); dol_delete_file($destdir.'/class/api_myobject.class.php'); - dol_delete_file($destdir.'/class/MyObject.txt'); } // Edit PHP files @@ -202,8 +214,7 @@ if ($dirins && $action == 'initobject' && $module && $objectname) 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', - 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php', - 'class/MyObject.txt'=>'class/'.$objectname.'.txt' + 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' ); foreach($filetogenerate as $srcfile => $destfile) @@ -315,15 +326,25 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) { $objectname = $tabobj; + $srcdir = $dirread.'/'.strtolower($module); $destdir = $dirins.'/'.strtolower($module); + dol_mkdir($destdir); // TODO Complete list of fields with new one // Edit the class file to write properties - rebuildObjectClass($destdir, $module, $objectname, $newmask); + $result=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir); + if ($result <= 0) + { + $error++; + } // Edit sql with new properties - rebuildObjectSql($destdir, $module, $objectname, $newmask); + rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir); + if ($result <= 0) + { + $error++; + } if (! $error) { @@ -395,8 +416,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', - 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php', - 'class/MyObject.txt'=>'class/'.$objectname.'.txt' + 'class/api_myobject.class.php'=>'class/api_'.strtolower($objectname).'.class.php' ); $resultko = 0; @@ -686,9 +706,10 @@ $text=$langs->trans("ModuleBuilder"); print load_fiche_titre($text, '', 'title_setup'); +// Search modules to edit $listofmodules=array(); -$dirsincustom=dol_dir_list($dirins, 'directories'); +$dirsincustom=dol_dir_list($dirread, 'directories'); if (is_array($dirsincustom) && count($dirsincustom) > 0) { foreach ($dirsincustom as $dircustomcursor) { $fullname = $dircustomcursor['fullname']; @@ -701,17 +722,26 @@ if (is_array($dirsincustom) && count($dirsincustom) > 0) { $modulenamewithcase = preg_replace('/\.class\.php$/', '', $modulenamewithcase); } if ($modulenamewithcase) + { $listofmodules[$dircustomcursor['name']] = $modulenamewithcase; - // var_dump($listofmodules); + } + //var_dump($listofmodules); } } } +if ($forceddirread && empty($listofmodules)) +{ + $listofmodules[strtolower($module)] = $module; +} // Show description of content $newdircustom=$dirins; if (empty($newdircustom)) $newdircustom=img_warning(); print $langs->trans("ModuleBuilderDesc", 'https://wiki.dolibarr.org/index.php/Module_development#Create_your_module').'
    '; print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'
    '; +// If dirread was forced to somewhere else, by using URL +// htdocs/modulebuilder/index.php?module=Inventory@/home/ldestailleur/git/dolibarr/htdocs/product +if ($forceddirread) print $langs->trans("DirScanned").' : '.$dirread.'
    '; $message=''; if (! $dirins) @@ -770,9 +800,9 @@ if (! empty($module) && $module != 'initmodule' && $module != 'deletemodule') } else { - $error++; + if (empty($forceddirread)) $error++; $langs->load("errors"); - print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module); + print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
    '; } } @@ -790,7 +820,7 @@ $h++; foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) { - $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase; + $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); $head[$h][1] = $tmpmodulewithcase; $head[$h][2] = $tmpmodulewithcase; $h++; @@ -833,7 +863,7 @@ elseif ($module == 'deletemodule') } elseif (! empty($module)) { - // Tabs for module + // Tabs for module if (! $error) { $head2 = array(); @@ -868,52 +898,52 @@ elseif (! empty($module)) $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); } - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Description"); $head2[$h][2] = 'description'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Specifications"); $head2[$h][2] = 'specifications'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Objects"); $head2[$h][2] = 'objects'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Menus"); $head2[$h][2] = 'menus'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Permissions"); $head2[$h][2] = 'permissions'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Hooks"); $head2[$h][2] = 'hooks'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Triggers"); $head2[$h][2] = 'triggers'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("Widgets"); $head2[$h][2] = 'widgets'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("CronList"); $head2[$h][2] = 'cron'; $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); $head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][2] = 'buildpackage'; $h++; @@ -935,15 +965,15 @@ elseif (! empty($module)) print $langs->trans("ModuleBuilderDesc".$tab).'

    '; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; @@ -951,84 +981,90 @@ elseif (! empty($module)) print_fiche_titre($langs->trans("DescriptorFile")); - print '
    '; - print '
    '; + if (! empty($moduleobj)) + { + print '
    '; + print '
    '; - print '
    '; @@ -232,7 +232,7 @@ if ($socid > 0) } // affichage totaux marges - + $totalMargin = $cumul_vente - $cumul_achat; if ($totalMargin < 0) { @@ -244,7 +244,7 @@ if ($socid > 0) $marginRate = ($cumul_achat != 0)?(100 * $totalMargin / $cumul_achat):''; $markRate = ($cumul_vente != 0)?(100 * $totalMargin / $cumul_vente):''; } - + // Total print '
    '.$langs->trans('TotalMargin')."
    '; - print ''; + print '
    '; - print $langs->trans("Parameter"); - print ''; - print $langs->trans("Value"); - print '
    '; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print '
    '; + print $langs->trans("Parameter"); + print ''; + print $langs->trans("Value"); + print '
    '; - print $langs->trans("Numero"); - print ' ('.$langs->trans("SeeHere").')'; - print ''; - print $moduleobj->numero; - print '
    '; + print $langs->trans("Numero"); + print ' ('.$langs->trans("SeeHere").')'; + print ''; + print $moduleobj->numero; + print '
    '; - print $langs->trans("Name"); - print ''; - print $moduleobj->getName(); - print '
    '; + print $langs->trans("Name"); + print ''; + print $moduleobj->getName(); + print '
    '; - print $langs->trans("Version"); - print ''; - print $moduleobj->getVersion(); - print '
    '; + print $langs->trans("Version"); + print ''; + print $moduleobj->getVersion(); + print '
    '; - print $langs->trans("Family"); - //print "
    'crm','financial','hr','projects','products','ecm','technic','interface','other'"; - print '
    '; - print $moduleobj->family; - print '
    '; + print $langs->trans("Family"); + //print "
    'crm','financial','hr','projects','products','ecm','technic','interface','other'"; + print '
    '; + print $moduleobj->family; + print '
    '; - print $langs->trans("EditorName"); - print ''; - print $moduleobj->editor_name; - print '
    '; + print $langs->trans("EditorName"); + print ''; + print $moduleobj->editor_name; + print '
    '; - print $langs->trans("EditorUrl"); - print ''; - print $moduleobj->editor_url; - print '
    '; + print $langs->trans("EditorUrl"); + print ''; + print $moduleobj->editor_url; + print '
    '; - print $langs->trans("Description"); - print ''; - print $moduleobj->getDesc(); - print '
    '; + print $langs->trans("Description"); + print ''; + print $moduleobj->getDesc(); + print '
    '; + print '
    '; + print '

    '; - print '

    '; + // Readme file + print_fiche_titre($langs->trans("ReadmeFile")); - // Readme file - print_fiche_titre($langs->trans("ReadmeFile")); + print '
    '; + print '
    '; - print '
    '; - print '
    '; + print $moduleobj->getDescLong(); - print $moduleobj->getDescLong(); + print '

    '; - print '

    '; + // ChangeLog + print_fiche_titre($langs->trans("ChangeLog")); - // ChangeLog - print_fiche_titre($langs->trans("ChangeLog")); + print '
    '; + print '
    '; - print '
    '; - print '
    '; + print $moduleobj->getChangeLog(); - print $moduleobj->getChangeLog(); - - print '
    '; + print '
    '; + } + else + { + print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
    '; + } dol_fiche_end(); } @@ -1121,27 +1157,36 @@ elseif (! empty($module)) $h=0; // Dir for module - $dir = $dirins.'/'.$modulelowercase.'/class'; + $dir = $dirread.'/'.$modulelowercase.'/class'; - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.'&tabobj=newobject'; + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; $head3[$h][1] = $langs->trans("NewObject"); $head3[$h][2] = 'newobject'; $h++; - $listofobject = dol_dir_list($dir, 'files', 0, '\.txt$'); + // Scan for object class files + $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); + $firstobjectname=''; foreach($listofobject as $fileobj) { - $objectname = preg_replace('/\.txt$/', '', $fileobj['name']); - if (empty($firstobjectname)) $firstobjectname = $objectname; + if (preg_match('/^api_/',$fileobj['name'])) continue; - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.'&tabobj='.$objectname; + $tmpcontent=file_get_contents($fileobj['fullname']); + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) + { + //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); + $objectname = $reg[1]; + if (empty($firstobjectname)) $firstobjectname = $objectname; + } + + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; $head3[$h][1] = $objectname; $head3[$h][2] = $objectname; $h++; } - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.'&tabobj=deleteobject'; + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; $head3[$h][1] = $langs->trans("DangerZone"); $head3[$h][2] = 'deleteobject'; $h++; @@ -1157,7 +1202,7 @@ elseif (! empty($module)) if ($tabobj == 'newobject') { - // New module + // New object tab print '
    '; print ''; print ''; @@ -1172,7 +1217,7 @@ elseif (! empty($module)) } elseif ($tabobj == 'deleteobject') { - // New module + // Delete object tab print ''; print ''; print ''; @@ -1186,7 +1231,7 @@ elseif (! empty($module)) print '
    '; } else - { + { // tabobj = module if ($action == 'deleteproperty') { $formconfirm = $form->formconfirm( @@ -1211,34 +1256,41 @@ elseif (! empty($module)) $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql'; print '
    '; print ' '.$langs->trans("ClassFile").' : '.$pathtoclass.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("ApiClassFile").' : '.$pathtoapi.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("TestClassFile").' : '.$pathtophpunit.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("SqlFile").' : '.$pathtosql.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("SqlFileExtraFields").' : '.$pathtosqlextra.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("SqlFileKey").' : '.$pathtosqlkey.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '
    '; print ' '.$langs->trans("PageForList").' : '.$pathtolist.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print ' '.$langs->trans("PageForCreateEditView").' : '.$pathtocard.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
    '; print '


    '; - $result = dol_include_once($pathtoclass); + if (empty($forceddirread)) + { + $result = dol_include_once($pathtoclass); + } + else + { + $result = @include_once($dirread.'/'.$pathtoclass); + } if (class_exists($tabobj)) $tmpobjet = new $tabobj($db); $reflector = new ReflectionClass($tabobj); @@ -1252,7 +1304,7 @@ elseif (! empty($module)) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; @@ -1378,7 +1430,14 @@ elseif (! empty($module)) } else { - $fullpathoffile=dol_buildpath($file, 0); + if (empty($forceddirread)) + { + $fullpathoffile=dol_buildpath($file, 0); + } + else + { + $fullpathoffile=$dirread.'/'.$file; + } $content = file_get_contents($fullpathoffile); @@ -1388,7 +1447,7 @@ elseif (! empty($module)) print ''; print ''; print ''; - print ''; + print ''; $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); @@ -1572,11 +1631,11 @@ elseif (! empty($module)) print '
    '; print ''; - print_liste_field_titre($langs->trans("CronLabel"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CronTask"),'','',"",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CronFrequency"),'',"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("StatusAtInstall"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Comment"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); + print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); print "\n"; foreach ($cronjobs as $cron) diff --git a/htdocs/modulebuilder/template/class/MyObject.txt b/htdocs/modulebuilder/template/class/MyObject.txt deleted file mode 100644 index 35eb3529698..00000000000 --- a/htdocs/modulebuilder/template/class/MyObject.txt +++ /dev/null @@ -1,2 +0,0 @@ -# DO NOT DELETE THIS FILE MANUALLY -# If this file exists, it means the class and file for object MyOjbect was generated by ModuleBuilder. So prefer to use ModuleBuilder if you want to delete object. \ No newline at end of file diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index daee7fcc879..d8c35c64a81 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -59,11 +59,15 @@ class MyObject extends CommonObject /** - * 'type' if the field format, 'label' the translation key, 'enabled' is a condition when the filed must be managed, - * 'visible' says if field is visible in list (-1 means not shown by default but can be aded into list to be viewed) - * 'notnull' if not null in database, 'index' if we want an index in database - * 'position' is the sort order of field - * 'searchall' is 1 if we want to search in this field when making a search from the quick search button + * 'type' if the field format. + * 'label' the translation key. + * 'enabled' is a condition when the filed must be managed. + * 'visible' says if field is visible in list (-1 means not shown by default but can be aded into list to be viewed). + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'position' is the sort order of field. + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). * 'comment' is not used. You can store here any text of your choice. */ @@ -73,19 +77,19 @@ class MyObject extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'index'=>true, 'position'=>1, 'comment'=>'Id'), - 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>true, 'index'=>true, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>true, 'index'=>true, 'position'=>20), + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'ref' =>array('type'=>'varchar(64)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'index'=>1, 'position'=>20), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1), 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>0, 'isameasure'=>1), - 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>true, 'position'=>1000), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500), + 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'index'=>1, 'position'=>1000), + 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>500), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>500), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'position'=>500), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValid', 'enabled'=>1, 'visible'=>-1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>true, 'position'=>1000, 'nullifempty'=>1), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>1, 'position'=>1000), ); // END MODULEBUILDER PROPERTIES @@ -142,6 +146,55 @@ class MyObject extends CommonObject return $this->createCommon($user, $notrigger); } + /** + * Clone and object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $hookmanager, $langs; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $object->fetchCommon($fromid); + // Reset some properties + unset($object->id); + unset($object->fk_user_creat); + unset($object->import_key); + + // Clear fields + $object->ref = "copy_of_".$object->ref; + $object->title = $langs->trans("CopyOf")." ".$object->title; + // ... + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + /** * Load object in memory from the database * @@ -151,7 +204,25 @@ class MyObject extends CommonObject */ public function fetch($id, $ref = null) { - return $this->fetchCommon($id, $ref); + $result = $this->fetchCommon($id, $ref); + if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + return $result; + } + + /** + * Load object lines in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetchLines($id, $ref = null) + { + $this->lines=array(); + + // Load lines with object MyObjectLine + + return count($this->lines)?1:0; } /** @@ -365,23 +436,39 @@ class MyObject extends CommonObject $this->initAsSpecimenCommon(); } + + /** + * Action executed by scheduler + * CAN BE A CRON TASK + * + * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) + */ + public function doScheduledJob() + { + global $conf, $langs; + + $this->output = ''; + $this->error=''; + + dol_syslog(__METHOD__, LOG_DEBUG); + + // ... + + return 0; + } } /** - * Class MyModuleObjectLine + * Class MyObjectLine. You can also remove this and generate a CRUD class for lines objects. */ -class MyModuleObjectLine +/* +class MyObjectLine { - /** - * @var int ID - */ + // @var int ID public $id; - /** - * @var mixed Sample line property 1 - */ + // @var mixed Sample line property 1 public $prop1; - /** - * @var mixed Sample line property 2 - */ + // @var mixed Sample line property 2 public $prop2; } +*/ \ No newline at end of file diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index f257ebca07e..0806bcce8d9 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -189,7 +189,7 @@ class modMyModule extends DolibarrModules // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week $this->cronjobs = array( - 0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/mymodulemyjob.class.php', 'objectname'=>'MyModuleMyJob', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true) + 0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true) ); // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true), // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql index 4822d7c3ac4..2b728128605 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject.key.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.key.sql @@ -11,7 +11,7 @@ -- 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 . +-- along with this program. If not, see http://www.gnu.org/licenses/. -- BEGIN MODULEBUILDER INDEXES diff --git a/htdocs/modulebuilder/template/sql/llx_myobject.sql b/htdocs/modulebuilder/template/sql/llx_myobject.sql index 1c47004f4e7..a6c474585ce 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject.sql @@ -11,7 +11,7 @@ -- 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 . +-- along with this program. If not, see http://www.gnu.org/licenses/. CREATE TABLE llx_myobject( diff --git a/htdocs/modulebuilder/template/sql/llx_myobject_extrafields.sql b/htdocs/modulebuilder/template/sql/llx_myobject_extrafields.sql index 72c672a92f8..2e505a9b99e 100644 --- a/htdocs/modulebuilder/template/sql/llx_myobject_extrafields.sql +++ b/htdocs/modulebuilder/template/sql/llx_myobject_extrafields.sql @@ -11,7 +11,7 @@ -- 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 . +-- along with this program. If not, see http://www.gnu.org/licenses/. create table llx_myobject_extrafields ( diff --git a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql index 494de5a2b17..1b42935ab47 100644 --- a/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql +++ b/htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql @@ -11,4 +11,4 @@ -- 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 . +-- along with this program. If not, see http://www.gnu.org/licenses/. diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index d5a17f02239..8c3f43b03d3 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -112,13 +112,13 @@ 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("Ref", $_SERVER["PHP_SELF"], "p.id_sondage", $param,"","",$sortfield,$sortorder); +print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "p.titre", $param,"","",$sortfield,$sortorder); +print_liste_field_titre("Type"); +print_liste_field_titre("Author", $_SERVER["PHP_SELF"], "u.".$fieldtosortuser, $param,"","",$sortfield,$sortorder); +print_liste_field_titre("NbOfVoters", $_SERVER["PHP_SELF"], "", $param,"",'align="right"',$sortfield,$sortorder); +print_liste_field_titre("ExpireDate", $_SERVER["PHP_SELF"], "p.date_fin", $param,"",'align="center"',$sortfield,$sortorder); +print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.status", $param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); print ''."\n"; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 318d19e10b3..53d553aca16 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -110,7 +110,7 @@ if (! empty($canvas)) // Security check $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); -$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); +$fieldtype = (! empty($id) ? 'rowid' : 'ref'); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype,$objcanvas); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 14b60473687..2596e6ac2ea 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4022,31 +4022,7 @@ class Product extends CommonObject $filearray=array_merge($filearray, $filearrayold); } - $filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC); - - //var_dump($filearray); - //var_dump($filearrayindatabase); - - // Complete filearray with properties found into $filearrayindatabase - foreach($filearray as $key => $val) - { - $found=0; - // Search if it exists into $filearrayindatabase - foreach($filearrayindatabase as $key2 => $val2) - { - if ($filearrayindatabase[$key2]['name'] == $filearray[$key]['name']) - { - $filearray[$key]['position_name']=($filearrayindatabase[$key2]['position']?$filearrayindatabase[$key2]['position']:'0').'_'.$filearrayindatabase[$key2]['name']; - $filearray[$key]['position']=$filearrayindatabase[$key2]['position']; - $filearray[$key]['cover']=$filearrayindatabase[$key2]['cover']; - $filearray[$key]['acl']=$filearrayindatabase[$key2]['acl']; - $filearray[$key]['rowid']=$filearrayindatabase[$key2]['rowid']; - $filearray[$key]['label']=$filearrayindatabase[$key2]['label']; - $found=1; - break; - } - } - } + completeFileArrayWithDatabaseInfo($filearray, $relativedir); if (count($filearray)) { diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 6a488c87e2b..6c44b54cbe8 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -676,15 +676,12 @@ class Productcustomerprice extends CommonObject 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('MYOBJECT_MODIFY',$this,$user,$langs,$conf); - // if ($result < 0) { $error++; $this->errors=$interface->errors; } - // // End call triggers + // Call triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers('PRODUCT_CUSTOMER_PRICE_UPDATE',$this,$user,$langs,$conf); + if ($result < 0) { $error++; $this->errors=$interface->errors; } + // End call triggers } } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index a887f082d69..ed53163615d 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -603,21 +603,20 @@ if ($id > 0 || $ref) $param="&id=".$object->id; print ''; - print_liste_field_titre($langs->trans("Suppliers"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("SupplierRef")); - if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre($langs->trans("Availability"),$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("VATRate"),$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("PriceQtyMinHT"),$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DiscountQtyMin"),$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("ReputationForThisProduct"),$_SERVER["PHP_SELF"],"pfp.supplier_reputation","",$param,'align="center"',$sortfield,$sortorder); - + print_liste_field_titre("Suppliers",$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("SupplierRef"); + if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre("Availability",$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("QtyMin",$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("VATRate",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PriceQtyMinHT",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("UnitPriceHT",$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("DiscountQtyMin",$_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("NbDaysToDelivery",$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("ReputationForThisProduct",$_SERVER["PHP_SELF"],"pfp.supplier_reputation","",$param,'align="center"',$sortfield,$sortorder); // Charges ???? if ($conf->global->PRODUCT_CHARGES) { - if (! empty($conf->margin->enabled)) print_liste_field_titre($langs->trans("UnitCharges")); + if (! empty($conf->margin->enabled)) print_liste_field_titre("UnitCharges"); } print_liste_field_titre(''); print "\n"; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0c8e4deca0b..f772f8d4f0c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -693,7 +693,7 @@ else $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 21491eab512..91a8f4f80a4 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -139,10 +139,10 @@ if ($resql) while ($i < $num) { $objp = $db->fetch_object($resql); - + $infoprod[$objp->rowid]=array('type'=>$objp->type, 'ref'=>$objp->ref, 'label'=>$objp->label); $infoprod[$objp->rowid]['nblineproposal']=$objp->c; - + $i++; } $db->free($resql); @@ -159,10 +159,10 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort print '
    '; print ""; -print_liste_field_titre($langs->trans('Ref'), $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Type'), $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Label'), $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('NbOfQtyInProposals'), $_SERVER["PHP_SELF"], 'c', '', $param, 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); +print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder); +print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); +print_liste_field_titre('NbOfQtyInProposals', $_SERVER["PHP_SELF"], 'c', '', $param, 'align="right"', $sortfield, $sortorder); print "\n"; foreach($infoprod as $prodid => $vals) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 1000388cb56..b03a8763770 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1171,6 +1171,12 @@ if ($action == 'edit_price' && $object->getRights()->creer) } print ''; print ''; + + $parameters=array('colspan' => 2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + + $parameters=array('colspan' => 2); + $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print '
    '; diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 9d58c244b2e..e3983344cff 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -200,7 +200,7 @@ if ($resql) { 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 "
    "; @@ -210,7 +210,7 @@ if ($resql) print " > ".$ways[0]."
    \n"; print "

    "; } - + // Filter on categories $moreforfilter=''; if (! empty($conf->categorie->enabled)) @@ -220,11 +220,11 @@ if ($resql) $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ'); $moreforfilter.='
    '; } - + $moreforfilter.='
    '; $moreforfilter.=$langs->trans("StockTooLow").' '; $moreforfilter.='
    '; - + if (! empty($moreforfilter)) { print '
    '; @@ -234,7 +234,7 @@ if ($resql) print $hookmanager->resPrint; print '
    '; } - + $param=''; if ($tosell) $param.="&tosell=".$tosell; if ($tobuy) $param.="&tobuy=".$tobuy; @@ -242,17 +242,17 @@ if ($resql) if ($fourn_id) $param.="&fourn_id=".$fourn_id; if ($snom) $param.="&snom=".$snom; if ($sref) $param.="&sref=".$sref; - + $formProduct = new FormProduct($db); $formProduct->loadWarehouses(); $warehouses_list = $formProduct->cache_warehouses; $nb_warehouse = count($warehouses_list); $colspan_warehouse = 1; if (! empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) { $colspan_warehouse = $nb_warehouse > 1 ? $nb_warehouse+1 : 1; } - + print '
    '; print ''; - + // Lignes des champs de filtre 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->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); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder); + if (! empty($conf->service->enabled) && $type == 1) print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("StockLimit", $_SERVER["PHP_SELF"], "p.seuil_stock_alerte",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("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) { @@ -297,16 +297,16 @@ if ($resql) 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); + if ($virtualdiffersfromphysical) print_liste_field_titre("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( $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); @@ -338,22 +338,22 @@ if ($resql) if ($objp->seuil_stock_alerte != '' && ($objp->stock_physique < $objp->seuil_stock_alerte)) print img_warning($langs->trans("StockTooLow")).' '; print $objp->stock_physique; print ''; - + // 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 ''; } - } - } - - - + } + } + + + // Virtual stock if ($virtualdiffersfromphysical) { @@ -372,7 +372,7 @@ if ($resql) print "
    '; @@ -284,12 +284,12 @@ if ($resql) // Lignes des titres print "
    '; print empty($product->stock_warehouse[$wh['id']]->real) ? '0' : $product->stock_warehouse[$wh['id']]->real; print '
    "; print '
    '; - + print ''; $db->free($resql); diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 3c335ed1ad8..490986b155e 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -288,20 +288,20 @@ if ($resql) // Lignes des titres print "
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","",$option,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$option,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("OrderDate"),$_SERVER["PHP_SELF"],"c.date_commande","",$option,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","",$option,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.total_ht","",$option,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"c.fk_statut","",$option,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid","",$option,'',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","",$option,'',$sortfield,$sortorder); + print_liste_field_titre("OrderDate",$_SERVER["PHP_SELF"],"c.date_commande","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Qty",$_SERVER["PHP_SELF"],"d.qty","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("AmountHT",$_SERVER["PHP_SELF"],"c.total_ht","",$option,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"c.fk_statut","",$option,'align="right"',$sortfield,$sortorder); print "\n"; if ($num > 0) diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index ad802ed36f6..daf2a9c3654 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -210,13 +210,13 @@ if ($id > 0 || ! empty($ref)) { print '
    '; print '
    '; print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("SupplierCode"), $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("OrderDate"), $_SERVER["PHP_SELF"], "c.date_commande", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "c.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "c.rowid", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("SupplierCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("OrderDate", $_SERVER["PHP_SELF"], "c.date_commande", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "c.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "c.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; if ($num > 0) { diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index 1f85d25f9f3..f9eed565903 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -163,11 +163,11 @@ if ($id > 0 || ! empty($ref)) print '
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.date_contrat","","&id=".$product->id,'align="center"',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"c.amount","","&id=".$product->id,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid","","&id=".$product->id,'',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","&id=".$product->id,'',$sortfield,$sortorder); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","&id=".$product->id,'',$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.date_contrat","","&id=".$product->id,'align="center"',$sortfield,$sortorder); + //print_liste_field_titre("AmountHT"),$_SERVER["PHP_SELF"],"c.amount","","&id=".$product->id,'align="right"',$sortfield,$sortorder); print_liste_field_titre($staticcontratligne->LibStatut(0,3),$_SERVER["PHP_SELF"],"",'','','width="16"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($staticcontratligne->LibStatut(4,3),$_SERVER["PHP_SELF"],"",'','','width="16"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($staticcontratligne->LibStatut(5,3),$_SERVER["PHP_SELF"],"",'','','width="16"',$sortfield,$sortorder,'maxwidthsearch '); diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index 831e7ec729c..8cdc0efd5c0 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -223,13 +223,13 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$option,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$option,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateInvoice"),$_SERVER["PHP_SELF"],"f.datef","",$option,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"],"d.qty","",$option,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","",$option,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","",$option,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"s.rowid","",$option,'',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","",$option,'',$sortfield,$sortorder); + print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","",$option,'',$sortfield,$sortorder); + print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Qty",$_SERVER["PHP_SELF"],"d.qty","",$option,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("AmountHT",$_SERVER["PHP_SELF"],"f.total","",$option,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"f.paye,f.fk_statut","",$option,'align="right"',$sortfield,$sortorder); print "\n"; if ($num > 0) diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 514fc622cc5..586741496c2 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -202,13 +202,13 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("SupplierCode"), $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("DateInvoice"), $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "f.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "s.rowid", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("SupplierCode", $_SERVER["PHP_SELF"], "s.code_client", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "f.total_ht", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "f.paye,f.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; if ($num > 0) diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 3b7131245a6..a5801c422e0 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -204,12 +204,12 @@ if ($id > 0 || ! empty($ref)) print '
    '; print '
    '; print ''; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.rowid", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("DatePropal"), $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Qty"), $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.rowid", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", $option, '', $sortfield, $sortorder); + print_liste_field_titre("DatePropal", $_SERVER["PHP_SELF"], "p.datep", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "d.qty", "", $option, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], "p.total", "", $option, 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "p.fk_statut", "", $option, 'align="right"', $sortfield, $sortorder); print "\n"; if ($num > 0) diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index db8a6736688..0f843e97b61 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -429,13 +429,13 @@ else print '
    '; print ""; - print_liste_field_titre($langs->trans("Product"),"", "p.ref","&id=".$id,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Label"),"", "p.label","&id=".$id,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Units"),"", "ps.reel","&id=".$id,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("AverageUnitPricePMPShort"),"", "p.pmp","&id=".$id,"",'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValueShort"),"", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); - if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellPriceMin"),"", "p.price","&id=".$id,"",'align="right"',$sortfield,$sortorder); - if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("EstimatedStockValueSellShort"),"", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Product","", "p.ref","&id=".$id,"","",$sortfield,$sortorder); + print_liste_field_titre("Label","", "p.label","&id=".$id,"","",$sortfield,$sortorder); + print_liste_field_titre("Units","", "ps.reel","&id=".$id,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("AverageUnitPricePMPShort","", "p.pmp","&id=".$id,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre("EstimatedStockValueShort","", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); + if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre("SellPriceMin","", "p.price","&id=".$id,"",'align="right"',$sortfield,$sortorder); + if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre("EstimatedStockValueSellShort","", "","&id=".$id,"",'align="right"',$sortfield,$sortorder); if ($user->rights->stock->mouvement->creer) print_liste_field_titre(''); if ($user->rights->stock->creer) print_liste_field_titre(''); print "\n"; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 683bb4de566..d740a2a9d73 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -129,22 +129,22 @@ if ($result) if ($search_label) $param.="&search_label=".$search_label; if ($search_status) $param.="&search_status=".$search_status; if ($sall) $param.="&sall=".$sall; - + print ''; print ''; print ''; print ''; print ''; print ''; - + print_barre_liste($langs->trans("ListOfWarehouses"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_generic.png', 0, '', '', $limit); - + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - + $moreforfilter=''; print '
    '; @@ -174,14 +174,14 @@ if ($result) 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("Ref",$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("LocationSummary",$_SERVER["PHP_SELF"], "e.lieu","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stockqty",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "estimatedvalue",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"], "e.statut",'',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -192,12 +192,12 @@ if ($result) while ($i < min($num,$limit)) { $objp = $db->fetch_object($result); - + $warehouse->id = $objp->rowid; $warehouse->label = $objp->ref; $warehouse->lieu = $objp->lieu; $warehouse->fk_parent = $objp->fk_parent; - + print ''; print ''; // Location @@ -225,7 +225,7 @@ if ($result) print "\n"; - + $i++; } @@ -253,7 +253,7 @@ if ($result) print "
    ' . $warehouse->getNomUrl(1) . '
    "; print "
    "; - + print ''; } else diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 2ab78ac735d..1ca2b1b16d1 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -328,9 +328,9 @@ llxHeader('', $title); print load_fiche_titre($langs->trans("MassStockTransferShort")); $titletoadd=$langs->trans("Select"); -$titletoaddnoent=$langs->transnoentitiesnoconv("Select"); $buttonrecord=$langs->trans("RecordMovement"); -$buttonrecordnoent=$langs->trans("RecordMovement"); +$titletoaddnoent=$langs->transnoentitiesnoconv("Select"); +$buttonrecordnoent=$langs->transnoentitiesnoconv("RecordMovement"); print $langs->trans("SelectProductInAndOutWareHouse",$titletoaddnoent,$buttonrecordnoent).'
    '; print '
    '."\n"; @@ -402,7 +402,7 @@ print ''; foreach($listofdata as $key => $val) { - + $productstatic->fetch($val['id_product']); $warehousestatics->fetch($val['id_sw']); @@ -444,7 +444,7 @@ print ''; print ''; // Button to record mass movement -$codemove=GETPOST('codemove'); +$codemove=(isset($_POST["codemove"])?GETPOST("codemove",'alpha'):dol_print_date(dol_now(),'%y%m%d%H%M%S')); $labelmovement=GETPOST("label")?GETPOST('label'):$langs->trans("StockTransfer").' '.dol_print_date($now,'%Y-%m-%d %H:%M'); print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index e12ecee2b9b..4f56527353d 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -649,12 +649,12 @@ if ($resql) if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockCorrection").''; + print ''.$langs->trans("CorrectStock").''; } if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockTransfer").''; + print ''.$langs->trans("TransferStock").''; } print '
    '; @@ -756,20 +756,20 @@ if ($resql) { // Product Ref print ''; } if (! empty($arrayfields['p.label']['checked'])) { // Product label print ''; } // Batch if (! empty($arrayfields['m.batch']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.eatby']['checked'])) { @@ -878,12 +878,12 @@ if ($resql) 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['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); + if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'],$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -894,7 +894,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index db462411fe7..87a218bb672 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -769,13 +769,13 @@ if (empty($reshook)) if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockCorrection").''; + print ''.$langs->trans("CorrectStock").''; } //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockTransfer").''; + print ''.$langs->trans("TransferStock").''; } print ''; @@ -891,7 +891,7 @@ if ($resql) { print "\n".''."\n"; diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index a3f4cb8ecaf..55fe5908c7f 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -487,8 +487,8 @@ $param .= '&fk_supplier=' . $fk_supplier; $param .= '&fk_entrepot=' . $fk_entrepot; $stocklabel = $langs->trans('Stock'); -if ($usevirtualstock == 1) $stocklabel = $langs->trans('VirtualStock'); -if ($usevirtualstock == 0) $stocklabel = $langs->trans('PhysicalStock'); +if ($usevirtualstock == 1) $stocklabel = 'VirtualStock'; +if ($usevirtualstock == 0) $stocklabel = 'PhysicalStock'; print ''. ''. @@ -521,15 +521,15 @@ print ''; // Lines of title print ''; print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); -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('DesiredStock'), $_SERVER["PHP_SELF"], 'p.desiredstock', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('StockLimitShort'), $_SERVER["PHP_SELF"], 'p.seuil_stock_alerte', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); +if (!empty($conf->service->enabled) && $type == 1) print_liste_field_titre('Duration', $_SERVER["PHP_SELF"], 'p.duration', $param, '', 'align="center"', $sortfield, $sortorder); +print_liste_field_titre('DesiredStock', $_SERVER["PHP_SELF"], 'p.desiredstock', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('StockLimitShort', $_SERVER["PHP_SELF"], 'p.seuil_stock_alerte', $param, '', 'align="right"', $sortfield, $sortorder); print_liste_field_titre($stocklabel, $_SERVER["PHP_SELF"], 'stock_physique', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('Ordered'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('StockToBuy'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); -print_liste_field_titre($langs->trans('SupplierRef'), $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('Ordered', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('StockToBuy', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); +print_liste_field_titre('SupplierRef', $_SERVER["PHP_SELF"], '', $param, '', 'align="right"', $sortfield, $sortorder); print "\n"; $prod = new Product($db); @@ -579,7 +579,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) }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"; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 6ed7fc379b5..694f9cae1ad 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -186,7 +186,7 @@ if ($resql) print ''; print_liste_field_titre( - $langs->trans('Ref'), + 'Ref', $_SERVER['PHP_SELF'], 'cf.ref', '', @@ -196,7 +196,7 @@ if ($resql) $sortorder ); print_liste_field_titre( - $langs->trans('Company'), + 'Company', $_SERVER['PHP_SELF'], 's.nom', '', @@ -206,7 +206,7 @@ if ($resql) $sortorder ); print_liste_field_titre( - $langs->trans('Author'), + 'Author', $_SERVER['PHP_SELF'], 'u.login', '', @@ -216,7 +216,7 @@ if ($resql) $sortorder ); print_liste_field_titre( - $langs->trans('AmountTTC'), + 'AmountTTC', $_SERVER['PHP_SELF'], 'cf.total_ttc', '', @@ -226,7 +226,7 @@ if ($resql) $sortorder ); print_liste_field_titre( - $langs->trans('OrderCreation'), + 'OrderCreation', $_SERVER['PHP_SELF'], 'cf.date_creation', '', @@ -236,7 +236,7 @@ if ($resql) $sortorder ); print_liste_field_titre( - $langs->trans('Status'), + 'Status', $_SERVER['PHP_SELF'], 'cf.fk_statut', '', @@ -246,7 +246,7 @@ if ($resql) $sortorder ); print ''; - + $userstatic = new User($db); while ($i < min($num,$conf->liste_limit)) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 28fd3dfadea..4242121177c 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -15,7 +15,7 @@ * along with this program. If not, see . * * $object must be defined - * $backtopage + * $backtopage */ ?> @@ -50,7 +50,7 @@ print ''."\n"; dol_fiche_head(); - + print ''; print ''; print ''; @@ -93,12 +93,12 @@ print ''; print ''; + print ''; } print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && + if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) @@ -127,19 +127,19 @@ print ''; - print ''; + print ''; print ''; print '
    '; - print ''; + print ''; print ''; - print ''; + print ''; print '
    '; print img_picto($langs->trans("Tranfer"),'uparrow','class="hideonsmartphone"').' '; - print 'id.'">'.$langs->trans("StockTransfer").''; + print 'id.'">'.$langs->trans("TransferStock").''; // Disabled, because edition of stock content must use the "Correct stock menu". // Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ... //print 'id.'#'.$pdluo->id.'">'; diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index fc60f500ba6..638aa1e4fbd 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -425,7 +425,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } @@ -435,7 +435,7 @@ if ($resql) 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); + //if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($arrayfields['t.status']['label'],$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print '
    '.$langs->trans('Project').''; $formproject->select_projects(); - print '
    '; print ''; print ''.$langs->trans("InventoryCode").''.$langs->trans("InventoryCode").'
    '; dol_fiche_end(); - + print '
    '; print ''; print '     '; print ''; print '
    '; - + print ''; ?> diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index ed367742f1c..6d028da5663 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -25,9 +25,9 @@ if ($object->element == 'product') $productref = $object->ref; $langs->load("productbatch"); - + if (empty($id)) $id = $object->id; - + $pdluoid=GETPOST('pdluoid','int'); $pdluo = new Productbatch($db); @@ -48,9 +48,9 @@ print load_fiche_titre($langs->trans("StockTransfer"),'','title_generic.png'); print '
    '."\n"; - + dol_fiche_head(); - + print ''; print ''; print ''; @@ -76,7 +76,7 @@ print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); print ''; } - + print ''.$langs->trans("WarehouseTarget").''; print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); print ''; @@ -84,7 +84,7 @@ print ''; // Serial / Eat-by date - if (! empty($conf->productbatch->enabled) && + if (! empty($conf->productbatch->enabled) && (($object->element == 'product' && $object->hasbatch()) || ($object->element == 'stock')) ) @@ -103,7 +103,7 @@ } print ''; print ''; - + print ''; print ''.$langs->trans("EatByDate").''; print $form->select_date(($d_eatby?$d_eatby:$pdluo->eatby),'eatby','','',1,"", 1, 0, 1, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled @@ -121,13 +121,13 @@ print ''; print ''; print ''; - print ''.$langs->trans("InventoryCode").''; + print ''.$langs->trans("InventoryCode").''; print ''; print ''; dol_fiche_end(); - + print '
    '; print ''; print '     '; diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index 40e3060cfee..a1d68394bb0 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -87,11 +87,11 @@ if ($result) print ''; print ""; - print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("LocationSummary"), $_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValue"), $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EstimatedStockValueSell"), $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"), $_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.label","","","",$sortfield,$sortorder); + print_liste_field_titre("LocationSummary", $_SERVER["PHP_SELF"], "e.lieu","","","",$sortfield,$sortorder); + print_liste_field_titre("EstimatedStockValue", $_SERVER["PHP_SELF"], "e.valo_pmp",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre("EstimatedStockValueSell", $_SERVER["PHP_SELF"], "",'','','align="right"',$sortfield,$sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "e.statut",'','','align="right"',$sortfield,$sortorder); print "\n"; if ($num) @@ -120,7 +120,7 @@ if ($result) print "\n"; $total += price2num($objp->estimatedvalue,'MU'); $totalsell += price2num($objp->sellvalue,'MU'); - + $i++; } @@ -134,7 +134,7 @@ if ($result) } $db->free($result); - + print "
    "; print '
    '; diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 7bea4bf3213..8418561aa30 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -29,7 +29,9 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -$mine = $_REQUEST['mode']=='mine' ? 1 : 0; +$search_project_user = GETPOST('search_project_user','int'); +$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0; +if ($search_project_user == $user->id) $mine = 1; // Security check $socid=0; @@ -73,7 +75,7 @@ $morehtml=''; $morehtml.=''; $morehtml.=''; $morehtml.=''; @@ -98,7 +100,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele { $listofsearchfields['search_task']=array('text'=>'Task'); } - + if (count($listofsearchfields)) { print ''; @@ -114,7 +116,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; $i++; } - print ''; + print ''; print ''; print '
    '; } @@ -148,7 +150,7 @@ if ( $resql ) while ($row = $db->fetch_object($resql)) { - + print ''; print ''; $projectstatic->id=$row->rowid; @@ -205,7 +207,7 @@ if ( $resql ) while ($row = $db->fetch_object($resql)) { - + print ''; print ''; $projectstatic->id=$row->rowid; @@ -237,14 +239,14 @@ print ""; if ($db->type != 'pgsql') { print '
    '; - + // Affichage de la liste des projets de la semaine print ''; print ''; print ''; print ''; print "\n"; - + $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; @@ -256,16 +258,16 @@ if ($db->type != 'pgsql') $sql.= " AND task_date >= '".$db->idate(dol_get_first_day($year, $month)).'" AND ..."; $sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " GROUP BY p.rowid, p.ref, p.title"; - + $resql = $db->query($sql); if ( $resql ) { $total = 0; $var=true; - + while ($row = $db->fetch_object($resql)) { - + print ''; print '\n"; $total += $row->nb; } - + $db->free($resql); } else @@ -302,7 +304,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) print ''; print ''; print "\n"; - + $sql = "SELECT p.rowid, p.ref, p.title, p.public, SUM(tt.task_duration) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; @@ -314,12 +316,12 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) $sql.= " AND task_date BETWEEN '".$db->idate(dol_get_first_day($year, $month))."' AND '".$db->idate(dol_get_last_day($year, $month))."'"; $sql.= " AND p.rowid in (".$projectsListId.")"; $sql.= " GROUP BY p.rowid, p.ref, p.title, p.public"; - + $resql = $db->query($sql); if ( $resql ) { $var=false; - + while ($row = $db->fetch_object($resql)) { print ''; @@ -331,7 +333,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_MONTH)) print ''; print ''; print "\n"; - + } $db->free($resql); } @@ -383,7 +385,7 @@ if (! empty($conf->global->PROJECT_TASK_TIME_YEAR)) print ''; print ''; print "\n"; - + } $db->free($resql); } @@ -430,12 +432,12 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S } else dol_print_error($db); if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found - + // Tasks for all resources of all opened projects and time spent for each task/resource // This list can be very long, so we don't show it by default on task area. We prefer to use the list page. // Add constant PROJECT_SHOW_TASK_LIST_ON_PROJECT_AREA to show this list - + $max = (empty($conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA)?1000:$conf->global->PROJECT_LIMIT_TASK_PROJECT_AREA); $sql = "SELECT p.ref, p.title, p.rowid as projectid, p.fk_statut as status, p.fk_opp_status as opp_status, p.public, p.dateo as projdateo, p.datee as projdatee,"; @@ -489,7 +491,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S while ($i < $num && $i < $max) { $obj = $db->fetch_object($resql); - + $username=''; if ($obj->userid && $userstatic->id != $obj->userid) // We have a user and it is not last loaded user @@ -509,7 +511,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S $projectstatic->public = $obj->public; $projectstatic->dateo = $db->jdate($obj->projdateo); $projectstatic->datee = $db->jdate($obj->projdatee); - + print $projectstatic->getNomUrl(1,'',0,'','
    '); print ''; if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) @@ -536,7 +538,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_S $taskstatic->datee = $db->jdate($obj->datee); print ''; print ''; print ''; $i++; } - print '
    '.$langs->trans("ActivityOnProjectThisWeek").''.$langs->trans("Time").'
    '; $projectstatic->id=$row->rowid; @@ -278,7 +280,7 @@ if ($db->type != 'pgsql') print "
    '.$langs->trans("ActivityOnProjectThisMonth").': '.dol_print_date($now,"%B %Y").''.$langs->trans("Time").'
    '.convertSecondToTime($row->nb, 'allhourmin').'
    '.convertSecondToTime($row->nb, 'allhourmin').'
    '.dol_print_date($db->jdate($obj->dateo),'day').''.dol_print_date($db->jdate($obj->datee),'day'); - print dol_print_date($obj->date_end,'dayhour'); + print dol_print_date($obj->date_end,'dayhour'); if ($taskstatic->hasDelay()) print img_warning($langs->trans("Late")); print ''; diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 7b1f50bb50c..45d7aa237ad 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -82,13 +82,18 @@ else if ($year && $month && $day) $daytoparse=dol_mktime(0, 0, 0, $month, $day, if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { $usertoprocess=$user; + $search_usertoprocessid=$usertoprocess->id; } -else +elseif (search_usertoprocessid > 0) { $usertoprocess=new User($db); $usertoprocess->fetch($search_usertoprocessid); + $search_usertoprocessid=$usertoprocess->id; +} +else +{ + $usertoprocess=new User($db); } -$search_usertoprocessid=$usertoprocess->id; $object=new Task($db); @@ -305,9 +310,9 @@ $next_month = $next['mon']; $next_day = $next['mday']; $title=$langs->trans("TimeSpent"); -if ($mine) $title=$langs->trans("MyTimeSpent"); +if ($mine || ($usertoprocess->id == $user->id)) $title=$langs->trans("MyTimeSpent"); -$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project +$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,(empty($usertoprocess->id)?2:0),1); // Return all project i have permission on. I want my tasks and some of my task may be on a public projet that is not my project if ($id) { @@ -320,7 +325,7 @@ $morewherefilter=''; if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref); if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label); if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); -$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later. +$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later. $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); //var_dump($tasksarray); @@ -362,13 +367,16 @@ dol_fiche_head($head, 'inputperday', '', -1, 'task'); // Show description of content print '
    '; -if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; +if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; + if (empty($usertoprocess->id) || $usertoprocess->id < 0) + { + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; + } } -if ($mine) +if ($mine || ($usertoprocess->id == $user->id)) { print $langs->trans("OnlyYourTaskAreVisible").'
    '; } @@ -413,7 +421,7 @@ $moreforfilter.='
    '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $includeonly='hierachyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); -$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); +$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
    '; if (! empty($moreforfilter)) diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 3410ba1d949..b4fcd68a3c9 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -95,13 +95,18 @@ $lastdaytoshow=dol_time_plus_duree($firstdaytoshow, 7, 'd'); if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { $usertoprocess=$user; + $search_usertoprocessid=$usertoprocess->id; } -else +elseif (search_usertoprocessid > 0) { $usertoprocess=new User($db); $usertoprocess->fetch($search_usertoprocessid); + $search_usertoprocessid=$usertoprocess->id; +} +else +{ + $usertoprocess=new User($db); } -$search_usertoprocessid=$usertoprocess->id; $object=new Task($db); @@ -300,9 +305,9 @@ $taskstatic = new Task($db); $thirdpartystatic = new Societe($db); $title=$langs->trans("TimeSpent"); -if ($mine) $title=$langs->trans("MyTimeSpent"); +if ($mine || $usertoprocess->id == $user->id) $title=$langs->trans("MyTimeSpent"); -$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,0,1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project +$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertoprocess,(empty($usertoprocess->id)?2:0),1); // Return all project i have permission on (assigned to me+public). I want my tasks and some of my task may be on a public projet that is not my project //var_dump($projectsListId); if ($id) { @@ -316,7 +321,7 @@ if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label); if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); -$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later. +$tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter, ($search_usertoprocessid?$search_usertoprocessid:0)); // We want to see all task of opened project i am allowed to see and that match filter, not only my tasks. Later only mine will be editable later. $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); //var_dump($tasksarray); @@ -356,13 +361,16 @@ dol_fiche_head($head, 'inputperweek', '', -1, 'task'); // Show description of content print '
    '; -if ($mine) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; +if ($mine || ($usertoprocess->id == $user->id)) print $langs->trans("MyTasksDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; else { - if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; - else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; + if (empty($usertoprocess->id) || $usertoprocess->id < 0) + { + if ($user->rights->projet->all->lire && ! $socid) print $langs->trans("ProjectsDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; + else print $langs->trans("ProjectsPublicTaskDesc").($onlyopenedproject?' '.$langs->trans("OnlyOpenedProject"):'').'
    '; + } } -if ($mine) +if ($mine || ($usertoprocess->id == $user->id)) { print $langs->trans("OnlyYourTaskAreVisible").'
    '; } @@ -408,7 +416,7 @@ $moreforfilter.='
    '; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; $includeonly='hierachyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); -$moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:$usertoprocess->id, 'search_usertoprocessid', 0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); +$moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
    '; if (! empty($moreforfilter)) diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index c7f0181dbf5..2188d4bd6a4 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -33,8 +33,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("projects"); $langs->load("companies"); -$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0; $search_project_user = GETPOST('search_project_user','int'); +$mine = GETPOST('mode','aZ09')=='mine' ? 1 : 0; +if ($search_project_user == $user->id) $mine = 1; // Security check $socid=0; @@ -122,7 +123,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele { $listofsearchfields['search_project']=array('text'=>'Project'); } - + if (count($listofsearchfields)) { print '
    '; @@ -138,7 +139,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print '
    '; + print ''; print ''; print '
    '; } @@ -160,8 +161,8 @@ print '
    '; print ''; print ''; -print_liste_field_titre($langs->trans("OpenedProjectsByThirdparties"),$_SERVER["PHP_SELF"],"s.nom","","",'',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("NbOfProjects"),"","","","",'align="right"',$sortfield,$sortorder); +print_liste_field_titre("OpenedProjectsByThirdparties",$_SERVER["PHP_SELF"],"s.nom","","",'',$sortfield,$sortorder); +print_liste_field_titre("NbOfProjects","","","","",'align="right"',$sortfield,$sortorder); print "\n"; $sql = "SELECT COUNT(p.rowid) as nb, SUM(p.opp_amount)"; @@ -185,7 +186,7 @@ if ( $resql ) while ($i < $num) { $obj = $db->fetch_object($resql); - + print ''; print ''; if (! empty($arrayfields['p.ref']['checked'])) { print ''; } if (! empty($arrayfields['p.title']['checked'])) { print ''; } if (! empty($arrayfields['s.nom']['checked'])) { print ''; } // Sale representative @@ -511,8 +517,8 @@ if (! empty($arrayfields['commercial']['checked'])) if (! empty($arrayfields['p.dateo']['checked'])) { print ''; } @@ -520,8 +526,8 @@ if (! empty($arrayfields['p.dateo']['checked'])) if (! empty($arrayfields['p.datee']['checked'])) { print ''; } @@ -634,7 +640,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 58ef76b7a91..7078b11ae70 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -610,7 +610,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index f643b9b5ca3..74ec47549a2 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -807,7 +807,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } }*/ @@ -956,7 +956,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) } // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$task_time); $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 3ca058acb8a..36b21c514e9 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -1,7 +1,8 @@ - * Copyright (C) 2013-2015 Laurent Destailleur +/* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr + * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013-2015 Laurent Destailleur + * Copyright (C) 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 @@ -30,6 +31,11 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOLOGIN')) define('NOLOGIN','1'); //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +// For MultiCompany module. +// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php +$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); +if (is_numeric($entity)) define("DOLENTITY", $entity); + // librarie core // Dolibarr environment $res = @include("../../main.inc.php"); // From htdocs directory @@ -119,19 +125,25 @@ if ($result<0) exit; } +$qualifiedjobs = array(); +foreach($object->lines as $val) +{ + if (! verifCond($val->test)) continue; + $qualifiedjobs[] = $val; +} // TODO Duplicate code. This sequence of code must be shared with code into cron_run_jobs.php script. // current date $now=dol_now(); -$nbofjobs=count($object->lines); +$nbofjobs=count($qualifiedjobs); $nbofjobslaunchedok=0; $nbofjobslaunchedko=0; -if (is_array($object->lines) && (count($object->lines)>0)) +if (is_array($qualifiedjobs) && (count($qualifiedjobs)>0)) { // Loop over job - foreach($object->lines as $line) + foreach($qualifiedjobs as $line) { dol_syslog("cron_run_jobs.php cronjobid: ".$line->id, LOG_WARNING); @@ -144,16 +156,16 @@ if (is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error:".$cronjob->error."
    \n"; - dol_syslog("cron_run_jobs.php:: fetch Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->fetch: ".$cronjob->error."
    \n"; + dol_syslog("cron_run_jobs.php::fetch Error".$cronjob->error, LOG_ERR); exit; } // Execut job $result=$cronjob->run_jobs($userlogin); if ($result < 0) { - echo "Error:".$cronjob->error."
    \n"; - dol_syslog("cron_run_jobs.php:: run_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->run_job: ".$cronjob->error."
    \n"; + dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); $nbofjobslaunchedko++; } else @@ -165,8 +177,8 @@ if (is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error:".$cronjob->error."
    \n"; - dol_syslog("cron_run_jobs.php:: reprogram_jobs Error".$cronjob->error, LOG_ERR); + echo "Error cronjob->reprogram_job: ".$cronjob->error."
    \n"; + dol_syslog("cron_run_jobs.php::reprogram_jobs Error".$cronjob->error, LOG_ERR); exit; } diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 232c6ef5aa3..ef42b4e8d56 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -132,18 +132,18 @@ if ($result) print '
    '; print ''; print ''."\n"; - //print_liste_field_titre($langs->trans("DateToBirth"), $_SERVER["PHP_SELF"],"birth",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? - print_liste_field_titre($langs->trans("EMail"), $_SERVER["PHP_SELF"],"email",'',$param,'',$sortfield,$sortorder,'public_'); - print_liste_field_titre($langs->trans("Zip"), $_SERVER["PHP_SELF"],"zip","",$param,'',$sortfield,$sortorder,'public_'); - print_liste_field_titre($langs->trans("Town"), $_SERVER["PHP_SELF"],"town","",$param,'',$sortfield,$sortorder,'public_'); - print_liste_field_titre($langs->trans("Photo"), $_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder,'public_'); + //print_liste_field_titre("DateToBirth", $_SERVER["PHP_SELF"],"birth",'',$param,$sortfield,$sortorder); // est-ce nécessaire ?? + print_liste_field_titre("EMail", $_SERVER["PHP_SELF"],"email",'',$param,'',$sortfield,$sortorder,'public_'); + print_liste_field_titre("Zip", $_SERVER["PHP_SELF"],"zip","",$param,'',$sortfield,$sortorder,'public_'); + print_liste_field_titre("Town", $_SERVER["PHP_SELF"],"town","",$param,'',$sortfield,$sortorder,'public_'); + print_liste_field_titre("Photo", $_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder,'public_'); print "\n"; $var=True; while ($i < $num && $i < $conf->liste_limit) { $objp = $db->fetch_object($result); - + print ''; print ''."\n"; print ''."\n"; diff --git a/htdocs/public/websites/index.php b/htdocs/public/websites/index.php index 81b5f985186..c82ff9975d0 100644 --- a/htdocs/public/websites/index.php +++ b/htdocs/public/websites/index.php @@ -190,7 +190,7 @@ if (! file_exists($original_file_osencoded)) // Output page content define('USEDOLIBARRSERVER', 1); -print ''."\n"; +print ''."\n"; include_once $original_file_osencoded; diff --git a/htdocs/resource/add.php b/htdocs/resource/add.php index a294dfb94db..a6cd75cccf8 100644 --- a/htdocs/resource/add.php +++ b/htdocs/resource/add.php @@ -66,64 +66,72 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); -if ($action == 'confirm_add_resource') +$hookmanager->initHooks(array('resource_card_add','globalcard')); +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - if (! $cancel) - { - $error=''; - $ref=GETPOST('ref','alpha'); - $description=GETPOST('description','alpha'); - $fk_code_type_resource=GETPOST('fk_code_type_resource','alpha'); - - if (empty($ref)) - { - $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); - setEventMessages($mesg, null, 'errors'); - $error++; - } - - if (! $error) - { - $object=new Dolresource($db); - $object->ref=$ref; - $object->description=$description; - $object->fk_code_type_resource=$fk_code_type_resource; - - // Fill array 'array_options' with data from add form - $ret = $extrafields->setOptionalsFromPost($extralabels, $object); - if ($ret < 0) { - $error ++; - } - - $result=$object->create($user); - if ($result > 0) - { - // Creation OK - $db->commit(); - setEventMessages($langs->trans('ResourceCreatedWithSuccess'), null, 'mesgs'); - Header("Location: card.php?id=" . $object->id); - return; - } - else - { - // Creation KO - setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; - } - } - else - { - $action = ''; - } - } - else - { - Header("Location: list.php"); - } + if ($action == 'confirm_add_resource') + { + if (! $cancel) + { + $error=''; + + $ref=GETPOST('ref','alpha'); + $description=GETPOST('description','alpha'); + $fk_code_type_resource=GETPOST('fk_code_type_resource','alpha'); + + if (empty($ref)) + { + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")); + setEventMessages($mesg, null, 'errors'); + $error++; + } + + if (! $error) + { + $object=new Dolresource($db); + $object->ref=$ref; + $object->description=$description; + $object->fk_code_type_resource=$fk_code_type_resource; + + // Fill array 'array_options' with data from add form + $ret = $extrafields->setOptionalsFromPost($extralabels, $object); + if ($ret < 0) { + $error ++; + } + + $result=$object->create($user); + if ($result > 0) + { + // Creation OK + $db->commit(); + setEventMessages($langs->trans('ResourceCreatedWithSuccess'), null, 'mesgs'); + Header("Location: card.php?id=" . $object->id); + return; + } + else + { + // Creation KO + setEventMessages($object->error, $object->errors, 'errors'); + $action = ''; + } + } + else + { + $action = ''; + } + } + else + { + Header("Location: list.php"); + } + } } - /* * View */ diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 02d38c2b924..db6eed63b3b 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -54,10 +54,13 @@ if ($user->societe_id > 0) accessforbidden(); } -if( ! $user->rights->resource->read) +if (! $user->rights->resource->read) accessforbidden(); $object = new Dolresource($db); +$objectFetchRes = $object->fetch($id); +if (! ($objectFetchRes > 0)) dol_print_error($db, $object->error); + $extrafields = new ExtraFields($db); @@ -162,7 +165,7 @@ llxHeader('',$pagetitle,''); $form = new Form($db); $formresource = new FormResource($db); -if ( $object->fetch($id) > 0 ) +if ( $objectFetchRes > 0 ) { $head=resource_prepare_head($object); diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 0564392071a..40d4b7b3655 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -247,7 +247,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 5c134aee36d..4c68e12583a 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -386,13 +386,13 @@ if ($sql_select) // Titles with sort buttons print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('TotalHT'),$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('UnitPrice'),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('Ref',$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre('Date',$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); + print_liste_field_titre('Status',$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre('Product',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('TotalHT',$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('UnitPrice',$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print "\n"; @@ -605,11 +605,11 @@ else if (empty($type_element) || $type_element == -1) print '
    '; if ($obj->socid) @@ -217,9 +218,9 @@ if (! empty($conf->global->PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA)) { // This list can be very long, so we don't show it by default on task area. We prefer to use the list page. // Add constant PROJECT_SHOW_PROJECT_LIST_ON_PROJECT_AREA to show this list - + print '
    '; - + print_projecttasks_array($db, $form, $socid, $projectsListId, 0, 1, $listofoppstatus, array()); } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 9e2971195e3..12576d790fd 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -261,8 +261,8 @@ if ($search_project_user > 0) } $sql.= " WHERE p.entity IN (".getEntity('project').')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users -// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser -if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; +// No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser +if ($socid > 0) $sql.= " AND (p.fk_soc = ".$socid.")"; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); @@ -487,19 +487,25 @@ print '
    '; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + if ($socid > 0) + { + $tmpthirdparty=new Societe($db); + $tmpthirdparty->fetch($socid); + $search_societe=$tmpthirdparty->nom; + } + print ''; print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($search_syear?$search_syear:-1,'search_syear',1, 20, 5); print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; + print ''; $formother->select_year($search_eyear?$search_eyear:-1,'search_eyear',1, 20, 5); print '
    '.dolGetFirstLastname($langs->trans("Firstname"),$langs->trans("Lastname")).''.$langs->trans("Company").'
    '.dolGetFirstLastname($objp->firstname, $objp->lastname).''.$objp->societe.'
    '."\n"; // Titles with sort buttons print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Product'),$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Quantity'),$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('Ref',$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre('Date',$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder); + print_liste_field_titre('Status',$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre('Product',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder); print "\n"; print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 6969363a766..94fc46f5734 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -954,7 +954,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 5cbbdba629b..697ae315fb3 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -230,9 +230,9 @@ if ($result > 0) // Line with titles print '
    '.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'
    '; print ''; - print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre("Target",$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); print_liste_field_titre(''); print "\n"; @@ -305,9 +305,9 @@ if ($result > 0) // Line with titles print '
    '; print ''; - print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); + print_liste_field_titre("Target",$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'"width="45%"',$sortfield,$sortorder); + print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",'',$param,'"width="35%"',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"n.type",'',$param,'"width="10%"',$sortfield,$sortorder); print_liste_field_titre('','',''); print ''; @@ -463,11 +463,11 @@ if ($result > 0) // Line with titles print '
    '; print ''; - print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'',$sortfield,$sortorder); - //print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"n.daten",'',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Target",$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"n.type",'',$param,'',$sortfield,$sortorder); + //print_liste_field_titre("Object",$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder); + print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"n.daten",'',$param,'align="right"',$sortfield,$sortorder); print ''; if ($num > 0) diff --git a/htdocs/societe/notify/index.php b/htdocs/societe/notify/index.php index 4b7a5a3a111..1a46f62d202 100644 --- a/htdocs/societe/notify/index.php +++ b/htdocs/societe/notify/index.php @@ -81,16 +81,16 @@ if ($result) print '
    '; print ''; - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"c.lastname","","",'valign="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"c.lastname","","",'valign="center"',$sortfield,$sortorder); + print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"a.titre","","",'valign="center"',$sortfield,$sortorder); print "\n"; $var=True; while ($i < $num) { $obj = $db->fetch_object($result); - + print ''; print "\n"; diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 97ae92e4044..5e7df26e176 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -444,17 +444,17 @@ if ($socid && $action != 'edit' && $action != "create") print '
    socid."\">".$obj->name."
    '; print ''; - print_liste_field_titre($langs->trans("LabelRIB")); - print_liste_field_titre($langs->trans("Bank")); - print_liste_field_titre($langs->trans("RIB")); - print_liste_field_titre($langs->trans("IBAN")); - print_liste_field_titre($langs->trans("BIC")); + print_liste_field_titre("LabelRIB"); + print_liste_field_titre("Bank"); + print_liste_field_titre("RIB"); + print_liste_field_titre("IBAN"); + print_liste_field_titre("BIC"); if (! empty($conf->prelevement->enabled)) { - print print_liste_field_titre($langs->trans("RUM")); - print print_liste_field_titre($langs->trans("WithdrawMode")); + print print_liste_field_titre("RUM"); + print print_liste_field_titre("WithdrawMode"); } - print_liste_field_titre($langs->trans("DefaultRIB"), '', '', '', '', 'align="center"'); + print_liste_field_titre("DefaultRIB", '', '', '', '', 'align="center"'); print_liste_field_titre('', '', '', '', '', 'align="center"'); print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index e640cabc93b..d95c0bc554f 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -234,14 +234,14 @@ if ($id > 0 || ! empty($ref)) print "
    "; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_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("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder); + print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Person",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); + print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); print "\n"; $var=True; diff --git a/htdocs/supplier_proposal/info.php b/htdocs/supplier_proposal/info.php index 718b79ce4ae..8cee304e3bb 100644 --- a/htdocs/supplier_proposal/info.php +++ b/htdocs/supplier_proposal/info.php @@ -43,6 +43,8 @@ $result = restrictedArea($user, 'supplier_proposal', $id); * View */ +$form = new Form($db); + llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur'); $object = new SupplierProposal($db); @@ -57,8 +59,8 @@ dol_fiche_head($head, 'info', $langs->trans('CommRequest'), -1, 'supplier_propos // Supplier proposal card $linkback = '' . $langs->trans("BackToList") . ''; - - + + $morehtmlref='
    '; // Ref supplier //$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->fournisseur->commande->creer, 'string', '', 0, 1); @@ -99,11 +101,11 @@ if (! empty($conf->projet->enabled)) } } $morehtmlref.='
    '; - - + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - + print '
    '; print '
    '; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 23a0fae1876..cfe94989301 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -734,7 +734,7 @@ if ($resql) $align=$extrafields->getAlignFlag($key); $sortonfield = "ef.".$key; if (! empty($extrafields->attribute_computed[$key])) $sortonfield=''; - print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); + print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder); } } } diff --git a/htdocs/support/index.php b/htdocs/support/index.php index 0e27107ef54..ab5d62df39e 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -70,12 +70,12 @@ print '
    '; print ''; print '