diff --git a/.editorconfig b/.editorconfig index 5b3e0d6a8df..2df455f0d4f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,3 +15,5 @@ indent_style = tab indent_style = tab [*.xml] indent_style = tab +[*.md] +trim_trailing_whitespace = false diff --git a/.travis.yml b/.travis.yml index 37c04fecd7a..8655b27d4ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -285,7 +285,7 @@ script: php upgrade2.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-2.log php step5.php 3.8.0 3.9.0 > $TRAVIS_BUILD_DIR/upgrade380390-3.log php upgrade.php 3.9.0 4.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade390400.log - php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API > $TRAVIS_BUILD_DIR/upgrade390400-2.log + php upgrade2.php 3.9.0 4.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL > $TRAVIS_BUILD_DIR/upgrade390400-2.log php step5.php 3.9.0 4.0.0 > $TRAVIS_BUILD_DIR/upgrade390400-3.log cd - set +e diff --git a/ChangeLog b/ChangeLog index 21d3ebc66b3..e3d40f3a04c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,8 +15,134 @@ make a Dolibarr upgrade. ***** ChangeLog for 4.0 compared to 3.9.* ***** For users: +NEW: Add reccuring invoice feature and automatic generation of invoices. +NEW: Add module "Loan" as stable. +NEW: Add module "Supplier commercial proposal" (price request) is set to stable status. +NEW: Experimental module Accountancy Expert +NEW: Experimental module Multicurency +NEW: Show into badge on tab head the number of dedicated contacts for all objects. +NEW: Add a checkbox to select/unselect all lines on page that support mass actions (like invoice list page) +NEW: Add a new method for margin calculation. Added margin on "cost price" to margin on WAP price and margin on "best supplier price". +NEW: Add an explanation message on shipment page to explain you can't make shipment if order is not validated +NEW: Add date_rum into table of thirdparty bank account. +NEW: The probability of lead/opportunity can be defined per lead. +NEW: Added Malta VAT into migration script +NEW: #4972 Translated Charges sociales (type 0) and Charges sociales (type 1) in reports page +NEW: Add Expense report into accountancy report +NEW: Add Expense report to approve into workboard +NEW: Selection of boxes is move on top of home page +NEW: Add filter on a keyword, status and nature into list of modules +NEW: Add hidden option BANK_DISABLE_CHECK_DEPOSIT to disable check deposit feature. +NEW: Add option MAIN_PUBLIC_NOTE_IN_ADDRESS +NEW: add html id/class to locate value in the DOM html +NEW: Add index on invoice status +NEW: Add constant MAIN_LOGTOHTML to 0 into other setup by default to save time when we need to make debug on hosted instance. +NEW: Add list of billed +NEW: Add minimum stock and desired stock into import/export profiles. +NEW: Add state into thirdparty export fields +NEW: Add more trackable events (create, submit and receive supplier order). +NEW: Add option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN +NEW: Add picto on module list to show warning and if module is an external module. +NEW: add product type filter on turnover report +NEW: Add state into list of fields available for personalized fields of thirdparties +NEW: Add statistics for interventions module +NEW: Add statistics on number of projets on home page +NEW: Add stats and late records into dashboard for supplier proposals. +NEW: Add the admin info on combo of type of contact +NEW: Add the event BILL_PAYED to list of supported events for module notification. +NEW: Add total weight and volume on PDF +NEW: Add hidden option to hide column qty ordered on shipments. +NEW: Add view of virtual stock into product list (when appropriate) +NEW: Add warning on tasks when they are late (add also the warning tolerance parameter) +NEW: Add weight/volume for one product into shipment export +NEW: Add width and height on product card +NEW: allow a document to be linked to project from another customer on config +NEW: allow project to be shared across entities (for multicompany module) +NEW: All variant of ckeditor config can be tested into the setup page of module. +NEW: Can change dynamically number of records visible into lists. +NEW: Can change type of extrafields for some combinations. +NEW: Can define number of first and last line into import wizard. +NEW: Can edit next execution date of a cron job. +NEW: Can edit value date of a vat payment after recording it. +NEW: Can filter modules on publisher +NEW: Can filter on employee status when building emailing from users +NEW: Can reopen an closed shipment +NEW: Can search on shipments into the quick search box +NEW: Can select dynamicaly number of lines to show on page on product, shipment, contact, orders, thirdparties +NEW: Can select fields to show on supplier orders list. +NEW: Can select fields to show on list also for list of customer orders, shipments and invoices. +NEW: Can select fields to show on proposal lists. +NEW: Can select language from combo list on page to overwrite a translation +NEW: Can select number of lines on page list for projects and tasks. +NEW: Can use ^ and $ (to say start with or end with like regex syntax) into search fields when search field is text. Bonus: ^$ can filter all lines with field not defined. +NEW: Clean and enhance code for cron engine +NEW: Can decrease stock on shipment closing/classifying (only if module lot is not enabled for the moment) +NEW: Disabled users are striked. +NEW: Enhance navigation of project module +NEW: fichinter lines ordered by rang AND DATE +NEW: hidden conf to use input file multiple from mail form +NEW: hidden feature: SUPPLIERORDER_WITH_NOPRICEDEFINED allow supplier order even if no supplier price defined +NEW: Hidden option MAIN_LANDING_PAGE to choose the first page to show after login works as a "global" option (llx_const) and as a "per user" option (llx_user_param). +NEW: Holiday is a now a RH module. All RH module provides by default visilibity on users of its hierarchy. +NEW: If error is reported during migration process, you can ignore it to avoid to be locked. +NEW: if nb total of lines provided in print barre_liste, display in title +NEW: If option to see non stable modules is on, add a filter into module list to filter on level (deprecated, experimental, development) +NEW: Include number of linked files into badge counter of "Linked files" tab. +NEW: Include sales representative into export of thirdparties +NEW: Indicator on workboard are red/green if late or not. +NEW: Into GED module, filename is truncated only if there is not enough space into table +NEW: Introduce a predefined job to run database backup +NEW: Introduce option MAIN_WEIGHT_DEFAULT_UNIT and MAIN_VOLUME_DEFAULT_UNIT to force output unit for weight and volume. +NEW: Introduce position of records into dictionnary of type of contacts +NEW: Link on user in leave context reach to leave tab. +NEW: List of user in agenda view per user show photo thumb +NEW: Margins module - Check/update buying price on invoice lines +NEW: Merge all admin tools (system and module admin tools) into same entry "Admin tools", so now things are clear: All features restricted to an admin user is inside "setup" (for setup) or "admin tools" (for action tools) instead of 3 different entries. +NEW: Merge all boxes "related objects" into one. This save a lot of room on most card and avoid often horizontal scoll. +NEW: Moved code that deals with bank categories to BankCateg. Created BankCateg::fetchAll function +NEW: Move Expense report menu from module to menu files +NEW: Move HRM dictionary from module to core dictionaries +NEW: Mutualize code to manage email substitution variables. Show available variables into page to edit email templates. +NEW: Mutualize code: Use one call of function "addThumbs", when possible, to generate thumbs files instead of several call of "vignette" function. +NEW: On translation admin page, admin can overwrite a translation value. +NEW: Option MAIN_LIST_FILTER_ON_DAY is supported on proposal list +NEW: Add reputation field for price supplier +NEW: Rest API token is no more reset at each call. We can reset it with param reset=1 on login call. +NEW: Selection of fields is available on member list. +NEW: Show a badge with number of withdraw requests done on the withdraw tab of invoice. +NEW: Add option to show detail per warehouse into reassort +NEW: Show total number of modules into the module list +NEW: Survey system has now a status like other objects. You can close or reopen a survey. +NEW: The note on time spent can be entered when using the view per day. +NEW: Use ellipsis truncation on too large left menu text +NEW: When a new field to show into lists is selected, the form is automatically submited and field added. +NEW: When creating a template invoice from a draft invoice, if there is link to contract on draft invoice, link is kept on template invoice. +NEW: When emailing is not sent completely, show progression. + For developers: +NEW: Add a css class style called 'reposition', so when clicking on a link with this class will move scrollbarr to be placed at same page location. +NEW: TimeZone can be supplied to mktime +NEW: hook in shipment card +NEW: Deprecated Societe::set_prospect_level, Societe::set_commnucation_level, Societe::set_OutstandingBill functions +NEW: A module can add, into its import profiles, a sql request to execute at end of import. This allow to update dernormalized data after import. +NEW: Add hook pdf_build_address +NEW: Add a parameter on graph function to show a generic graph when no data are available. +NEW: Add $object in parameter of pdf_build_address so we could include hook into the function. +NEW: Add a tool for developers to purge database with no loose of setup +NEW: Can disable a module by renaming dir of module into module.disabled (this save time for maintenance when working with FTP). +NEW: Created AccountLine::insert function and started using it for transaction creation +NEW: Created Account::__toString, Account::getFieldsToShow and Account::getAccountNumberOrder to refactor the way account number was shown +NEW: Created FormBank::getIBANLabel function to get the label of "IBAN" depending on bank account country +NEW: prepare for additional warehouse statuses +NEW: project sharing in select_projetcs_list function +NEW: Removed deprecated CommonObject::client property. Please use CommonObject::thirdparty instead +NEW: Removed unused FormOrder::selectSourcesCommande function +NEW: Renamed ActionComm::add function to ActionComm::create +NEW: Rename Form::select_date to Form::selectDate and Form::form_date to Form::formDate +NEW: Rename path for generiN +NEW: More phpunit tests. Include some REST API into automatic tests. + WARNING: @@ -35,6 +161,48 @@ So if you included it into your module, change your code like this to be compati if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; + + +***** ChangeLog for 3.9.2 compared to 3.9.1 ***** +FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN +FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists +FIX: #5236 Cron module activated but "Modules tools" does not appear in the left menu. +FIX: Accountancy - 3.9 - Chart of accounts are limited on only one country +FIX: bug on email template +FIX: Can't create a stock transfer from product card +FIX: can't fetch by siret or siren because of first "if" +FIX: Check stock of product by warehouse if $entrepot_id defined on shippings +FIX: Compatible with multicompany +FIX: Creation of the second ressource type fails. +FIX: end of select when no fournprice +FIX: Filter on assigned to was preselected on current user on list "All events" (instead of no filtering) +FIX: Filter on category tag for suppliers +FIX: hook on group card called but not initialized +FIX: Infinite loop on menu tree output for edition +FIX: Can show tree of entries added by external modules using fk_mainmenu and fk_leftmenu instead of fk_menu. +FIX: init var at wrong place report incorrect "shippable" flag on draft order. +FIX: It doesn't check if there is enough stock to update the lines of orders/invoices +FIX: Menu statistics was not visible if module proposal was not enabled +FIX: Merge manually PR #5161 - Bad translation key +FIX: missing column when module was installed before standard integration +FIX: Missing number total of modules +FIX: Not filtering correctly when coming from dashboard +FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH +FIX: Remove PHP Warning: Creating default object from empty value. +FIX: same page added several times on mergepropal option +FIX: search on date into supplier invoice list dont work because of status -1 +FIX: Search supplier ref on contract +FIX: Split of credit note into discount page generates records not correctly recognised as credit note. +FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty +FIX: #5087 +FIX: #5108 +FIX: #5163 +FIX: #5195 +FIX: #5203 +FIX: #5207 +FIX: #5209 +FIX: #5230 + ***** ChangeLog for 3.9.1 compared to 3.9.* ***** FIX: #3815 Call to undefined function local_by_date() FIX: #4424 Missing email of user popup in supplier orders area diff --git a/README.md b/README.md index 8758ff8fc77..a3a542b194e 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,7 @@ Administrator, user, developer and translator's documentations are available alo ## CONTRIBUTING -See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/CONTRIBUTING.md) +See file [CONTRIBUTING](https://github.com/Dolibarr/dolibarr/blob/develop/.github/CONTRIBUTING.md) ## CREDITS diff --git a/build/debian/apache/.htaccess b/build/debian/apache/.htaccess index a59829d970b..3c3d2e02683 100644 --- a/build/debian/apache/.htaccess +++ b/build/debian/apache/.htaccess @@ -5,4 +5,17 @@ Require all denied Order deny, allow Denied from all - \ No newline at end of file + + + +# OPTIMIZE: To use cache on static pages (A259200 = 1 month, A7200 = 2 hours, A691600 = 8 days = recommanded for static resources). +# Note that you must also enable the module mod_expires. +#ExpiresActive On +#ExpiresByType image/x-icon A2592000 +#ExpiresByType image/gif A2592000 +#ExpiresByType image/png A2592000 +#ExpiresByType image/jpeg A2592000 +#ExpiresByType text/css A2592000 +#ExpiresByType text/javascript A2592000 +#ExpiresByType application/x-javascript A2592000 +#ExpiresByType application/javascript A2592000 diff --git a/build/exe/doliwamp/httpd.conf.install b/build/exe/doliwamp/httpd.conf.install index 64aff6d42a2..bfe17b07d42 100644 --- a/build/exe/doliwamp/httpd.conf.install +++ b/build/exe/doliwamp/httpd.conf.install @@ -745,7 +745,7 @@ SSLCertificateKeyFile "WAMPROOT/myserver.key" # You can also set this with constant MAIN_OPTIMIZE_SPEED and bit 2 set. #TODO -# OPTIMIZE: To use cache on static pages (A259200 = 1 month). +# OPTIMIZE: To use cache on static pages (A259200 = 1 month, A7200 = 2 hours, A691600 = 8 days = recommanded for static resources). # Note that you must also enable the module mod_expires. #ExpiresActive On #ExpiresByType image/x-icon A2592000 diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index b4a13badbf4..76a290708a9 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -9,7 +9,8 @@ beta version of Dolibarr, step by step. - Check all files are commited. - Update version/info in ChangeLog. -To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" - Update version number with x.y.z-w in htdocs/filefunc.inc.php - Commit all changes. @@ -31,7 +32,8 @@ complete release of Dolibarr, step by step. - Check all files are commited. - Update version/info in ChangeLog. -To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git rev-list --boundary x.y..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" - Update version number with x.y.z in htdocs/filefunc.inc.php - Commit all changes. diff --git a/dev/fixdosfiles.sh b/dev/fixdosfiles.sh index ae04977d624..d6b9555efa6 100755 --- a/dev/fixdosfiles.sh +++ b/dev/fixdosfiles.sh @@ -17,14 +17,14 @@ fi # To detec if [ "x$1" = "xlist" ] then - find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF -# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF + find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF +# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF fi # To convert if [ "x$1" = "xfix" ] then - for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` + for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.sql" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' ` do echo "Fix file $fic" dos2unix "$fic" diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 5eb92509eb1..562ede506f4 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -85,7 +85,7 @@ if ($web) echo ""; } -echo "If you call this file with the argument \"?unused=true\" it searches for the translation strings that exist in en_US but are never used.\n"; +echo "If you call this with argument \"unused=true\" it searches for the translation strings that exist in en_US but are never used.\n"; if ($web) print "
"; echo "IMPORTANT: that can take quite a lot of time (up to 10 minutes), you need to tune the max_execution_time on your php.ini accordingly.\n"; if ($web) print "
"; @@ -96,10 +96,11 @@ if ($web) print "
"; // directory containing the php and lang files -$htdocs = $path."/../../htdocs/"; +$htdocs = $path."../../htdocs/"; +$scripts = $path."../../scripts/"; // directory containing the english lang files -$workdir = $htdocs."langs/en_US/"; +$workdir = $htdocs."langs/en_US/"; $files = scandir($workdir); @@ -109,8 +110,14 @@ if (empty($files)) exit; } +$dups=array(); $exludefiles = array('.','..','README'); $files = array_diff($files,$exludefiles); +// To force a file: $files=array('myfile.lang'); +if (isset($argv[2])) +{ + $files = array($argv[2]); +} $langstrings_3d = array(); $langstrings_full = array(); foreach ($files AS $file) { @@ -127,7 +134,7 @@ foreach ($files AS $file) { $langstrings_3d[$path_file['basename']][$line+1]=$row_array[0]; $langstrings_3dtrans[$path_file['basename']][$line+1]=$row_array[1]; $langstrings_full[]=$row_array[0]; - $langstrings_dist[$row_array[0]]=$row_array[0]; + $langstrings_dist[$row_array[0]]=$row; } } } @@ -241,26 +248,115 @@ if ($web) // STEP 2 - Search key not used - -if (! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') +if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true')) { - foreach ($langstrings_dist AS $value) + print "***** Strings in en_US that are never used:\n"; + + $unused=array(); + foreach ($langstrings_dist AS $value => $line) { - $search = '\'trans("'.$value.'")\''; - $string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'*'; + $qualifiedforclean=1; + // Check if we must keep this key to be into file for removal + if (preg_match('/^Module\d+/', $value)) $qualifiedforclean=0; + if (preg_match('/^Permission\d+/', $value)) $qualifiedforclean=0; + if (preg_match('/^PermissionAdvanced\d+/', $value)) $qualifiedforclean=0; + if (preg_match('/^ProfId\d+/', $value)) $qualifiedforclean=0; + if (preg_match('/^Delays_/', $value)) $qualifiedforclean=0; + if (preg_match('/^BarcodeDesc/', $value)) $qualifiedforclean=0; + if (preg_match('/^Extrafield/', $value)) $qualifiedforclean=0; + if (preg_match('/^LocalTax/', $value)) $qualifiedforclean=0; + if (preg_match('/^Country/', $value)) $qualifiedforclean=0; + if (preg_match('/^Civility/', $value)) $qualifiedforclean=0; + if (preg_match('/^Currency/', $value)) $qualifiedforclean=0; + if (preg_match('/^DemandReasonTypeSRC/', $value)) $qualifiedforclean=0; + if (preg_match('/^PaperFormat/', $value)) $qualifiedforclean=0; + if (preg_match('/^Duration/', $value)) $qualifiedforclean=0; + if (preg_match('/^AmountLT/', $value)) $qualifiedforclean=0; + if (preg_match('/^TotalLT/', $value)) $qualifiedforclean=0; + if (preg_match('/^Month/', $value)) $qualifiedforclean=0; + if (preg_match('/^MonthShort/', $value)) $qualifiedforclean=0; + if (preg_match('/^Day\d/', $value)) $qualifiedforclean=0; + if (preg_match('/^Short/', $value)) $qualifiedforclean=0; + if (preg_match('/^ExportDataset_/', $value)) $qualifiedforclean=0; + if (preg_match('/^ImportDataset_/', $value)) $qualifiedforclean=0; + if (preg_match('/^ActionAC_/', $value)) $qualifiedforclean=0; + if (preg_match('/^TypeLocaltax/', $value)) $qualifiedforclean=0; + if (preg_match('/^StatusProspect/', $value)) $qualifiedforclean=0; + if (preg_match('/^PL_/', $value)) $qualifiedforclean=0; + if (preg_match('/^TE_/', $value)) $qualifiedforclean=0; + if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0; + if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0; + if (preg_match('/^newLT/', $value)) $qualifiedforclean=0; + if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0; + if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0; + if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0; + if (preg_match('/^Language_/', $value)) $qualifiedforclean=0; + if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0; + // main.lang + if (preg_match('/^Duration/', $value)) $qualifiedforclean=0; + if (preg_match('/^FormatDate/', $value)) $qualifiedforclean=0; + if (preg_match('/^DateFormat/', $value)) $qualifiedforclean=0; + if (preg_match('/^.b$/', $value)) $qualifiedforclean=0; + if (preg_match('/^.*Bytes$/', $value)) $qualifiedforclean=0; + if (preg_match('/^(DoTest|Under|Limits|Cards|CurrentValue|DateLimit|DateAndHour|NbOfLines|NbOfObjects|NbOfReferes|TotalTTCShort|VATs)/', $value)) $qualifiedforclean=0; + // orders + if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0; + if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0; + // other.lang + if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0; + if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0; + if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0; + if (preg_match('/^WeightUnit/', $value)) $qualifiedforclean=0; + if (preg_match('/^LengthUnit/', $value)) $qualifiedforclean=0; + if (preg_match('/^SurfaceUnit/', $value)) $qualifiedforclean=0; + if (preg_match('/^VolumeUnit/', $value)) $qualifiedforclean=0; + if (preg_match('/^SizeUnit/', $value)) $qualifiedforclean=0; + if (preg_match('/^EMailText/', $value)) $qualifiedforclean=0; + if (preg_match('/ById$/', $value)) $qualifiedforclean=0; + if (preg_match('/ByLogin$/', $value)) $qualifiedforclean=0; + // products + if (preg_match('/GlobalVariableUpdaterType$/', $value)) $qualifiedforclean=0; + if (preg_match('/GlobalVariableUpdaterHelp$/', $value)) $qualifiedforclean=0; + if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0; + if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0; + + if (preg_match('/sms/i', $value)) $qualifiedforclean=0; + if (preg_match('/TF_/i', $value)) $qualifiedforclean=0; + if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0; + if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0; + + if (! $qualifiedforclean) + { + continue; + } + + //$search = '\'trans("'.$value.'")\''; + $search = '-e "\''.$value.'\'" -e \'"'.$value.'"\' -e "('.$value.')"'; + $string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'* '.$scripts.'*'; + //print $string."
\n"; exec($string,$output); if (empty($output)) { - $unused[$value] = true; - echo $value.'
'; + $unused[$value] = $line; + echo $line; // $trad contains the \n + } + else + { + unset($output); + //print 'X'.$output.'Y'; } } - if ($web) print "

\n"; - print "Strings in en_US that are never used\n"; - if ($web) print "

\n"; - if ($web) echo "
";
-	print_r($unused);
-	if ($web) echo "
\n"; + if (empty($unused)) print "No string not used found.\n"; + else + { + $filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang'; + print "Strings in en_US that are never used are saved into file ".$filetosave.":\n"; + file_put_contents($filetosave, join("",$unused)); + print "To remove from original file, run command :\n"; + if (($argv[2]?$argv[2]:"")) print 'cd htdocs/langs/en_US; mv '.($argv[2]?$argv[2]:"")." ".($argv[2]?$argv[2]:"").".tmp; "; + print "diff ".($argv[2]?$argv[2]:"").".tmp ".$filetosave." | grep \< | cut -b 3- > ".($argv[2]?$argv[2]:""); + if (($argv[2]?$argv[2]:"")) print "; rm ".($argv[2]?$argv[2]:"").".tmp;\n"; + } } echo "\n"; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index f0013632b53..b1836836e84 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -138,7 +138,7 @@ if ($action == 'display' || $action == 'delete') { if(!empty($obj)){ foreach ( $obj as $cpt ) { $var = ! $var; - print ""; + print ''; print '' . length_accountg($cpt->account_number) . ''; print '' . $cpt->label . ''; print $form->formconfirm($_SERVER["PHP_SELF"]."?account_category=$cat_id&cptid=".$cpt->rowid, $langs->trans("DeleteCptCategory"), $langs->trans("ConfirmDeleteCptCategory"), "delete", '', 0, "action-delete".$j); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 00cf70b9e73..638e9794fe8 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2016 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,12 +42,15 @@ if (! $sortorder) $sortorder="ASC"; $langs->load("admin"); $langs->load("compta"); -if (! $user->admin) +// Security check +if ($user->societe_id > 0) + accessforbidden(); +if (! $user->rights->accounting->fiscalyear) accessforbidden(); $error = 0; -// List of statut +// List of status static $tmpstatut2label = array ( '0' => 'OpenFiscalYear', '1' => 'CloseFiscalYear' @@ -132,7 +135,7 @@ if ($result) { $i ++; } } else { - print '' . $langs->trans("None") . ''; + print '' . $langs->trans("None") . ''; } print ''; diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 0dc560aa62e..720f3a4f012 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -138,7 +138,7 @@ if ($result) { while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; - print ""; + print ''; print ''; print $objp->accounting; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 80ed3f6fb47..63060e1ed60 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -328,10 +328,10 @@ if ($result) { $product_static = new Product($db); - print ""; + print ''; print ""; - print ""; + print ''; // Ref produit as link $product_static->ref = $obj->ref; $product_static->id = $obj->rowid; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index e89799d765e..736aec48644 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -223,7 +223,7 @@ else { if(empty($description)){ $link = '' . img_edit_add() .''; } - print ""; + print ''; print '' . length_accountg($line->numero_compte) . ''; print '' . $description . ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 5421a4a350d..7293797ecc6 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -346,7 +346,7 @@ if ($action == 'create') { foreach ( $book->linesmvt as $line ) { $var = ! $var; - print ""; + print ''; $total_debit += $line->debit; $total_credit += $line->credit; @@ -400,7 +400,7 @@ if ($action == 'create') { if ($action == "" || $action == 'add') { $var = ! $var; - print ""; + print ''; print ''; print $formventilation->select_account($account_number, 'account_number', 0, array (), 1, 1, ''); print ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 557143164a9..cb5d7caf006 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -368,7 +368,7 @@ foreach ( $object->lines as $line ) { $total_debit += $line->debit; $total_credit += $line->credit; - print ""; + print ''; print '' . $line->piece_num . ''; print '' . dol_print_date($line->doc_date, 'day') . ''; diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index 10640c1887a..23eeb79621a 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -269,7 +269,7 @@ $var = True; foreach ( $object->lines as $line ) { $var = ! $var; - print ""; + print ''; print '' . $line->piece_num . '' . "\n"; print '' . $line->doc_type . '' . "\n"; print '' . dol_print_date($line->doc_date) . ''; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 64825d62cbb..d5f913ae0dd 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -184,6 +184,8 @@ print '' . $langs->trans("NovemberMin") . ''; print '' . $langs->trans("DecemberMin") . ''; print '' . $langs->trans("Total") . ''; + +//TODO : Cannot work with PGSQL !, Change that with php treatment rather than big SQL query $sql = "SELECT IF(aa.account_number IS NULL, 'Non pointe', aa.account_number) AS 'code comptable',"; $sql .= " IF(aa.label IS NULL, 'Non pointe', aa.label) AS 'Intitulé',"; $sql .= " ROUND(SUM(IF(MONTH(f.datef)=1,fd.total_ht,0)),2) AS 'Janvier',"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 292b52b5863..3549651cbd6 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -288,7 +288,7 @@ if ($result) { $var = ! $var; $codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte; - print ""; + print ''; // Ref Invoice $facture_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 438eb30c621..167f558d830 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -302,7 +302,7 @@ if ($result) { if ($objp->code_sell_l != $objp->code_sell_p) $code_sell_p_l_differ = 'color:red'; - print ""; + print ''; // Ref Invoice $facture_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/report/result.php b/htdocs/accountancy/report/result.php index 48d587b575b..72a4d6e96b2 100644 --- a/htdocs/accountancy/report/result.php +++ b/htdocs/accountancy/report/result.php @@ -127,7 +127,7 @@ if(!empty($cats)) $resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); $sommes[$code]['NP'] += $resultNP; $sommes[$code]['N'] += $resultN; - print ""; + print ''; print '' . $cpt['account_number'] . ''; print '' . $cpt['name_cpt'] . ''; print '' . price($resultNP) . ''; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 6ab2cf589a6..a0b2365350f 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -236,7 +236,7 @@ if ($result) { $var = ! $var; $codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label; - print ""; + print ''; // Ref Invoice $facturefournisseur_static->ref = $objp->facnumber; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 8685cb7d5d4..c98ba050222 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -314,7 +314,7 @@ if ($result) { if ($objp->code_buy_l != $objp->code_buy_p) $code_buy_p_l_differ = 'color:red'; - print ""; + print ''; // Ref Invoice $facturefourn_static->ref = $objp->ref; diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php index 6f5d1de5c87..a23c1f40def 100644 --- a/htdocs/adherents/admin/public.php +++ b/htdocs/adherents/admin/public.php @@ -200,7 +200,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled)) print ''; print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL"); print ''; - print ''; + print ''; print "\n"; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 66de3be2cc5..49048cfaf1f 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Marcos García - * Copyright (C) 2012-2015 Philippe Grand + * Copyright (C) 2012-2016 Philippe Grand * Copyright (C) 2015 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify @@ -94,7 +94,7 @@ if ($rowid > 0) // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { - // $user est le user qui edite, $object->user_id est l'id de l'utilisateur lies au membre edite + // $ User is the user who edits, $ object->user_id is the id of the related user in the edited member $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer) || (($user->id != $object->user_id) && $user->rights->user->user->creer)); $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password) @@ -209,7 +209,7 @@ if (empty($reshook)) { if ($result > 0) { - // Creation user + // User creation $company = new Societe($db); $result=$company->create_from_member($object,GETPOST('companyname')); @@ -253,7 +253,8 @@ if (empty($reshook)) } $lastname=$_POST["lastname"]; $firstname=$_POST["firstname"]; - $morphy=$morphy=$_POST["morphy"]; + $morphy=$_POST["morphy"]; + $login=$_POST["login"]; if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); @@ -264,7 +265,19 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); } - + if ($morphy == 'mor' && empty($societe)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); + } + // Test si le login existe deja + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) + { + if (empty($login)) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors'); + } + } // Create new object if ($result > 0 && ! $error) { @@ -482,7 +495,7 @@ if (empty($reshook)) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors'); } - // Test si le login existe deja + // Tests if the login already exists if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($login)) { @@ -506,6 +519,11 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors'); } } + if ($morphy == 'mor' && empty($societe)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); + } if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); @@ -532,11 +550,11 @@ if (empty($reshook)) { $db->begin(); - // Email a peu pres correct et le login n'existe pas + // Email about right and login does not exist $result=$object->create($user); if ($result > 0) { - // Categories association + // Foundation categories $memcats = GETPOST('memcats', 'array'); $object->setCategories($memcats); @@ -597,7 +615,7 @@ if (empty($reshook)) if ($result >= 0 && ! count($object->errors)) { - // Send confirmation Email (selon param du type adherent sinon generique) + // Send confirmation email (according to parameters of member type. Otherwise generic) if ($object->email && GETPOST("send_mail")) { $result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2); @@ -846,7 +864,7 @@ else // Address print ''.$langs->trans("Address").''; - print ''; + print ''; print ''; // Zip / Town @@ -1107,7 +1125,7 @@ else // Address print ''.$langs->trans("Address").''; - print ''; + print ''; print ''; // Zip / Town @@ -1361,7 +1379,7 @@ else $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; $label=$form->textwithpicto($tmp,$helpcontent,1,'help'); - // Cree un tableau formulaire + // Create an array $formquestion=array(); if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); @@ -1549,12 +1567,12 @@ else if (! $adht->cotisation) { print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } else { print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie + if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } } print ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 93b013cd29f..87ceb66f9d1 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1737,7 +1737,7 @@ class Adherent extends CommonObject $response = new WorkboardResponse(); $response->warning_delay=$conf->adherent->cotisation->warning_delay/60/60/24; $response->label=$langs->trans("MembersWithSubscriptionToReceive"); - $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1'; + $response->url=DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; $response->img=img_object($langs->trans("Members"),"user"); $adherentstatic = new Adherent($this->db); @@ -2006,14 +2006,18 @@ class Adherent extends CommonObject return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); } + /** + * Return if a member is late (subscription late) or not + * + * @return boolean True if late, False if not late + */ public function hasDelay() { global $conf; //Only valid members - if ($this->statut <= 0) { - return false; - } + if ($this->statut <= 0) return false; + if (! $this->datefin) return false; $now = dol_now(); diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index d0f8206f269..2e4f4b1994f 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -128,9 +128,10 @@ if ($result) if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($statut != '') $param.="&statut=".$statut; if ($date_select) $param.="&date_select=".$date_select; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($search_lastname) $param.="&search_lastname=".$search_lastname; if ($search_login) $param.="&search_login=".$search_login; if ($search_acount) $param.="&search_account=".$search_account; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 4d9a779d579..a5f61a45642 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -191,12 +191,12 @@ if ($result > 0) } else { - $records=$ldap->getAttribute($dn,$search); + $records = $ldap->getAttribute($dn,$search); //print_r($records); // Affichage arbre - if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) + if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 83ceea04698..6acdd1e56b7 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -176,7 +176,7 @@ print ''.$langs->trans("AmountAverage").''; print ''; $oldyear=0; -$var=false; +$var=true; foreach ($data as $val) { $year = $val['year']; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 9e55369dac9..c91c2fb8c75 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -166,8 +166,8 @@ else if ($action == 'setdoc') { if (dolibarr_set_const($db, "COMMANDE_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 + // The constant that was read before the new set + // We therefore requires a variable to have a coherent view $conf->global->COMMANDE_ADDON_PDF = $value; } @@ -181,8 +181,8 @@ else if ($action == 'setdoc') else if ($action == 'setmod') { - // TODO Verifier si module numerotation choisi peut etre active - // par appel methode canBeActivated + // TODO Check if numbering module chosen can be activated + // by calling method canBeActivated dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity); } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index ee6cbac057f..cb79e6ff401 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -314,7 +314,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; - print ''."\n"; + print ''."\n"; $var=!$var; print ''; diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 14332ceee63..41b2f489904 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -41,6 +41,10 @@ $modules=array( ) ), 'projet' => array( + array( + 'code' => 'MAIN_DELAY_PROJECT_TO_CLOSE', + 'img' => 'project' + ), array( 'code' => 'MAIN_DELAY_TASKS_TODO', 'img' => 'task' diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 1b7c67e40f9..3b7facc9dc8 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -42,7 +42,7 @@ if (! $user->admin) accessforbidden(); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); $label = GETPOST('label','alpha'); -$scandir = GETPOST('scandir','alpha'); +$scandir = GETPOST('scan_dir','alpha'); $type='invoice'; @@ -380,7 +380,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'switch_off').''; } print ''; @@ -566,7 +566,7 @@ foreach ($dirmodels as $reldir) else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"),'switch_off').''; print ""; } @@ -578,7 +578,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"),'off').''; } print ''; diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 5fc39432c8e..9209542a9c0 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -272,7 +272,7 @@ if ($action == 'create') '; print load_fiche_titre($langs->trans("NewMenu"),'','title_setup'); - + print '
'; print ''; @@ -284,7 +284,7 @@ if ($action == 'create') $parent_rowid = $_GET['menuId']; if ($_GET['menuId']) { - $sql = "SELECT m.rowid, m.mainmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId']; + $sql = "SELECT m.rowid, m.mainmenu, m.leftmenu, m.level, m.langs FROM ".MAIN_DB_PREFIX."menu as m WHERE m.rowid = ".$_GET['menuId']; $res = $db->query($sql); if ($res) { @@ -293,6 +293,7 @@ if ($action == 'create') { $parent_rowid = $menu['rowid']; $parent_mainmenu = $menu['mainmenu']; + $parent_leftmenu = $menu['leftmenu']; $parent_langs = $menu['langs']; $parent_level = $menu['level']; } @@ -343,7 +344,9 @@ if ($action == 'create') { print ''; } - print ''.$langs->trans('DetailMenuIdParent').''; + print ''.$langs->trans('DetailMenuIdParent'); + print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; + print ''; // Title print ''.$langs->trans('Title').''.$langs->trans('DetailTitre').''; @@ -423,9 +426,10 @@ elseif ($action == 'edit') // MenuId Parent print ''.$langs->trans('MenuIdParent').''; - print ''; - //$menu_handler - //print ''; + $valtouse=$menu->fk_menu; + if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; + if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; + print ''; print ''.$langs->trans('DetailMenuIdParent').''; // Niveau diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 28d8d353905..cba8d45c8f3 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -289,17 +289,18 @@ if ($conf->use_javascript_ajax) - la chaine a afficher ie: data[]= array (index, index parent, chaine ) */ + //il faut d'abord declarer un element racine de l'arbre - $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); - + $data[] = array('rowid'=>0,'fk_menu'=>-1,'title'=>"racine",'mainmenu'=>'','leftmenu'=>'','fk_mainmenu'=>'','fk_leftmenu'=>''); + //puis tous les elements enfants - $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu"; + $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module"; $sql.= " FROM ".MAIN_DB_PREFIX."menu as m"; $sql.= " WHERE menu_handler = '".$menu_handler_to_search."'"; $sql.= " AND entity = ".$conf->entity; - $sql.= " AND fk_menu >= 0"; + //$sql.= " AND fk_menu >= 0"; $sql.= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same) $res = $db->query($sql); @@ -314,9 +315,10 @@ if ($conf->use_javascript_ajax) $titre = $langs->trans($menu['titre']); $data[] = array( 'rowid'=>$menu['rowid'], + 'module'=>$menu['module'], 'fk_menu'=>$menu['fk_menu'], 'title'=>$titre, - 'mainmenu'=>$menu['mainmenu'], + 'mainmenu'=>$menu['mainmenu'], 'leftmenu'=>$menu['leftmenu'], 'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'], @@ -334,17 +336,54 @@ if ($conf->use_javascript_ajax) } } + global $tree_recur_alreadyadded; // This var was def into tree_recur + // Appelle de la fonction recursive (ammorce) // avec recherche depuis la racine. //var_dump($data); - tree_recur($data,$data[0],0); + tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine' + print ''; - + print ''; - + print ''; - + + + // Process remaining records (records that are not linked to root by any path) + $remainingdata = array(); + foreach($data as $datar) + { + if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) continue; + $remainingdata[] = $datar; + } + + if (count($remainingdata)) + { + print ''; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print ''; + + print ''; + + print '
'.$langs->trans("NotTopTreeMenuPersonalized").'
'; + + foreach($remainingdata as $datar) + { + $father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>''); + //print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'
'."\n"; + tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1); + } + + print '
'; + } print ''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 2dff436ffe6..1151ef4abb9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -605,7 +605,7 @@ if ($mode != 'marketplace') else $text.=$langs->trans("No"); $text.='
'.$langs->trans("AddMenus").': '; - if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu) + if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu)) { $text.=$langs->trans("Yes"); } diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index bd49265436d..530f3bff5b7 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -77,20 +77,20 @@ if (preg_match('/del_(.*)/',$action,$reg)) if ($action == 'add_currency') { - $code = GETPOST('code', 'alpha'); - $name = GETPOST('name', 'alpha'); - $rate = GETPOST('rate', 'alpha'); + $langs->loadCacheCurrencies(''); + $code = GETPOST('code', 'alpha'); + $rate = GETPOST('rate', 'alpha'); $currency = new MultiCurrency($db); $currency->code = $code; - $currency->name = $name; + $currency->name = !empty($langs->cache_currencies[$code]['label']) ? $langs->cache_currencies[$code]['label'].' ('.$langs->getCurrencySymbol($code).')' : $code; if ($currency->create($user) > 0) { if ($currency->addRate($rate)) setEventMessages($langs->trans('RecordSaved'), array()); else setEventMessages($langs->trans('ErrorAddRateFail'), array(), 'errors'); } - else setEventMessages($langs->trans('ErrorAddCurrencyFail'), array()); + else setEventMessages($langs->trans('ErrorAddCurrencyFail'), $currency->errors, 'errors'); } elseif ($action == 'update_currency') { @@ -182,6 +182,7 @@ print ''.$langs->trans("Parameters").''."\n"; print ' '; print ''.$langs->trans("Value").''."\n"; +/* TODO uncomment when the functionality will integrated $var=!$var; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_useRateOnInvoiceDate").''; @@ -194,6 +195,7 @@ print $form->selectyesno("MULTICURRENCY_USE_RATE_ON_INVOICE_DATE",$conf->global- print ''; print '
'; print ''; +*/ $var=!$var; print ''; @@ -208,6 +210,7 @@ print '' print ''; print ''; +/* TODO uncomment when the functionality will integrated $var=!$var; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").''; @@ -220,7 +223,9 @@ print $form->selectyesno("MULTICURRENCY_BUY_PRICE_IN_CURRENCY",$conf->global->MU print ''; print ''; print ''; +*/ +/* TODO uncomment when the functionality will integrated $var=!$var; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").''; @@ -234,71 +239,75 @@ print '' print ''; print ''; -print ''; -print '
'; - -$var=false; -print ''; -print ''; -print ''."\n"; -print ''; -print ''; - - -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -/* This property seems not used in code, so i comment it -$var=!$var; -print ''; -print ''; -print ''; -print ''; - -$var=!$var; -print ''; -print ''; -print ''; -print ''; */ print '
'.$langs->trans("CurrencyLayerAccount").' '; -print '
'; -print ''; -print ''; -print $langs->trans("Value").' '; -print '
'; -print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").' '; -print '
'; -print ''; -print ''; -print ' '; -print ''; -print '
'; -print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").' '; -print '
'; -print ''; -print ''; -print ' '; // Default: USD -print ''; -print '
'; -print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").' '; -print '
'; -print ''; -print ''; -print ' '; // Example: EUR -print ''; -print '
'; -print '
'; print '
'; +if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) +{ + $var=false; + print ''; + print ''; + print ''."\n"; + print ''; + print ''; + + + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + $var=!$var; + print ''; + print ''; + print ''; + print ''; + + print '
'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).' '; + print '
'; + print ''; + print ''; + print $langs->trans("Value").' '; + print '
'; + print '
'.$langs->transnoentitiesnoconv("multicurrency_appId").' '; + print '
'; + print ''; + print ''; + print ' '; + print ''; + print '
'; + print '
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").' '; + print '
'; + print ''; + print ''; + print ' '; // Default: USD + print ''; + print '
'; + print '
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").' '; + print '
'; + print ''; + print ''; + print ' '; // Example: EUR + print ''; + print '
'; + print '
'; + print '
'; +} + + print ''; print ''; -print ''."\n"; +print ''."\n"; print ''; print ''."\n"; @@ -307,7 +316,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print ''; print ''; // Api Name $label = $langs->trans($key[0]); - print ''; + print ''; + print ''; + print ''; if ($supported) { diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 87fce1f6087..b86023aa49a 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -377,7 +378,8 @@ if ($mode == 'template' && $user->admin) if ($ret > 0) { setEventMessages($printer->error, $printer->errors, 'errors'); } else { - for ($line=0; $line < count($printer->listprinterstemplates); $line++) { + $max = count($printer->listprinterstemplates); + for ($line=0; $line < $max; $line++) { $var = !$var; print ''; if ($action=='edittemplate' && $printer->listprinterstemplates[$line]['rowid']==$templateid) { @@ -422,7 +424,8 @@ if ($mode == 'template' && $user->admin) print ''; print ''; print "\n"; - for ($tag=0; $tag < count($printer->tags); $tag++) { + $max = count($printer->tags); + for ($tag=0; $tag < $max; $tag++) { $var = !$var; print ''; print ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 98ff43360a8..b78bf1ce0bd 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -52,14 +52,17 @@ if($action) // Mode of stock decrease if ($action == 'STOCK_CALCULATE_ON_BILL' || $action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER' - || $action == 'STOCK_CALCULATE_ON_SHIPMENT') + || $action == 'STOCK_CALCULATE_ON_SHIPMENT' + || $action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE') { $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", '','chaine',0,'',$conf->entity); $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", '','chaine',0,'',$conf->entity); + $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", '','chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_BILL') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_BILL", GETPOST('STOCK_CALCULATE_ON_BILL','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_VALIDATE_ORDER') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_VALIDATE_ORDER", GETPOST('STOCK_CALCULATE_ON_VALIDATE_ORDER','alpha'),'chaine',0,'',$conf->entity); if ($action == 'STOCK_CALCULATE_ON_SHIPMENT') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT", GETPOST('STOCK_CALCULATE_ON_SHIPMENT','alpha'),'chaine',0,'',$conf->entity); + if ($action == 'STOCK_CALCULATE_ON_SHIPMENT_CLOSE') $res=dolibarr_set_const($db, "STOCK_CALCULATE_ON_SHIPMENT_CLOSE", GETPOST('STOCK_CALCULATE_ON_SHIPMENT_CLOSE','alpha'),'chaine',0,'',$conf->entity); } // Mode of stock increase if ($action == 'STOCK_CALCULATE_ON_SUPPLIER_BILL' @@ -203,6 +206,26 @@ else print "\n\n"; $found++; +$var=!$var; +print ""; +print ''; +print '\n\n"; +$found++; + /*if (! $found) { $var=!$var; @@ -290,13 +313,13 @@ $found++; { $var=!$var; print ""; - print ''; + print ''; print "\n"; }*/ print '
'.$langs->trans("Currencies").''.$form->textwithpicto($langs->trans("CurrenciesUsed"), $langs->transnoentitiesnoconv("CurrenciesUsed_help_to_add")).' '.$langs->trans("Rate").'
- '.$form->selectCurrency('', 'code').' '; print ' '; diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 2100230fdb4..02a5ffc50e8 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -138,6 +138,7 @@ $list = array ( 'OAUTH_GOOGLE_NAME', 'OAUTH_GOOGLE_ID', 'OAUTH_GOOGLE_SECRET', + 'OAUTH_GOOGLE_DESC', ), array( 'OAUTH_HUBIC_NAME', @@ -323,7 +324,11 @@ foreach ($list as $key) print '
'.$label.'
'.$label.''; + if (! empty($key[3])) print $langs->trans($key[3]); + print '
'.$langs->trans("Tag").''.$langs->trans("Description").'
<'.$printer->tags[$tag].'>'.$langs->trans(strtoupper($printer->tags[$tag])).'
'.$langs->trans("DeStockOnShipmentOnClosing").''; +if (! empty($conf->expedition->enabled)) +{ + print ""; + print ''; + print ""; + print $form->selectyesno("STOCK_CALCULATE_ON_SHIPMENT_CLOSE",$conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE,1,$disabled); + print ''; + print "\n"; +} +else +{ + print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); +} +print "
'.$langs->trans("NoModueToManageStockIncrease").''.$langs->trans("NoModuleToManageStockIncrease").'
'; -// Optio to force stock to be enough before adding a line into document +// Option to force stock to be enough before adding a line into document if ($conf->invoice->enabled || $conf->order->enabled || $conf->expedition->enabled) { print '
'; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 41737f7a9d5..bc960c7bd2c 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -1,5 +1,6 @@ + * Copyright (C) 2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,9 +17,9 @@ */ /** - * \file htdocs/admin/payment.php - * \ingroup facture - * \brief Page to setup invoices payments + * \file htdocs/admin/supplier_payment.php + * \ingroup supplier + * \brief Page to setup supplier invoices payments */ require '../main.inc.php'; @@ -30,6 +31,8 @@ $langs->load("admin"); $langs->load("errors"); $langs->load('other'); $langs->load('bills'); +$langs->load('orders'); + if (! $user->admin) accessforbidden(); @@ -80,16 +83,18 @@ $form=new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_setup'); -print "
"; +print "
"; $head = supplierorder_admin_prepare_head(); -dol_fiche_head($head, 'supplierpayment', $langs->trans("SupplierPayment"), 0, 'invoice'); +dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), 0, 'company'); /* * Numbering module */ -print load_fiche_titre($langs->trans("SupplierPaymentsNumberingModule")); +if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMENT_ADDON = 'mod_supplier_payment_bronan'; + +print load_fiche_titre($langs->trans("PaymentsNumberingModule")); print ''; print ''; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 9b7dfb76689..48eddfec155 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -104,7 +104,7 @@ if (file_exists($xmlfile)) } else { - print ''; + print ''; } print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'; @@ -136,7 +136,7 @@ if (file_exists($xmlfile)) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; } diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index 262b3f69476..53ff102e89b 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -43,7 +43,6 @@ if (empty($conf->global->MAIN_MODULE_API)) exit; } -use \Luracast\Restler\Defaults; $api = new DolibarrApi($db); diff --git a/htdocs/api/class/api_generic.class.php b/htdocs/api/class/api_generic.class.php index 038621b6235..9a630a9da47 100644 --- a/htdocs/api/class/api_generic.class.php +++ b/htdocs/api/class/api_generic.class.php @@ -15,9 +15,7 @@ * along with this program. If not, see . */ -use Luracast\Restler\Restler; use Luracast\Restler\RestException; -use Luracast\Restler\Defaults; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 2fbad04ecbb..660c90d3476 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -55,7 +55,6 @@ if (empty($conf->global->MAIN_MODULE_API)) exit; } -use \Luracast\Restler\Defaults; $api = new DolibarrApi($db); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 672ea7b6408..8e98e0014e8 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -167,9 +167,10 @@ class Categorie extends CommonObject * * @param int $id Id of category * @param string $label Label of category + * @param string $type Type of category * @return int <0 if KO, >0 if OK */ - function fetch($id,$label='') + function fetch($id,$label='',$type='') { global $conf; @@ -182,10 +183,10 @@ class Categorie extends CommonObject { $sql.= " WHERE rowid = '".$id."'"; } - else { - if ($label) $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category',1).")"; + $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category',1).")"; + if ($type) $sql.= " AND type = '".$this->db->escape($type)."'"; } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -255,9 +256,9 @@ class Categorie extends CommonObject if ($this->already_exists()) { - $this->error=$langs->trans("ImpossibleAddCat"); + $this->error=$langs->trans("ImpossibleAddCat", $this->label); $this->error.=" : ".$langs->trans("CategoryExistsAtSameLevel"); - dol_syslog($this->error, LOG_ERR); + dol_syslog($this->error, LOG_WARNING); return -4; } @@ -1272,11 +1273,11 @@ class Categorie extends CommonObject * Return list of categories (object instances or labels) linked to element of id $id and type $type * Should be named getListOfCategForObject * - * @param int $id Id of element - * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. - * @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category - * labels, 'id'= Get array of category IDs - * @return mixed Array of category objects or < 0 if KO + * @param int $id Id of element + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. + * @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category + * labels, 'id'= Get array of category IDs + * @return mixed Array of category objects or < 0 if KO */ function containing($id, $type, $mode='object') { @@ -1716,6 +1717,6 @@ class Categorie extends CommonObject 'categorie_societe' ); - return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables, 1); } } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index b9beb792ba6..09fda82223b 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -297,7 +297,7 @@ else } else { - print "'.$langs->trans("NoSubCat").""; + print "'.$langs->trans("NoSubCat").""; } print "\n"; } @@ -371,7 +371,7 @@ if ($object->type == Categorie::TYPE_PRODUCT) } else { - print "'.$langs->trans("ThisCategoryHasNoProduct").""; + print "'.$langs->trans("ThisCategoryHasNoProduct").""; } print "\n"; } @@ -422,7 +422,7 @@ if ($object->type == Categorie::TYPE_SUPPLIER) } else { - print "".$langs->trans("ThisCategoryHasNoSupplier").""; + print ''.$langs->trans("ThisCategoryHasNoSupplier").''; } print "\n"; } @@ -475,7 +475,7 @@ if($object->type == Categorie::TYPE_CUSTOMER) } else { - print "".$langs->trans("ThisCategoryHasNoCustomer").""; + print ''.$langs->trans("ThisCategoryHasNoCustomer").''; } print "\n"; } @@ -529,7 +529,7 @@ if ($object->type == Categorie::TYPE_MEMBER) } else { - print "'.$langs->trans("ThisCategoryHasNoMember").""; + print ''.$langs->trans("ThisCategoryHasNoMember").''; } print "\n"; } @@ -582,7 +582,7 @@ if($object->type == Categorie::TYPE_CONTACT) } else { - print "".$langs->trans("ThisCategoryHasNoContact").""; + print ''.$langs->trans("ThisCategoryHasNoContact").''; } print "\n"; } @@ -636,7 +636,7 @@ if ($object->type == Categorie::TYPE_ACCOUNT) } else { - print "'.$langs->trans("ThisCategoryHasNoAccount").""; + print ''.$langs->trans("ThisCategoryHasNoAccount").''; } print "\n"; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 7a2f231879d..4df296d19da 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1445,7 +1445,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; + print img_picto($langs->trans("ViewWeek"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' '; print ''."\n"; print '
'; print ''; @@ -1454,7 +1454,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; + print img_picto($langs->trans("ViewDay"),'object_calendarday','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print '
'; print ''; @@ -1463,7 +1463,7 @@ if ($id > 0) print ''; print ''; //print ''; - print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; + print img_picto($langs->trans("ViewPerUser"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' '; print '
'."\n"; print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c0e1f11579c..6b77e2414da 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -932,6 +932,7 @@ class ActionComm extends CommonObject $response->warning_delay = $conf->agenda->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); $response->url = DOL_URL_ROOT.'/comm/action/listactions.php?status=todo&mainmenu=agenda'; + if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1'; $response->img = img_object($langs->trans("Actions"),"action"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 29191fce68a..5306300e7b1 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2014 Cedric GROSS @@ -48,7 +48,7 @@ $filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filt $usergroup = GETPOST("usergroup","int",3); $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; -// If not choice done on calendar owner, we filter on user. +// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert=$user->id; @@ -78,7 +78,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per } $action=GETPOST('action','alpha'); -//$year=GETPOST("year"); +$resourceid=GETPOST("resourceid","int"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); @@ -292,6 +292,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtert) $param.="&filtert=".$filtert; @@ -349,7 +350,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup); +print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup,'', $resourceid); dol_fiche_end(); @@ -424,7 +425,7 @@ else // If javascript off $link.=''; } -print load_fiche_titre($s, $link.'     '.$nav, ''); +print load_fiche_titre($s, $link.'     '.$nav, '', 0, 0, 'tablelistofcalendars'); // Load events from database into $eventarray @@ -442,12 +443,15 @@ $sql.= ' a.fk_soc, a.fk_contact,'; $sql.= ' ca.code as type_code, ca.libelle as type_label'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; +// We must filter on resource table +if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r"; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code IN ('".implode("','", explode(',',$actioncode))."')"; +if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; @@ -933,7 +937,7 @@ if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($even -$maxnbofchar=18; +$maxnbofchar=0; $cachethirdparties=array(); $cachecontacts=array(); $cacheusers=array(); @@ -1238,20 +1242,20 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else { - $numother++; - $color=($event->icalcolor?$event->icalcolor:-1); - $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); - - if (empty($cacheusers[$event->userownerid])) - { - $newuser=new User($db); - $newuser->fetch($event->userownerid); - $cacheusers[$event->userownerid]=$newuser; - } - //var_dump($cacheusers[$event->userownerid]->color); - - // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) - if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; + $numother++; + $color=($event->icalcolor?$event->icalcolor:-1); + $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); + + if (empty($cacheusers[$event->userownerid])) + { + $newuser=new User($db); + $newuser->fetch($event->userownerid); + $cacheusers[$event->userownerid]=$newuser; + } + //var_dump($cacheusers[$event->userownerid]->color); + + // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) + if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; } if ($color == -1) // Color was not forced. Set color according to color index. { @@ -1268,7 +1272,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (! empty($theme_datacolor[$nextindextouse+1])) $nextindextouse++; // Prepare to use next color } //print '|'.($color).'='.($idusertouse?$idusertouse:0).'='.$colorindex.'
'; - // Define color + // Define color $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } $cssclass=$cssclass.' '.$cssclass.'_day_'.$ymd; @@ -1312,7 +1316,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa //if (! empty($event->transparency)) print 'background: #'.$color.'; background: -webkit-gradient(linear, left top, left bottom, from(#'.$color.'), to(#'.dol_color_minus($color,1).'));'; //else print 'background-color: transparent !important; background: none; border: 1px solid #bbb;'; print ' -moz-border-radius:4px;" width="100%">'; - print ''; + print ''; if ($event->type_code == 'BIRTHDAY') // It's a birthday { print $event->getNomUrl(1,$maxnbofchar,'cal_event','birthday','contact'); @@ -1393,8 +1397,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'ICALEVENT') print '
('.dol_trunc($event->icalname,$maxnbofchar).')'; // If action related to company / contact - $linerelatedto='';$length=16; - if (! empty($event->societe->id) && ! empty($event->contact->id)) $length=round($length/2); + $linerelatedto=''; if (! empty($event->societe->id) && $event->societe->id > 0) { if (! isset($cachethirdparties[$event->societe->id]) || ! is_object($cachethirdparties[$event->societe->id])) @@ -1404,7 +1407,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $cachethirdparties[$event->societe->id]=$thirdparty; } else $thirdparty=$cachethirdparties[$event->societe->id]; - if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',$length); + if (! empty($thirdparty->id)) $linerelatedto.=$thirdparty->getNomUrl(1,'',0); } if (! empty($event->contact->id) && $event->contact->id > 0) { @@ -1416,7 +1419,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } else $contact=$cachecontacts[$event->contact->id]; if ($linerelatedto) $linerelatedto.=' / '; - if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',$length); + if (! empty($contact->id)) $linerelatedto.=$contact->getNomUrl(1,'',0); } if ($linerelatedto) print '
'.$linerelatedto; } diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 1f597ffeddc..b927244821e 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -36,6 +36,7 @@ $langs->load("agenda"); $langs->load("commercial"); $action=GETPOST('action','alpha'); +$resourceid=GETPOST("resourceid","int"); $year=GETPOST("year",'int'); $month=GETPOST("month",'int'); $day=GETPOST("day",'int'); @@ -154,8 +155,10 @@ llxHeader('',$langs->trans("Agenda"),$help_url); $listofextcals=array(); $param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($actioncode != '') $param.="&actioncode=".$actioncode; +if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtert) $param.="&filtert=".$filtert; @@ -178,12 +181,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; +// We must filter on resource table +if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r"; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= " WHERE c.id = a.fk_action"; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND c.code IN ('".$db->escape($actioncode)."')"; +if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; @@ -199,7 +205,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR ( if ($filtert > 0 || $usergroup > 0) { $sql.= " AND ("; - if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")"; + if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR (ar.fk_element IS NULL AND a.fk_user_action=".$filtert."))"; // The OR is for backward compatibility if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } @@ -242,7 +248,7 @@ if ($resql) $head = calendars_prepare_head($param); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); - print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup); + print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,-1,$actioncode,$usergroup,'',$resourceid); dol_fiche_end(); // Add link to show birthdays @@ -288,6 +294,7 @@ if ($resql) $nav=''; if ($optioncss != '') $nav.= ''; if ($actioncode) $nav.=''; + if ($resourceid) $nav.=''; if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; if ($filter) $nav.=''; if ($filtert) $nav.=''; @@ -368,7 +375,7 @@ if ($resql) $actionstatic->type_code=$obj->type_code; $actionstatic->type_label=$obj->type_label; $actionstatic->label=$obj->label; - print $actionstatic->getNomUrl(1,28); + print $actionstatic->getNomUrl(1,36); print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 28a531c6b28..6138e79cafd 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -76,7 +76,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per //$action=GETPOST('action','alpha'); $action='show_pertype'; -//$year=GETPOST("year"); +$resourceid=GETPOST("resourceid","int"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); @@ -202,6 +202,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtert) $param.="&filtert=".$filtert; @@ -252,6 +253,7 @@ $nav.=''; $nav.=''; $nav.=''; $nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; @@ -279,7 +281,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); +print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid); dol_fiche_end(); $showextcals=$listofextcals; @@ -356,12 +358,15 @@ $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,'; $sql.= ' ca.code, ca.color'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; +// We must filter on resource table +if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r"; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; +if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 033c67839f0..cd5f7d10fa7 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -76,7 +76,7 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per //$action=GETPOST('action','alpha'); $action='show_peruser'; //We use 'show_week' mode -//$year=GETPOST("year"); +$resourceid=GETPOST("resourceid","int"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); @@ -202,6 +202,7 @@ if ($status == 'todo') $title=$langs->trans("ToDoActions"); $param=''; if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $param.="&actioncode=".$actioncode; +if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; if ($filtert) $param.="&filtert=".$filtert; @@ -255,6 +256,7 @@ $nav.=''; $nav.=''; $nav.=''; $nav.=''; +$nav.=''; $nav.=''; $nav.=''; $nav.=''; @@ -287,7 +289,7 @@ $paramnoaction=preg_replace('/action=[a-z_]+/','',$param); $head = calendars_prepare_head($paramnoaction); dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); -print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup); +print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, 0, $filtert, 0, $pid, $socid, $action, $listofextcals, $actioncode, $usergroup, '', $resourceid); dol_fiche_end(); $showextcals=$listofextcals; @@ -364,12 +366,15 @@ $sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,'; $sql.= ' ca.code, ca.color'; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; +// We must filter on resource table +if ($resourceid > 0) $sql.=", ".MAIN_DB_PREFIX."element_resources as r"; // We must filter on assignement table if ($filtert > 0 || $usergroup > 0) $sql.=", ".MAIN_DB_PREFIX."actioncomm_resources as ar"; if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_user = ar.fk_element"; $sql.= ' WHERE a.fk_action = ca.id'; $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; if ($actioncode) $sql.=" AND ca.code='".$db->escape($actioncode)."'"; +if ($resourceid > 0) $sql.=" AND r.element_type = 'action' AND r.element_id = a.id AND r.resource_id = ".$db->escape($resourceid); if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid); if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")"; if ($socid > 0) $sql.= ' AND a.fk_soc = '.$socid; diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index edb5042e358..bdfb7af6600 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -253,7 +253,7 @@ if ($action == 'create') print ''.$langs->trans('Label').''; print ''.$langs->trans('Name').''; - print ''.$langs->trans('Address').''; @@ -353,7 +353,7 @@ elseif ($action == 'edit') print ''.$langs->trans('AddressLabel').''; print ''.$langs->trans('Name').''; - print ''.$langs->trans('Address').''; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index e1828e911c7..256a31fd947 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -457,6 +457,7 @@ if ($id > 0) // Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + $langs->load("categories"); print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; print $form->showCategories( $object->id, 'customer', 1 ); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 59aa71b5595..6a06aad080f 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -517,7 +517,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; } @@ -571,7 +571,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 2ce7d5c110d..d09be0897c3 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -122,9 +122,10 @@ if (GETPOST('clearlist')) // Loading Class $obj = new MailingTargets($db); $obj->clear_target($id); - + /* Avoid this to allow reposition header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; + */ } if ($action == 'delete') @@ -400,7 +401,7 @@ if ($object->fetch($id) >= 0) $cleartext=''; if ($allowaddtarget) { - $cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.''; + $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); @@ -558,7 +559,7 @@ if ($object->fetch($id) >= 0) { if ($object->statut < 2) { - print ''; + print ''; print $langs->trans("NoTargetYet"); print ''; } diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index 5904bec0009..bf7c4624c1e 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -189,7 +189,7 @@ if ($result) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; $db->free($result); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 82988dfcb0d..f3ebd32fe95 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1433,7 +1433,7 @@ if ($action == 'create') print ''.fieldLabel('Currency','multicurrency_code').''; print ''; $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)); - print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 1); + print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print ''; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 56c3839dcb6..1ff75f2b661 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2570,7 +2570,7 @@ class Propal extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $delay_warning/60/60/24; $response->label = $label; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals'; $response->img = img_object($langs->trans("Propals"),"propal"); // This assignment in condition is not a bug. It allows walking the results. @@ -2674,9 +2674,12 @@ class Propal extends CommonObject $line->remise_percent=00; } - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; - + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ac22565ff15..af73bf3e45f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -354,7 +354,8 @@ if ($result) } $param='&socid='.$socid.'&viewstatut='.$viewstatut; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($month) $param.='&month='.$month; if ($year) $param.='&year='.$year; if ($search_ref) $param.='&search_ref=' .$search_ref; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 33895c2ac54..aa5a865dbf2 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -283,12 +283,12 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 07989b457de..a4aff6d71c1 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -341,22 +341,22 @@ if ($socid > 0) $var = !$var; print ""; print ''; - if ($obj->description == '(CREDIT_NOTE)') + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { print ''; } - elseif ($obj->description == '(DEPOSIT)') + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { print ''; } else @@ -500,22 +500,22 @@ if ($socid > 0) $var = !$var; print ""; print ''; - if ($obj->description == '(CREDIT_NOTE)') + if (preg_match('/\(CREDIT_NOTE\)/',$obj->description)) { print ''; } - elseif ($obj->description == '(DEPOSIT)') + elseif (preg_match('/\(DEPOSIT\)/',$obj->description)) { print ''; } else diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 08ca0e6b067..e67b18a5989 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -472,7 +472,15 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'classifyunbilled' && $user->rights->commande->creer) + { + $ret=$object->classifyUnBilled(); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + // Positionne ref commande client else if ($action == 'set_ref_client' && $user->rights->commande->creer) { $object->set_ref_client($user, GETPOST('ref_client')); @@ -2017,8 +2025,8 @@ if ($action == 'create' && $user->rights->commande->creer) // invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'"; } $addrelativediscount = '' . $langs->trans("EditRelativeDiscounts") . ''; @@ -2147,7 +2155,7 @@ if ($action == 'create' && $user->rights->commande->creer) print '
'.$langs->trans("Year").''.$langs->trans("NbOfProposals").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%'.$langs->trans("NbOfProposals").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); print '
'.dol_print_date($db->jdate($obj->dc),'dayhour').''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("CreditNote").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(CREDIT_NOTE\)/',$langs->trans("CreditNote"),$obj->description).' '.$facturestatic->getNomURl(1); print ''; $facturestatic->id=$obj->fk_facture_source; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; - print $langs->trans("InvoiceDeposit").' '.$facturestatic->getNomURl(1); + print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1); print '
'; - if ($action != 'editconditions' && $object->brouillon) + if ($action != 'editconditions') print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; print ''; @@ -2165,7 +2173,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; - if ($action != 'editmode' && $object->brouillon) + if ($action != 'editmode') print ''; print '
'; print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->trans('SetMode'), 1) . '
'; print ''; @@ -2552,7 +2560,11 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } } - + if ($object->statut > Commande::STATUS_DRAFT && $object->billed) { + if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { + print ''; + } + } // Clone if ($user->rights->commande->creer) { print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index cd730352d79..3ecbe763d0b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -478,9 +478,20 @@ class Commande extends CommonOrder } } - $this->statut=self::STATUS_DRAFT; - $this->db->commit(); - return 1; + if (!$error) { + // Call trigger + $result=$this->call_trigger('ORDER_SETDRAFT',$user); + if ($result < 0) $error++; + } + + if (!$error) { + $this->statut=self::STATUS_DRAFT; + $this->db->commit(); + return 1; + }else { + $this->db->rollback(); + return -1; + } } else { @@ -1394,6 +1405,11 @@ class Commande extends CommonOrder return -2; } } + else + { + dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); + return -3; + } } @@ -1847,9 +1863,9 @@ class Commande extends CommonOrder /** * Load array this->expeditions of lines of shipments with nb of products sent for each order line - * Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order + * Note: For a dedicated shipment, the fetch_lines can be used to load the qty_asked and qty_shipped. This function is use to return qty_shipped cumulated for the order * - * @param int $filtre_statut Filter on status + * @param int $filtre_statut Filter on shipment status * @return int <0 if KO, Nb of lines found if OK */ function loadExpeditions($filtre_statut=-1) @@ -1918,21 +1934,6 @@ class Commande extends CommonOrder else dol_print_error($this->db); } - /** - * Return a array with sendings by line - * - * @param int $filtre_statut Filtre sur statut - * @return int 0 si OK, <0 si KO - * - * TODO deprecate, move to Shipping class - */ - function livraison_array($filtre_statut=self::STATUS_CANCELED) - { - $delivery = new Livraison($this->db); - $deliveryArray = $delivery->livraison_array($filtre_statut); - return $deliveryArray; - } - /** * Return a array with the pending stock by product * @@ -2485,7 +2486,57 @@ class Commande extends CommonOrder return $this->classifyBilled($user); } - + /** + * Classify the order as not invoiced + * + * @return int <0 if ko, >0 if ok + */ + function classifyUnBilled() + { + global $conf, $user, $langs; + $error = 0; + + $this->db->begin(); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0'; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + + dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG); + if ($this->db->query($sql)) + { + // Call trigger + $result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user); + if ($result < 0) $error++; + // End call triggers + + if (! $error) + { + $this->facturee=0; // deprecated + $this->billed=0; + + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + } + + /** * Update a line in database * @@ -2958,7 +3009,7 @@ class Commande extends CommonOrder $response = new WorkboardResponse(); $response->warning_delay=$conf->commande->client->warning_delay/60/60/24; $response->label=$langs->trans("OrdersToProcess"); - $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3'; + $response->url=DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; $response->img=img_object($langs->trans("Orders"),"order"); $generic_commande = new Commande($this->db); @@ -3262,9 +3313,12 @@ class Commande extends CommonOrder $line->total_tva=19.6; $line->remise_percent=0; } - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; - + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 1ab418a9daa..e38097e4e3a 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -206,7 +206,7 @@ class CommandeStats extends Stats $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; - //if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE ".$this->where; $sql.= " AND c.rowid = tl.fk_commande AND tl.fk_product = product.rowid"; $sql.= " AND c.date_commande BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5878b640dc7..f19a431ec10 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -72,7 +72,7 @@ $optioncss = GETPOST('optioncss','alpha'); $billed = GETPOST('billed','int'); // Security check -$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int')); +$id = (GETPOST('orderid')?GETPOST('orderid','int'):GETPOST('id','int')); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'commande', $id,''); @@ -124,6 +124,9 @@ $arrayfields=array( 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), 'c.date_commande'=>array('label'=>$langs->trans("OrderDateShort"), 'checked'=>1), 'c.date_delivery'=>array('label'=>$langs->trans("DateDeliveryPlanned"), 'checked'=>1, 'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)), + 'c.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), + 'c.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), + 'c.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), 'c.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'c.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), 'c.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), @@ -220,7 +223,7 @@ llxHeader('',$langs->trans("Orders"),$help_url); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= ' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,'; @@ -253,6 +256,7 @@ if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_produc if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($search_ref) $sql .= natural_search('c.ref', $search_ref); +if ($search_ref_customer) $sql.= natural_search('c.ref_client', $search_ref_customer); if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($billed != '' && $billed >= 0) $sql.=' AND c.facture = '.$billed; if ($viewstatut <> '') @@ -310,7 +314,6 @@ if ($search_state) $sql.= natural_search("state.nom",$search_state); if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_ref_customer) $sql.= natural_search('c.ref_client', $search_ref_customer); if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); @@ -348,7 +351,7 @@ $sql.= $db->plimit($limit + 1,$offset); $resql = $db->query($sql); if ($resql) { - if ($socid) + if ($socid > 0) { $soc = new Societe($db); $soc->fetch($socid); @@ -378,7 +381,8 @@ if ($resql) $num = $db->num_rows($resql); $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($socid > 0) $param.='&socid='.$socid; if ($viewstatut != '') $param.='&viewstatut='.$viewstatut; if ($orderday) $param.='&orderday='.$orderday; @@ -393,6 +397,8 @@ if ($resql) if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; + if ($search_total_vat != '') $param.='&search_total_vat='.$search_total_vat; + if ($search_total_ttc != '') $param.='&search_total_ttc='.$search_total_ttc; if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields foreach ($search_array_options as $key => $val) @@ -479,7 +485,7 @@ if ($resql) if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'],$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'],$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'],$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['c.tva']['checked'])) print_liste_field_titre($arrayfields['c.tva']['label'],$_SERVER["PHP_SELF"],'c.total_vat','',$param, 'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'],$_SERVER["PHP_SELF"],'c.tva','',$param, 'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'],$_SERVER["PHP_SELF"],'c.total_ttc','',$param, 'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) @@ -642,7 +648,7 @@ if ($resql) print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4); print ''; } - // Status + // Status billed if (! empty($arrayfields['c.facture']['checked'])) { print ''; @@ -740,7 +746,7 @@ if ($resql) // stock order and stock order_supplier $stock_order=0; $stock_order_supplier=0; - if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) // What about other options ? + if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) // What about other options ? { if (! empty($conf->commande->enabled)) { @@ -929,10 +935,10 @@ if ($resql) // Amount VAT if (! empty($arrayfields['c.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_tva)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; - $totalarray['totalvat'] += $obj->total_vat; + $totalarray['totalvat'] += $obj->total_tva; } // Amount TTC if (! empty($arrayfields['c.total_ttc']['checked'])) diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 6f3519e9ced..e6bf504bec7 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -105,6 +105,7 @@ if ($id > 0 || ! empty($ref)) print '
'; + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
'; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 1968caf2544..98e931db9f8 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -46,7 +46,16 @@ foreach($linkedObjectBlock as $key => $objectlink) echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink")); ?> + + element != 'shipping') { + ?> + ">transnoentitiesnoconv("RemoveLink")); ?> + + db->query($sql); diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 7ea3bf1be5a..34cec22fb54 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -105,7 +105,7 @@ foreach ($accounts as $key=>$type) $solde = $acc->solde(1); print ''; - print ''.$acc->getNomUrl(1).''; + print ''.$acc->getNomUrl(1).''; print ''.$acc->bank.''; print ''.$acc->number.''; print ''; @@ -116,7 +116,7 @@ foreach ($accounts as $key=>$type) setEventMessages($acc->error, $acc->errors, 'errors'); } else { print $result->nbtodo; - if ($result->nbtodolate) print ' ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; + if ($result->nbtodolate) print '   ('.$result->nbtodolate.img_warning($langs->trans("Late")).')'; } } else print $langs->trans("FeatureDisabled"); @@ -130,7 +130,7 @@ foreach ($accounts as $key=>$type) $total[$acc->currency_code] += $solde; } } -if (! $found) print ''.$langs->trans("None").''; +if (! $found) print ''.$langs->trans("None").''; // Total foreach ($total as $key=>$solde) { @@ -182,7 +182,7 @@ foreach ($accounts as $key=>$type) if (! $found) { $var = !$var; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } // Total foreach ($total as $key=>$solde) @@ -249,7 +249,7 @@ foreach ($accounts as $key=>$type) if (! $found) { $var = !$var; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } // Total foreach ($total as $key=>$solde) diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index a17614238be..873d71de81b 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -312,8 +312,11 @@ if ($result) } else if ($links[$key]['type']=='company') { print ''; - print img_object($langs->trans('ShowCompany'),'company').' '; - print $links[$key]['label']; + //print img_object($langs->trans('ShowCompany'),'company').' '; + $societe=new Societe($db); + $societe->fetch($links[$key]['url_id']); + //print $links[$key]['label']; + print $societe->getNomUrl(1); print ''; } else if ($links[$key]['type']=='sc') { diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index f0c8a6bcdda..8860fa7c4ab 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -53,20 +53,6 @@ $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPO $search_thirdparty=GETPOST("thirdparty",'alpha'); $search_req_nb=GETPOST("req_nb",'alpha'); -$param=''; -if (!empty($description)) $param.='&description='.$description; -if (!empty($type)) $param.='&type='.$type; -if (!empty($debit)) $param.='&debit='.$debit; -if (!empty($credit)) $param.='&credit='.$credit; -if (!empty($account)) $param.='&account='.$account; -if (!empty($bid)) $param.='&bid='.$bid; -if (dol_strlen($search_dt_start) > 0) - $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int'); -if (dol_strlen($search_dt_end) > 0) - $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int'); -if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb")); -if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty")); - $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -78,6 +64,27 @@ $pagenext = $page + 1; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='b.dateo'; +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if (!empty($description)) $param.='&description='.$description; +if (!empty($type)) $param.='&type='.$type; +if (!empty($debit)) $param.='&debit='.$debit; +if (!empty($credit)) $param.='&credit='.$credit; +if (!empty($account)) $param.='&account='.$account; +if (!empty($bid)) $param.='&bid='.$bid; +if (dol_strlen($search_dt_start) > 0) + $param .= '&search_start_dtmonth=' . GETPOST('search_start_dtmonth', 'int') . '&search_start_dtday=' . GETPOST('search_start_dtday', 'int') . '&search_start_dtyear=' . GETPOST('search_start_dtyear', 'int'); +if (dol_strlen($search_dt_end) > 0) + $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int'); +if (GETPOST("req_nb")) $param.='&req_nb='.urlencode(GETPOST("req_nb")); +if (GETPOST("thirdparty")) $param.='&thirdparty='.urlencode(GETPOST("thirdparty")); + + +/* + * Actions + */ + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $description=""; @@ -88,8 +95,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $bid=""; $search_req_nb=''; $search_thirdparty=''; + $thirdparty=''; } + /* * View */ @@ -108,7 +117,8 @@ else $viewline = 50; $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,"; $sql.= " b.fk_account, b.fk_type,"; $sql.= " ba.rowid as bankid, ba.ref as bankref,"; -$sql.= " bu.label as labelurl, bu.url_id"; +$sql.= " bu.url_id,"; +$sql.= " s.nom, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql.= " FROM "; if ($bid) $sql.= MAIN_DB_PREFIX."bank_class as l,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba,"; @@ -155,7 +165,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql.= $db->plimit($limit+1,$offset); -//print $sql; dol_syslog('compta/bank/search.php::', LOG_DEBUG); $resql = $db->query($sql); @@ -190,10 +199,10 @@ if ($resql) $moreforfilter = ''; $moreforfilter.='
'; - $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' '; + $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('DateStart') . ' '; $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1); $moreforfilter .= ' - '; - $moreforfilter .= $langs->trans('EndDate') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); + $moreforfilter .= $langs->trans('DateEnd') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1); $moreforfilter .= '
'; if ($moreforfilter) @@ -209,9 +218,9 @@ if ($resql) print_liste_field_titre($langs->trans('DateOperationShort'),$_SERVER['PHP_SELF'],'b.dateo','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Value'),$_SERVER['PHP_SELF'],'b.datev','',$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER['PHP_SELF'],'','',$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Numero")); - print_liste_field_titre($langs->trans("Description")); - print_liste_field_titre($langs->trans("ThirdParty")); + print_liste_field_titre($langs->trans("Numero"),$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Description"),$_SERVER['PHP_SELF'],'','',$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],'bu.label','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); @@ -225,7 +234,8 @@ if ($resql) print ''; $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1); print ''; - print ''; + // Numero + print ''; print ''; print ''; print ''; @@ -287,7 +297,7 @@ if ($resql) print "\n"; // Num - print ''.($objp->num_chq?$objp->num_chq:"")."\n"; + print ''.($objp->num_chq?$objp->num_chq:"")."\n"; // Description print ""; @@ -306,7 +316,12 @@ if ($resql) if ($objp->url_id) { $companystatic->id=$objp->url_id; - $companystatic->name=$objp->labelurl; + $companystatic->name=$objp->nom; + $companystatic->name_alias=$objp->name_alias; + $companystatic->client=$objp->client; + $companystatic->fournisseur=$objp->fournisseur; + $companystatic->code_client=$objp->code_client; + $companystatic->code_fournisseur=$objp->code_fournisseur; print $companystatic->getNomUrl(1); } else @@ -363,8 +378,9 @@ else // If no data to display after a search if ($_POST["action"] == "search" && ! $num) { - print $langs->trans("NoRecordFound"); + print '
'.$langs->trans("NoRecordFound").'
'; } llxFooter(); + $db->close(); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index b90e7cac3cb..3f794491566 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -72,6 +72,7 @@ $title=$langs->trans("SpecialExpensesArea"); if ($mode == 'sconly') $title=$langs->trans("SocialContributionsPayments"); $param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($mode == 'sconly') $param='&mode=sconly'; if ($sortfield) $param.='&sortfield='.$sortfield; diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index b83cdde2db9..63556eeaee6 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -187,7 +187,7 @@ if ($result) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 497de98fa72..66fab1b9279 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -80,7 +80,7 @@ $childids[]=$user->id; llxHeader(); -$sql = "SELECT s.nom, s.rowid as socid,"; // Ou +$sql = "SELECT s.nom, d.fk_user, s.rowid as socid,"; // Ou $sql.= " d.rowid, d.type, d.dated as dd, d.km,"; // Comment $sql.= " d.fk_statut,"; $sql.= " u.lastname, u.firstname"; // Qui @@ -91,7 +91,7 @@ if (!$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_ $sql.= " WHERE d.fk_user = u.rowid"; $sql.= " AND d.entity = ".$conf->entity; if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) $sql.=' AND d.fk_user IN ('.join(',',$childids).')'; -if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id; +if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND (sc.fk_user = " .$user->id." OR d.fk_soc IS NULL) "; if ($socid) $sql.= " AND s.rowid = ".$socid; if ($search_ref) $sql.=" AND d.rowid=".$search_ref; @@ -188,7 +188,7 @@ if ($resql) print ''.dol_print_date($db->jdate($obj->dd),'day').''; // User print ''; - $userstatic->id = $obj->rowid; + $userstatic->id = $obj->fk_user; $userstatic->lastname = $obj->lastname; $userstatic->firstname = $obj->firstname; print $userstatic->getNomUrl(1); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 27ba03499c8..375288ce754 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -312,6 +312,15 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $object->error); } + else if ($action == 'setdate_pointoftax' && $user->rights->facture->creer) + { + $object->fetch($id); + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + $object->date_pointoftax=$date_pointoftax; + $result = $object->update($user); + if ($result < 0) dol_print_error($db, $object->error); + } + else if ($action == 'setconditions' && $user->rights->facture->creer) { $object->fetch($id); @@ -414,21 +423,22 @@ if (empty($reshook)) // Check parameters - // Check for mandatory prof id - for($i = 1; $i < 6; $i ++) + // Check for mandatory prof id (but only if country is than than ours) + if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) { - $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; - $idprof = 'idprof' . $i; - if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) - { - if (! $error) - $langs->load("errors"); - $error ++; - - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); - } + for ($i = 1; $i <= 6; $i++) + { + $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; + $idprof = 'idprof' . $i; + if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) + { + if (! $error) $langs->load("errors"); + $error++; + setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); + } + } } - + $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); @@ -702,12 +712,15 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors'); } + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + if (! $error) { // This is a replacement invoice $result = $object->fetch($_POST['fac_replacement']); $object->fetch_thirdparty(); $object->date = $dateinvoice; + $object->date_pointoftax = $date_pointoftax; $object->note_public = trim($_POST['note_public']); $object->note = trim($_POST['note']); $object->ref_client = $_POST['ref_client']; @@ -752,11 +765,14 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors'); } + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + if (! $error) { $object->socid = GETPOST('socid','int'); $object->number = $_POST['facnumber']; $object->date = $dateinvoice; + $object->date_pointoftax = $date_pointoftax; $object->note_public = trim($_POST['note_public']); $object->note = trim($_POST['note']); $object->ref_client = $_POST['ref_client']; @@ -848,7 +864,7 @@ if (empty($reshook)) } } - // Standard invoice or Deposit invoice created from a Predefined invoice + // Standard invoice or Deposit invoice created from a Predefined template invoice if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT) && GETPOST('fac_rec') > 0) { $dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -858,12 +874,15 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + if (! $error) { $object->socid = GETPOST('socid','int'); $object->type = $_POST['type']; $object->number = $_POST['facnumber']; - $object->date = $dateinvoice; + $object->date = $dateinvoice; + $object->date_pointoftax = $date_pointoftax; $object->note_public = trim($_POST['note_public']); $object->note_private = trim($_POST['note_private']); $object->ref_client = $_POST['ref_client']; @@ -904,6 +923,8 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); } + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + if (! $error) { // Si facture standard @@ -911,6 +932,7 @@ if (empty($reshook)) $object->type = GETPOST('type'); $object->number = $_POST['facnumber']; $object->date = $dateinvoice; + $object->date_pointoftax = $date_pointoftax; $object->note_public = trim($_POST['note_public']); $object->note_private = trim($_POST['note_private']); $object->ref_client = $_POST['ref_client']; @@ -1203,7 +1225,7 @@ if (empty($reshook)) { // If some invoice's lines coming from page $id = $object->create($user); - for($i = 1; $i <= $NBLINES; $i ++) { + for ($i = 1; $i <= $NBLINES; $i ++) { if ($_POST['idprod' . $i]) { $product = new Product($db); $product->fetch($_POST['idprod' . $i]); @@ -1224,6 +1246,8 @@ if (empty($reshook)) $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->trans("Date")) . '
'; } + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + if (!($_POST['situations'] > 0)) { $error++; $mesg = '
' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '
'; @@ -1248,6 +1272,7 @@ if (empty($reshook)) $object->fetch_thirdparty(); $object->date = $datefacture; + $object->date_pointoftax = $date_pointoftax; $object->note_public = trim($_POST['note_public']); $object->note = trim($_POST['note']); $object->ref_client = $_POST['ref_client']; @@ -2012,7 +2037,7 @@ if ($action == 'create') if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } - $absolute_discount = $soc->getAvailableDiscounts(); + if(!empty($soc->id)) $absolute_discount = $soc->getAvailableDiscounts(); if (! empty($conf->use_javascript_ajax)) { @@ -2396,6 +2421,15 @@ if ($action == 'create') print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1); print ''; + // Date point of tax + if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) + { + print '' . $langs->trans('DatePointOfTax') . ''; + $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); + print $form->select_date($date_pointoftax?$date_pointoftax:-1, 'date_pointoftax', '', '', '', "add", 1, 1, 1); + print ''; + } + // Payment term print '' . $langs->trans('PaymentConditionsShort') . ''; $form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id'); @@ -2678,8 +2712,8 @@ else if ($id > 0 || ! empty($ref)) $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice } else { - $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')"; - $filtercreditnote = "fk_facture_source IS NOT NULL AND description <> '(DEPOSIT)'"; + $filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')"; + $filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'"; } $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); @@ -3097,9 +3131,9 @@ else if ($id > 0 || ! empty($ref)) // Remise dispo de type avoir if (! $absolute_discount) print '
'; - // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, - // $filtercreditnote, $resteapayer); - $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0); // We allow credit note even if amount is higher + // $form->form_remise_dispo($_SERVER["PHP_SELF"].'?facid='.$object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, $resteapayer + $more=' ('.$addcreditnote.')'; + $form->form_remise_dispo($_SERVER["PHP_SELF"] . '?facid=' . $object->id, 0, 'remise_id_for_payment', $soc->id, $absolute_creditnote, $filtercreditnote, 0, $more); // We allow credit note even if amount is higher } } if (! $absolute_discount && ! $absolute_creditnote) { @@ -3320,7 +3354,7 @@ else if ($id > 0 || ! empty($ref)) $i ++; } } else { - print '' . $langs->trans("None") . ''; + print '' . $langs->trans("None") . ''; } // } $db->free($result); @@ -3460,6 +3494,24 @@ else if ($id > 0 || ! empty($ref)) print ''; + if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) + { + // Date invoice + print ''; + print ''; + print ''; + print '
'; + print $langs->trans('DatePointOfTax'); + print 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; + print ''; + if ($action == 'editdate_pointoftax') { + $form->form_date($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->date_pointoftax, 'date_pointoftax'); + } else { + print dol_print_date($object->date_pointoftax, 'daytext'); + } + print ''; + } + // Conditions de reglement print ''; print '"; - print '"; + print '"; print ''; } print "
'; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 13c10a5da0c..2bcd227827e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -666,7 +666,7 @@ class FactureRec extends CommonInvoice $facture->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice $facture->type = self::TYPE_STANDARD; $facture->brouillon = 1; - $facture->date = $now; + $facture->date = $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. $facture->socid = $facturerec->socid; $invoiceidgenerated = $facture->create($user); // This will also update fields of recurring invoice @@ -761,6 +761,8 @@ class FactureRec extends CommonInvoice $nownotime=dol_mktime(0, 0, 0, $arraynow['mon'], $arraynow['mday'], $arraynow['year']); $prodids = array(); + $num_prods = 0; + $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; $sql.= " WHERE entity IN (".getEntity('product', 1).")"; @@ -960,6 +962,7 @@ class FactureRec extends CommonInvoice if ($this->db->query($sql)) { $this->date_when = $date; + if ($increment_nb_gen_done>0) $this->nb_gen_done++; return 1; } else diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index bea200f2656..b0e0c431502 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -263,7 +263,7 @@ class Facture extends CommonInvoice $result=$soc->fetch($this->socid); if ($result < 0) { - $this->error="Failed to fetch company"; + $this->error="Failed to fetch company: ".$soc->error; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -2; } @@ -309,13 +309,12 @@ class Facture extends CommonInvoice $forceduedate = $this->calculate_date_lim_reglement(); - // Update date and number of last generation of recurring template invoice, before inserting new invoice + // For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice if ($_facrec->frequency > 0) { - $_facrec->nb_gen_done++; $next_date = $_facrec->getNextDate(); // Calculate next date $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date'); - $_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); + //$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1. $_facrec->setNextDate($next_date,1); } } @@ -336,6 +335,7 @@ class Facture extends CommonInvoice $sql.= ", remise_absolue"; $sql.= ", remise_percent"; $sql.= ", datef"; + $sql.= ", date_pointoftax"; $sql.= ", note_private"; $sql.= ", note_public"; $sql.= ", ref_client, ref_int"; @@ -358,6 +358,7 @@ class Facture extends CommonInvoice $sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL'); $sql.= ", ".($this->remise_percent>0?$this->remise_percent:'NULL'); $sql.= ", '".$this->db->idate($this->date)."'"; + $sql.= ", ".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null'); $sql.= ", ".($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); $sql.= ", ".($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); @@ -665,6 +666,7 @@ class Facture extends CommonInvoice $facture->type = $this->type; $facture->socid = $this->socid; $facture->date = $this->date; + $facture->date_pointoftax = $this->date_pointoftax; $facture->note_public = $this->note_public; $facture->note_private = $this->note_private; $facture->ref_client = $this->ref_client; @@ -1014,7 +1016,7 @@ class Facture extends CommonInvoice $sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount,f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise'; - $sql.= ', f.datef as df'; + $sql.= ', f.datef as df, f.date_pointoftax'; $sql.= ', f.date_lim_reglement as dlr'; $sql.= ', f.datec as datec'; $sql.= ', f.date_valid as datev'; @@ -1054,6 +1056,7 @@ class Facture extends CommonInvoice $this->ref_int = $obj->ref_int; $this->type = $obj->type; $this->date = $this->db->jdate($obj->df); + $this->date_pointoftax = $this->db->jdate($obj->date_pointoftax); $this->date_creation = $this->db->jdate($obj->datec); $this->date_validation = $this->db->jdate($obj->datev); $this->datem = $this->db->jdate($obj->datem); @@ -1328,6 +1331,7 @@ class Facture extends CommonInvoice $sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").","; $sql.= " datec=".(strval($this->date_creation)!='' ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; $sql.= " datef=".(strval($this->date)!='' ? "'".$this->db->idate($this->date)."'" : 'null').","; + $sql.= " date_pointoftax=".(strval($this->date_pointoftax)!='' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').","; $sql.= " date_valid=".(strval($this->date_validation)!='' ? "'".$this->db->idate($this->date_validation)."'" : 'null').","; $sql.= " paye=".(isset($this->paye)?$this->paye:"null").","; $sql.= " remise_percent=".(isset($this->remise_percent)?$this->remise_percent:"null").","; @@ -3460,7 +3464,7 @@ class Facture extends CommonInvoice $response = new WorkboardResponse(); $response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->label=$langs->trans("CustomerBillsUnpaid"); - $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1'; + $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1&mainmenu=accountancy&leftmenu=customers_bills'; $response->img=img_object($langs->trans("Bills"),"bill"); $generic_facture = new Facture($this->db); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index b826e4f266d..7b2d7076aca 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1256,15 +1256,20 @@ else print '
'; + // Frequencry/Recurring section if ($object->frequency > 0) { + if (empty($conf->cron->enabled)) + { + print info_admin($langs->trans("EnableAndSetupModuleCron", $langs->transnoentitiesnoconv("Module2300Name"))); + } print ''; // Nb of generation already done print ''; print ''; print ''; @@ -1333,14 +1338,21 @@ else //{ if ($user->rights->facture->creer) { - if (empty($object->frequency) || $object->date_when <= $today) - { - print ''; - } - else - { - print ''; - } + if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) + { + print ''; + } + else + { + if (empty($object->frequency) || $object->date_when <= $today) + { + print ''; + } + else + { + print ''; + } + } } else { @@ -1426,6 +1438,7 @@ else $num = $db->num_rows($resql); $param='&socid='.$socid; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($day) $param.='&day='.$day; if ($month) $param.='&month='.$month; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 68eb4240226..5fa90b6f14d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -29,7 +29,7 @@ /** * \file htdocs/compta/facture/list.php * \ingroup facture - * \brief Page to create/see an invoice + * \brief List of customer invoices */ require '../../main.inc.php'; @@ -37,6 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -50,7 +51,6 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/c $langs->load('bills'); $langs->load('companies'); $langs->load('products'); -$langs->load('main'); $sall=trim(GETPOST('sall')); $projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0); @@ -78,8 +78,19 @@ $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'); +$search_user = GETPOST('search_user','int'); +$search_sale = GETPOST('search_sale','int'); +$day = GETPOST('day','int'); +$month = GETPOST('month','int'); +$year = GETPOST('year','int'); +$day_lim = GETPOST('day_lim','int'); +$month_lim = GETPOST('month_lim','int'); +$year_lim = GETPOST('year_lim','int'); +$toselect = GETPOST('toselect', 'array'); + $option = GETPOST('option'); if ($option == 'late') $filter = 'paye:0'; +$filtre = GETPOST('filtre'); $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); @@ -96,17 +107,6 @@ $pagenext = $page + 1; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $contextpage='invoicelist'; -$search_user = GETPOST('search_user','int'); -$search_sale = GETPOST('search_sale','int'); -$day = GETPOST('day','int'); -$month = GETPOST('month','int'); -$year = GETPOST('year','int'); -$day_lim = GETPOST('day_lim','int'); -$month_lim = GETPOST('month_lim','int'); -$year_lim = GETPOST('year_lim','int'); -$filtre = GETPOST('filtre'); -$toselect = GETPOST('toselect', 'array'); - // Security check $fieldid = (! empty($ref)?'facnumber':'rowid'); if (! empty($user->societe_id)) $socid=$user->societe_id; @@ -140,14 +140,14 @@ $checkedtypetiers=0; $arrayfields=array( 'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), + 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), + 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), 'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), 'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers), - 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), - 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), 'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1), 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), @@ -182,13 +182,14 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Do we click on purge search criteria ? -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOST("button_removefilter.x")) // Both test are required to be compatible with all browsers { $search_user=''; $search_sale=''; $search_product_category=''; $search_ref=''; $search_refcustomer=''; + $search_project=''; $search_societe=''; $search_montant_ht=''; $search_montant_vat=''; @@ -624,8 +625,6 @@ if (empty($reshook)) * View */ -llxHeader('',$langs->trans('Bill'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); - $form = new Form($db); $formother = new FormOther($db); $formfile = new FormFile($db); @@ -633,6 +632,8 @@ $bankaccountstatic=new Account($db); $facturestatic=new Facture($db); $formcompany=new FormCompany($db); +llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); + $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; @@ -687,6 +688,7 @@ if ($filtre) } if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); +if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_zip) $sql.= natural_search("s.zip",$search_zip); @@ -756,7 +758,8 @@ if (! $sall) $sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.datec, f.tms,'; - $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client'; + $sql.= ' s.rowid, s.nom, s.town, s.zip, s.fk_pays, s.code_client, s.client, typent.code'; + $sql.= ' ,state.code_departement, state.nom'; } else { @@ -792,24 +795,25 @@ if ($resql) } $param='&socid='.$socid; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($day) $param.='&day='.$day; - if ($month) $param.='&month='.$month; - if ($year) $param.='&year=' .$year; - if ($day_lim) $param.='&day_lim='.$day_lim; - if ($month_lim) $param.='&month_lim='.$month_lim; - if ($year_lim) $param.='&year_lim=' .$year_lim; - if ($search_ref) $param.='&search_ref=' .$search_ref; - if ($search_refcustomer) $param.='&search_refcustomer=' .$search_refcustomer; - if ($search_societe) $param.='&search_societe=' .$search_societe; - if ($search_sale > 0) $param.='&search_sale=' .$search_sale; - if ($search_user > 0) $param.='&search_user=' .$search_user; - if ($search_product_category > 0) $param.='$search_product_category=' .$search_product_category; - if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; - if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat; - if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; - if ($search_status != '') $param.='&search_status='.$search_status; - if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode; + if ($day) $param.='&day='.urlencode($day); + if ($month) $param.='&month='.urlencode($month); + if ($year) $param.='&year=' .urlencode($year); + if ($day_lim) $param.='&day_lim='.urlencode($day_lim); + if ($month_lim) $param.='&month_lim='.urlencode($month_lim); + if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); + if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); + if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); + if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); + if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); + if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); + if ($search_product_category > 0) $param.='$search_product_category=' .urlencode($search_product_category); + if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); + if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); + if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if ($search_paymentmode > 0) $param.='search_paymentmode='.urlencode($search_paymentmode); if ($show_files) $param.='&show_files=' .$show_files; if ($option) $param.="&option=".$option; if ($optioncss != '') $param.='&optioncss='.$optioncss; @@ -1059,12 +1063,12 @@ if ($resql) // Thirpdarty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; } // Town if (! empty($arrayfields['s.town']['checked'])) print ''; // Zip - if (! empty($arrayfields['s.zip']['checked'])) print ''; + if (! empty($arrayfields['s.zip']['checked'])) print ''; // State if (! empty($arrayfields['state.nom']['checked'])) { @@ -1189,17 +1193,17 @@ if ($resql) $var=!$var; $datelimit=$db->jdate($obj->datelimite); - + $facturestatic->id=$obj->facid; + $facturestatic->ref=$obj->facnumber; + $facturestatic->type=$obj->type; + $facturestatic->statut=$obj->fk_statut; + $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); + print ''; if (! empty($arrayfields['f.facnumber']['checked'])) { print ''; + print ''; } print "
'.$langs->trans("NbOfGenerationDone").''; - print $object->nb_gen_done?$object->nb_gen_done:''; + print $object->nb_gen_done?$object->nb_gen_done:'0'; print '
'; - $facturestatic->id=$obj->facid; - $facturestatic->ref=$obj->facnumber; - $facturestatic->type=$obj->type; - $facturestatic->statut=$obj->fk_statut; - $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1); $paiement = $facturestatic->getSommePaiement(); $remaintopay = $obj->total_ttc - $paiement; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 14f8c8d18f6..9ca0c2f7718 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -262,12 +262,12 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index f0a8c82df1b..ffb3b3631f1 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2015-2016 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Marcos García @@ -543,7 +543,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) } else { - print ''; + print ''; } print '
'.$langs->trans("Year").''.$langs->trans("NumberOfBills").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%'.$langs->trans("NumberOfBills").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
'.$langs->trans("None").'
'.$langs->trans("None").'

'; } @@ -614,7 +614,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) } else { - print '
'.$langs->trans("None").'
'.$langs->trans("None").'

"; $db->free($resql); @@ -877,7 +877,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql.= " AND ff.fk_soc = ".$socid; $sql.= " GROUP BY ff.rowid, ff.ref, ff.fk_statut, ff.libelle, ff.total_ht, ff.tva, ff.total_tva, ff.total_ttc, ff.paye,"; - $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur"; + $sql.= " s.nom, s.rowid, s.code_client, s.code_fournisseur, ff.date_lim_reglement"; $sql.= " ORDER BY ff.date_lim_reglement ASC"; $resql=$db->query($sql); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 54af3f872cd..0ffaf49b955 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -440,7 +440,7 @@ if ($action == 'new') if ($i == 0) { - print ''.$langs->trans("NoWaitingChecks").'
'; + print '
'.$langs->trans("NoWaitingChecks").'

'; } } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 1493ba1b99a..ebfd598ee0b 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -121,6 +121,7 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; print '
'; @@ -214,7 +215,7 @@ if ($resql) else { print "
'.$langs->trans("None")."'.$langs->trans("None")."
"; diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php new file mode 100644 index 00000000000..5428f4abdbf --- /dev/null +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -0,0 +1,463 @@ + + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud + * + * 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/compat/paiement/class/cpaiement.class.php + * \ingroup facture + * \brief This file is to manage CRUD function of type of payments + */ + + +/** + * Class Cpaiement + */ +class Cpaiement +{ + /** + * @var string Id to identify managed objects + */ + public $element = 'cpaiement'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'c_paiement'; + + /** + * @var CpaiementLine[] Lines + */ + public $lines = array(); + + /** + */ + + public $code; + public $libelle; + public $type; + public $active; + public $accountancy_code; + public $module; + + /** + */ + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $error = 0; + + // Clean parameters + + if (isset($this->code)) { + $this->code = trim($this->code); + } + if (isset($this->libelle)) { + $this->libelle = trim($this->libelle); + } + if (isset($this->type)) { + $this->type = trim($this->type); + } + if (isset($this->active)) { + $this->active = trim($this->active); + } + if (isset($this->accountancy_code)) { + $this->accountancy_code = trim($this->accountancy_code); + } + if (isset($this->module)) { + $this->module = trim($this->module); + } + + + + // Check parameters + // Put here code to add control on parameters values + + // Insert request + $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; + + $sql.= 'id,'; + $sql.= 'code,'; + $sql.= 'libelle,'; + $sql.= 'type,'; + $sql.= 'active,'; + $sql.= 'accountancy_code,'; + $sql.= 'module'; + + + $sql .= ') VALUES ('; + + $sql .= ' '.(! isset($this->id)?'NULL':$this->id).','; + $sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").','; + $sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").','; + $sql .= ' '.(! isset($this->type)?'NULL':$this->type).','; + $sql .= ' '.(! isset($this->active)?'NULL':$this->active).','; + $sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'").','; + $sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'"); + + + $sql .= ')'; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + + if (!$error) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) $error++; + //// End call triggers + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return $this->id; + } + } + + /** + * Load object 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 fetch($id, $ref = null) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= ' t.id,'; + $sql .= " t.code,"; + $sql .= " t.libelle,"; + $sql .= " t.type,"; + $sql .= " t.active,"; + $sql .= " t.accountancy_code,"; + $sql .= " t.module"; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + if (null !== $ref) { + $sql .= ' WHERE t.code = ' . '\'' . $ref . '\''; + } else { + $sql .= ' WHERE t.id = ' . $id; + } + + $resql = $this->db->query($sql); + if ($resql) { + $numrows = $this->db->num_rows($resql); + if ($numrows) { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->id; + + $this->code = $obj->code; + $this->libelle = $obj->libelle; + $this->type = $obj->type; + $this->active = $obj->active; + $this->accountancy_code = $obj->accountancy_code; + $this->module = $obj->module; + + + } + $this->db->free($resql); + + if ($numrows) { + return 1; + } else { + return 0; + } + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + /** + * Load object in memory from the database + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) + * + * @return int <0 if KO, >0 if OK + */ + public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= ' t.id,'; + $sql .= " t.code,"; + $sql .= " t.libelle,"; + $sql .= " t.type,"; + $sql .= " t.active,"; + $sql .= " t.accountancy_code,"; + $sql .= " t.module"; + + + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + if (count($sqlwhere) > 0) { + $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield,$sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit + 1, $offset); + } + $this->lines = array(); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) { + $line = new CpaiementLine(); + + $line->id = $obj->id; + + $line->code = $obj->code; + $line->libelle = $obj->libelle; + $line->type = $obj->type; + $line->active = $obj->active; + $line->accountancy_code = $obj->accountancy_code; + $line->module = $obj->module; + + + + $this->lines[$line->id] = $line; + } + $this->db->free($resql); + + return $num; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + // Clean parameters + + if (isset($this->code)) { + $this->code = trim($this->code); + } + if (isset($this->libelle)) { + $this->libelle = trim($this->libelle); + } + if (isset($this->type)) { + $this->type = trim($this->type); + } + if (isset($this->active)) { + $this->active = trim($this->active); + } + if (isset($this->accountancy_code)) { + $this->accountancy_code = trim($this->accountancy_code); + } + if (isset($this->module)) { + $this->module = trim($this->module); + } + + + + // Check parameters + // Put here code to add a control on parameters values + + // Update request + $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; + $sql .= ' id = '.(isset($this->id)?$this->id:"null").','; + $sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").','; + $sql .= ' libelle = '.(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").','; + $sql .= ' type = '.(isset($this->type)?$this->type:"null").','; + $sql .= ' active = '.(isset($this->active)?$this->active:"null").','; + $sql .= ' accountancy_code = '.(isset($this->accountancy_code)?"'".$this->db->escape($this->accountancy_code)."'":"null").','; + $sql .= ' module = '.(isset($this->module)?"'".$this->db->escape($this->module)."'":"null"); + $sql .= ' WHERE id=' . $this->id; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + + if (!$error && !$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $error = 0; + + $this->db->begin(); + + if (!$error) { + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + if (!$error) { + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; + $sql .= ' WHERE id=' . $this->id; + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } + + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->id = 0; + + $this->code = ''; + $this->libelle = ''; + $this->type = ''; + $this->active = ''; + $this->accountancy_code = ''; + $this->module = ''; + + + } + +} diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 62f8c1b6717..099d05cfa84 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -62,8 +62,9 @@ class Paiement extends CommonObject var $bank_line; // Id de la ligne d'ecriture bancaire // fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...) // fk_paiement dans llx_paiement_facture est le rowid du paiement + var $fk_paiement; // Type of paiment - + /** * Constructor * diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index bd72fcc17f7..e230d91e6ae 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -50,7 +50,7 @@ $paymentstatic=new Paiement($db); $accountstatic=new Account($db); $companystatic=new Societe($db); -$search_ref=GETPOST("search_ref","int"); +$search_ref=GETPOST("search_ref","alpha"); $search_account=GETPOST("search_account","int"); $search_paymenttype=GETPOST("search_paymenttype"); $search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be able to search on "< x" @@ -203,6 +203,7 @@ if ($resql) $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; $param.=(GETPOST("orphelins")?"&orphelins=1":""); $param.=($search_ref?"&search_ref=".urlencode($search_ref):""); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index c2607d5b83d..3350f5c34a3 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -235,7 +235,7 @@ if ($resql) $i++; } } - else print ''.$langs->trans("None").''; + else print ''.$langs->trans("None").''; print ""; print "
\n"; } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 7c700dfeabb..e00de804f93 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -159,7 +159,7 @@ if ($resql) } else { - print ''.$langs->trans("NoInvoiceToWithdraw").''; + print ''.$langs->trans("NoInvoiceToWithdraw").''; } print "
"; } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 9b4d37d6335..95ea2bfe46c 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -279,7 +279,7 @@ if ($total_ttc == 0) { $var=!$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } @@ -362,7 +362,7 @@ if ($result) { { $var=!$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } @@ -439,7 +439,7 @@ if ($result) { else { $var = !$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } } else { @@ -517,7 +517,7 @@ if ($result) { else { $var = !$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } } else { @@ -606,7 +606,7 @@ if (! empty($conf->salaries->enabled)) { $var = !$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } } @@ -629,7 +629,7 @@ if (! empty($conf->expensereport->enabled)) { $langs->load('trips'); if ($modecompta == 'CREANCES-DETTES') { - $sql = "SELECT p.rowid, p.ref, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc"; + $sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(date_valid,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " WHERE p.entity = ".getEntity('expensereport',1); @@ -688,7 +688,7 @@ if (! empty($conf->expensereport->enabled)) { $var = !$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } } @@ -757,7 +757,7 @@ if (! empty($conf->don->enabled)) { $var = !$var; print " "; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } } diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index b0584d62850..98278ad374c 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -127,7 +127,8 @@ if ($result) $var=true; $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($typeid) $param.='&typeid='.$typeid; if ($optioncss != '') $param.='&optioncss='.$optioncss; diff --git a/htdocs/compta/sociales/charges.php b/htdocs/compta/sociales/charges.php index abcb5e0ad06..6e7c9ad93c2 100644 --- a/htdocs/compta/sociales/charges.php +++ b/htdocs/compta/sociales/charges.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -325,8 +325,6 @@ if ($id > 0) { $head=tax_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); - // Clone confirmation if ($action === 'clone') { @@ -357,11 +355,16 @@ if ($id > 0) print ''; } + + dol_fiche_head($head, 'card', $langs->trans("SocialContribution"),0,'bill'); + print ''; + $linkback = '' . $langs->trans("BackToList") . ''; + // Ref - print '"; // Label @@ -402,7 +405,7 @@ if ($id > 0) { $num = $db->num_rows($resql); $i = 0; $total = 0; - print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'id'); + print '
'.$langs->trans("Ref").''; + print $form->showrefnav($object,'id',$linkback); print "
'; + print '
'; print ''; print ''; print ''; @@ -488,9 +491,12 @@ if ($id > 0) print '
'.$langs->trans("RefPayment").''.$langs->trans("Date").'
'; + dol_fiche_end(); + + if ($action == 'edit') { - print '
'; + print '
'; print ''; print '   '; print ''; @@ -499,7 +505,6 @@ if ($id > 0) if ($action == 'edit') print "\n"; - dol_fiche_end(); /* diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php new file mode 100644 index 00000000000..494e563b587 --- /dev/null +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -0,0 +1,617 @@ + + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2015 Florian Henry + * Copyright (C) 2015 Raphaël Doursenaud + * + * 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/compta/sociales/class/cchargesociales.class.php + * \ingroup tax + * \brief File to manage type of social/fiscal taxes + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class Cchargesociales + */ +class Cchargesociales +{ + /** + * @var string Id to identify managed objects + */ + public $element = 'cchargesociales'; + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'c_chargesociales'; + + /** + * @var CchargesocialesLine[] Lines + */ + public $lines = array(); + + /** + */ + + public $libelle; + public $deductible; + public $active; + public $code; + public $fk_pays; + public $module; + public $accountancy_code; + + /** + */ + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + $this->db = $db; + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $error = 0; + + // Clean parameters + + if (isset($this->libelle)) { + $this->libelle = trim($this->libelle); + } + if (isset($this->deductible)) { + $this->deductible = trim($this->deductible); + } + if (isset($this->active)) { + $this->active = trim($this->active); + } + if (isset($this->code)) { + $this->code = trim($this->code); + } + if (isset($this->fk_pays)) { + $this->fk_pays = trim($this->fk_pays); + } + if (isset($this->module)) { + $this->module = trim($this->module); + } + if (isset($this->accountancy_code)) { + $this->accountancy_code = trim($this->accountancy_code); + } + + + + // Check parameters + // Put here code to add control on parameters values + + // Insert request + $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '('; + + $sql.= 'libelle,'; + $sql.= 'deductible,'; + $sql.= 'active,'; + $sql.= 'code,'; + $sql.= 'fk_pays,'; + $sql.= 'module'; + $sql.= 'accountancy_code'; + + + $sql .= ') VALUES ('; + + $sql .= ' '.(! isset($this->libelle)?'NULL':"'".$this->db->escape($this->libelle)."'").','; + $sql .= ' '.(! isset($this->deductible)?'NULL':$this->deductible).','; + $sql .= ' '.(! isset($this->active)?'NULL':$this->active).','; + $sql .= ' '.(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").','; + $sql .= ' '.(! isset($this->fk_pays)?'NULL':$this->fk_pays).','; + $sql .= ' '.(! isset($this->module)?'NULL':"'".$this->db->escape($this->module)."'").','; + $sql .= ' '.(! isset($this->accountancy_code)?'NULL':"'".$this->db->escape($this->accountancy_code)."'"); + + + $sql .= ')'; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + + if (!$error) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); + + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_CREATE',$user); + //if ($result < 0) $error++; + //// End call triggers + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return $this->id; + } + } + + /** + * Load object 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 fetch($id, $ref = null) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= " t.id,"; + $sql .= " t.libelle,"; + $sql .= " t.deductible,"; + $sql .= " t.active,"; + $sql .= " t.code,"; + $sql .= " t.fk_pays,"; + $sql .= " t.module,"; + $sql .= " t.accountancy_code"; + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; + if (null !== $ref) { + $sql .= " WHERE t.code = '" . $this->db->escape($ref) . "'"; + } else { + $sql .= ' WHERE t.id = ' . $id; + } + + $resql = $this->db->query($sql); + if ($resql) { + $numrows = $this->db->num_rows($resql); + if ($numrows) { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->id; + + $this->libelle = $obj->libelle; + $this->deductible = $obj->deductible; + $this->active = $obj->active; + $this->code = $obj->code; + $this->fk_pays = $obj->fk_pays; + $this->module = $obj->module; + $this->accountancy_code = $obj->accountancy_code; + + + } + $this->db->free($resql); + + if ($numrows) { + return 1; + } else { + return 0; + } + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + /** + * Load object in memory from the database + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit offset limit + * @param int $offset offset limit + * @param array $filter filter array + * @param string $filtermode filter mode (AND or OR) + * + * @return int <0 if KO, >0 if OK + */ + public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $sql = 'SELECT'; + $sql .= " t.id,"; + $sql .= " t.libelle,"; + $sql .= " t.deductible,"; + $sql .= " t.active,"; + $sql .= " t.code,"; + $sql .= " t.fk_pays,"; + $sql .= " t.module,"; + $sql .= " t.accountancy_code"; + + + $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + $sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + } + } + if (count($sqlwhere) > 0) { + $sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield,$sortorder); + } + if (!empty($limit)) { + $sql .= ' ' . $this->db->plimit($limit + 1, $offset); + } + $this->lines = array(); + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + + while ($obj = $this->db->fetch_object($resql)) { + $line = new CchargesocialesLine(); + + $line->id = $obj->id; + $line->libelle = $obj->libelle; + $line->deductible = $obj->deductible; + $line->active = $obj->active; + $line->code = $obj->code; + $line->fk_pays = $obj->fk_pays; + $line->module = $obj->module; + $line->accountancy_code = $obj->accountancy_code; + + $this->lines[$line->id] = $line; + } + $this->db->free($resql); + + return $num; + } else { + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + + return - 1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + // Clean parameters + + if (isset($this->libelle)) { + $this->libelle = trim($this->libelle); + } + if (isset($this->deductible)) { + $this->deductible = trim($this->deductible); + } + if (isset($this->active)) { + $this->active = trim($this->active); + } + if (isset($this->code)) { + $this->code = trim($this->code); + } + if (isset($this->fk_pays)) { + $this->fk_pays = trim($this->fk_pays); + } + if (isset($this->module)) { + $this->module = trim($this->module); + } + if (isset($this->accountancy_code)) { + $this->accountancy_code = trim($this->accountancy_code); + } + + + + // Check parameters + // Put here code to add a control on parameters values + + // Update request + $sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET'; + $sql .= ' libelle = '.(isset($this->libelle)?"'".$this->db->escape($this->libelle)."'":"null").','; + $sql .= ' deductible = '.(isset($this->deductible)?$this->deductible:"null").','; + $sql .= ' active = '.(isset($this->active)?$this->active:"null").','; + $sql .= ' code = '.(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").','; + $sql .= ' fk_pays = '.(isset($this->fk_pays)?$this->fk_pays:"null").','; + $sql .= ' module = '.(isset($this->module)?"'".$this->db->escape($this->module)."'":"null").','; + $sql .= ' accountancy_code = '.(isset($this->accountancy_code)?"'".$this->db->escape($this->accountancy_code)."'":"null"); + $sql .= ' WHERE id=' . $this->id; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + + if (!$error && !$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + $error = 0; + + $this->db->begin(); + + if (!$error) { + if (!$notrigger) { + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + + //// Call triggers + //$result=$this->call_trigger('MYOBJECT_DELETE',$user); + //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + //// End call triggers + } + } + + if (!$error) { + $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; + $sql .= ' WHERE id=' . $this->id; + + $resql = $this->db->query($sql); + if (!$resql) { + $error ++; + $this->errors[] = 'Error ' . $this->db->lasterror(); + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + + return - 1 * $error; + } else { + $this->db->commit(); + + return 1; + } + } + + /** + * Load an object from its id and create a new one in database + * + * @param int $fromid Id of object to clone + * + * @return int New id of clone + */ + public function createFromClone($fromid) + { + dol_syslog(__METHOD__, LOG_DEBUG); + + global $user; + $error = 0; + $object = new Cchargesociales($this->db); + + $this->db->begin(); + + // Load source object + $object->fetch($fromid); + // Reset object + $object->id = 0; + + // Clear fields + // ... + + // Create clone + $result = $object->create($user); + + // Other options + if ($result < 0) { + $error ++; + $this->errors = $object->errors; + dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + } + + // End + if (!$error) { + $this->db->commit(); + + return $object->id; + } else { + $this->db->rollback(); + + return - 1; + } + } + + /** + * Return a link to the user card (with optionaly the picto) + * Use this->id,this->lastname, this->firstname + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to + * @param integer $notooltip 1=Disable tooltip + * @param int $maxlen Max length of visible user name + * @param string $morecss Add more css on link + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') + { + global $langs, $conf, $db; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("MyModule") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $link = 'ref . $linkend; + return $result; + } + + /** + * Retourne le libelle du status d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un status donne + * + * @param int $status Id status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($status,$mode=0) + { + global $langs; + + if ($mode == 0) + { + $prefix=''; + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($status == 1) return $langs->trans('Enabled'); + if ($status == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } + + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->id = 0; + + $this->libelle = ''; + $this->deductible = ''; + $this->active = ''; + $this->code = ''; + $this->fk_pays = ''; + $this->module = ''; + $this->accountancy_code = ''; + + + } + +} diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 1499c79d683..e5653ba2ee3 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -24,9 +24,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -/** \class ChargeSociales - * \brief Classe permettant la gestion des paiements des charges - * La tva collectee n'est calculee que sur les factures payees. +/** + * Classe permettant la gestion des paiements des charges + * La tva collectee n'est calculee que sur les factures payees. */ class ChargeSociales extends CommonObject { @@ -72,7 +72,7 @@ class ChargeSociales extends CommonObject function fetch($id, $ref='') { $sql = "SELECT cs.rowid, cs.date_ech,"; - $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode,"; + $sql.= " cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key,"; $sql.= " c.libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; $sql.= " WHERE cs.fk_type = c.id"; @@ -96,7 +96,8 @@ class ChargeSociales extends CommonObject $this->amount = $obj->amount; $this->paye = $obj->paye; $this->periode = $this->db->jdate($obj->periode); - + $this->import_key = $this->import_key; + $this->db->free($resql); return 1; @@ -485,7 +486,7 @@ class ChargeSociales extends CommonObject */ function info($id) { - $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev"; + $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key"; $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; $sql.= " WHERE e.rowid = ".$id; @@ -514,7 +515,7 @@ class ChargeSociales extends CommonObject $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); $this->date_validation = $this->db->jdate($obj->datev); - + $this->import_key = $obj->import_key; } $this->db->free($result); diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index 3133022b9e6..b673a5064ed 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -69,7 +69,7 @@ else $typeid=$_REQUEST['typeid']; } -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers { $search_ref=""; $search_label=""; @@ -138,7 +138,8 @@ if ($resql) $var=true; $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($year) $param.='&year='.$year; if ($typeid) $param.='&typeid='.$typeid; @@ -210,6 +211,8 @@ if ($resql) print ''; print "\n"; + $i=0; + $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); @@ -243,8 +246,12 @@ if ($resql) } print ''; + // Amount print ''.price($obj->amount).''; - + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; + $totalarray['totalttc'] += $obj->amount; + // Due date print ''.dol_print_date($db->jdate($obj->date_ech), 'day').''; @@ -256,6 +263,22 @@ if ($resql) $i++; } + // Show total line + if (isset($totalarray['totalttcfield'])) + { + print ''; + if ($num < $limit) print ''.$langs->trans("Total").''; + else print ''.$langs->trans("Totalforthispage").''; + print ''; + print ''; + print ''; + print ''.price($totalarray['totalttc']).''; + print ''; + print ''; + print ''; + print ''; + } + print ''; } print ''; diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index a22ca9abd3a..b13ea2d4166 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -322,7 +322,7 @@ if (is_array($coll_list)) { //print load_fiche_titre($vatsup); //print ""; -print ""; +print ""; print '"; print '"; print ""; diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 28ce4e50e24..6ebaee8ecd5 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -479,7 +479,7 @@ else //print table headers for this quadri - expenses now //imprime les en-tete de tables pour ce quadri - maintenant les d�penses - print ''; + print ''; print ''; print ''; if ($modetax == 0) diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index f6dd0be53c2..5484be65a32 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -134,7 +134,8 @@ if ($result) $var=true; $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($typeid) $param.='&typeid='.$typeid; @@ -211,7 +212,7 @@ if ($result) $i++; } - print ''; + print ''; print ""; print ""; diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index a626c57b6af..af8fccfd7b9 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -170,12 +170,12 @@ if ($result > 0) $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info,1); $search = "(".$object->_load_ldap_dn($info,2).")"; - $records=$ldap->getAttribute($dn,$search); + $records = $ldap->getAttribute($dn,$search); //var_dump($records); // Affichage arbre - if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) + if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index ac54e1aaa5f..a66c1dab946 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -369,6 +369,7 @@ if ($result) $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; $param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param.='&type='.urlencode($type).'&view='.urlencode($view); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 0a34723e2ce..5a87d3b3d51 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1060,7 +1060,7 @@ if ($action == 'create') $projectid = (!empty($objectsrc->fk_project)?$objectsrc->fk_project:''); - $soc = $objectsrc->client; + $soc = $objectsrc->thirdparty; $note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''); $note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : ''); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 8f3c87725fa..47cde8e3f40 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2147,8 +2147,11 @@ class Contrat extends CommonObject $line->total_ht=90; $line->total_ttc=107.64; // 90 * 1.196 $line->total_tva=17.64; - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } $this->lines[$xnbp]=$line; $xnbp++; } @@ -2217,18 +2220,18 @@ class Contrat extends CommonObject */ class ContratLigne extends CommonObjectLine { - + public $element='contratdet'; + public $table_element='contratdet'; + var $id; var $ref; var $tms; + var $fk_contrat; var $fk_product; var $statut; // 0 inactive, 4 active, 5 closed + var $type; // 0 for product, 1 for service var $label; - - public $element='contratdet'; - public $table_element='contratdet'; - /** * @var string * @deprecated Use $label instead @@ -2237,6 +2240,10 @@ class ContratLigne extends CommonObjectLine public $libelle; var $description; + + var $product_ref; + var $product_label; + var $date_commande; var $date_ouverture_prevue; // date start planned var $date_ouverture; // date start real @@ -2376,16 +2383,17 @@ class ContratLigne extends CommonObjectLine $result=''; $label=$langs->trans("ShowContractOfService").': '.$this->label; - + if (empty($label)) $label=$this->description; + $link = ''; $linkend=''; - $picto='contract'; - + $picto='service'; + if ($this->type == 0) $picto='product'; if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.$this->label.$linkend; + if ($withpicto != 2) $result.=$link.($this->product_ref?$this->product_ref.' ':'').($this->label?$this->label:$this->description).$linkend; return $result; } @@ -2414,6 +2422,7 @@ class ContratLigne extends CommonObjectLine $sql.= " p.ref as product_ref,"; $sql.= " p.label as product_label,"; $sql.= " p.description as product_desc,"; + $sql.= " p.type as product_type,"; $sql.= " t.description,"; $sql.= " t.date_commande,"; $sql.= " t.date_ouverture_prevue as date_ouverture_prevue,"; @@ -2464,6 +2473,7 @@ class ContratLigne extends CommonObjectLine $this->product_ref = $obj->product_ref; $this->product_label = $obj->product_label; $this->product_description = $obj->product_description; + $this->product_type = $obj->product_type; $this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line $this->description = $obj->description; $this->date_commande = $this->db->jdate($obj->date_commande); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 11d05c60a49..350a0435d38 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -170,6 +170,7 @@ if ($resql) $i = 0; $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; $param.='&search_contract='.$search_contract; $param.='&search_name='.$search_name; @@ -256,7 +257,7 @@ if ($resql) print ''; print ''; print ''; print ''; @@ -291,7 +291,7 @@ if ($resql) print ''; } diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 997e27adb20..f1352f8e933 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -240,7 +240,10 @@ if ($section) require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $useglobalvars=1; $form = new Form($db); - $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile')); + $formquestion=array( + 'urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'), + 'section'=>array('type'=>'hidden','value'=>$section,'name'=>'section') + ); print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0)); } diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index b4ea22d59eb..416975acfdb 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -111,10 +111,15 @@ if (! empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_ { $arrayresult['searchintointervention']=array('text'=>img_picto('','object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode($search_boxvalue)); } +// HR if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) { $arrayresult['searchintoexpensereport']=array('text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?sall='.urlencode($search_boxvalue)); } +if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) +{ + $arrayresult['searchintoleaves']=array('text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?sall='.urlencode($search_boxvalue)); +} /* Do we really need this. We already have a select for users, and we should be able to filter into user list on employee flag diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 58b5dc7f1fa..665bff4c6da 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -55,13 +55,15 @@ class box_contracts extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - $contractstatic=new Contrat($db); - + $this->info_box_head = array('text' => $langs->trans("BoxTitleLastContracts",$max)); if ($user->rights->contrat->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; + $contractstatic=new Contrat($db); + $thirdpartytmp=new Societe($db); + + $sql = "SELECT s.nom as name, s.rowid as socid,"; $sql.= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -80,7 +82,10 @@ class box_contracts extends ModeleBoxes $line = 0; - while ($line < $num) { + $langs->load("contracts"); + + while ($line < $num) + { $objp = $db->fetch_object($resql); $datec=$db->jdate($objp->datec); $dateterm=$db->jdate($objp->fin_validite); @@ -89,38 +94,26 @@ class box_contracts extends ModeleBoxes $contractstatic->statut=$objp->fk_statut; $contractstatic->id=$objp->rowid; + $contractstatic->ref=$objp->ref; $result=$contractstatic->fetch_lines(); + $thirdpartytmp->name = $objp->name; + $thirdpartytmp->id = $objp->socid; + // fin_validite is no more on contract but on services // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } - $this->info_box_contents[$line][] = array( - 'td' => 'align="left" width="16"', - 'logo' => $this->boximg, - 'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid), - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid, - ); - $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref - 'tooltip' => $langs->trans('Contract').': '.($objp->ref?$objp->ref:$objp->rowid), + 'text' => $contractstatic->getNomUrl(1), 'text2'=> $late, - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid, - ); - - $this->info_box_contents[$line][] = array( - 'td' => 'align="left" width="16"', - 'logo' => 'company', - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'asis'=>1 ); $this->info_box_contents[$line][] = array( 'td' => 'align="left"', - 'text' => dol_trunc($objp->name,40), - 'tooltip' => $langs->trans('Customer').': '.$objp->name, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid, + 'text' => $thirdpartytmp->getNomUrl(1), + 'asis'=>1 ); $this->info_box_contents[$line][] = array( diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 783aa8b2c64..bcc26f60e4c 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -77,14 +77,18 @@ class box_factures_imp extends ModeleBoxes $sql.= " f.tva as total_tva,"; $sql.= " f.total_ttc,"; $sql.= " f.paye, f.fk_statut, f.rowid as facid"; + $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.paye = 0"; $sql.= " AND fk_statut = 1"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.facnumber, f.date_lim_reglement,"; + $sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid"; //$sql.= " ORDER BY f.datef DESC, f.facnumber DESC "; $sql.= " ORDER BY datelimite ASC, f.facnumber ASC "; $sql.= $db->plimit($max, 0); @@ -146,7 +150,7 @@ class box_factures_imp extends ModeleBoxes $this->info_box_contents[$line][] = array( 'td' => 'align="right" width="18"', - 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3), + 'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$objp->am), ); $line++; @@ -186,4 +190,3 @@ class box_factures_imp extends ModeleBoxes } } - diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index eb48fc83d2b..c38b99263ba 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -56,26 +56,28 @@ class box_services_contracts extends ModeleBoxes $this->max=$max; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - $contratlignestatic=new ContratLigne($db); $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract",$max)); if ($user->rights->service->lire && $user->rights->contrat->lire) { + $contractstatic=new Contrat($db); + $contratlignestatic=new ContratLigne($db); + $thirdpartytmp = new Societe($db); + $sql = "SELECT s.nom as name, s.rowid as socid,"; - $sql.= " c.rowid,"; - $sql.= " cd.rowid as cdid, cd.tms as datem, cd.statut,"; - $sql.= " p.rowid as pid, p.label, p.fk_product_type"; + $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.= " FROM (".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."contrat as c"; $sql.= ", ".MAIN_DB_PREFIX."contratdet as cd"; - $sql.= ", ".MAIN_DB_PREFIX."product as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ")"; $sql.= " WHERE c.entity = ".$conf->entity; $sql.= " AND s.rowid = c.fk_soc"; $sql.= " AND c.rowid = cd.fk_contrat"; - $sql.= " AND cd.fk_product = p.rowid"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; $sql.= $db->order("c.tms","DESC"); @@ -94,12 +96,27 @@ class box_services_contracts extends ModeleBoxes $objp = $db->fetch_object($result); $datem=$db->jdate($objp->datem); + $contratlignestatic->id=$objp->cdid; + $contratlignestatic->fk_contrat=$objp->rowid; + $contratlignestatic->label=$objp->label; + $contratlignestatic->description=$objp->description; + $contratlignestatic->type=$objp->type; + $contratlignestatic->product_id=$objp->product_id; + $contratlignestatic->product_ref=$objp->product_ref; + + $contractstatic->statut=$objp->contract_status; + $contractstatic->id=$objp->rowid; + $contractstatic->ref=$objp->ref; + + $thirdpartytmp->name = $objp->name; + $thirdpartytmp->id = $objp->socid; + // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { $sqld = "SELECT label"; $sqld.= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sqld.= " WHERE fk_product=".$objp->pid; + $sqld.= " WHERE fk_product=".$objp->product_id; $sqld.= " AND lang='". $langs->getDefaultLang() ."'"; $sqld.= " LIMIT 1"; @@ -107,32 +124,29 @@ class box_services_contracts extends ModeleBoxes if ($resultd) { $objtp = $db->fetch_object($resultd); - if ($objtp->label != '') $objp->label = $objtp->label; + if ($objtp->label != '') $contratlignestatic->label = $objtp->label; } } - $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', - 'logo' => ($objp->fk_product_type==1?'object_service':'object_product'), - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][] = array('td' => 'align="left"', + 'text' => $contratlignestatic->getNomUrl(1), + 'asis' => 1 + ); + + $this->info_box_contents[$i][] = array('td' => 'align="left"', + 'text' => $contractstatic->getNomUrl(1), + 'asis' => 1 + ); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', - 'text' => $objp->label, - 'maxlength' => 16, - 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); + $this->info_box_contents[$i][] = array('td' => 'align="left"', + 'text' => $thirdpartytmp->getNomUrl(1), + 'asis' => 1 + ); - $this->info_box_contents[$i][2] = array('td' => 'align="left" width="16"', - 'logo' => 'company', - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - - $this->info_box_contents[$i][3] = array('td' => 'align="left"', - 'text' => $objp->name, - 'maxlength' => 28, - 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - - $this->info_box_contents[$i][4] = array('td' => 'align="right"', + $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => dol_print_date($datem,'day')); - $this->info_box_contents[$i][5] = array('td' => 'align="right" width="18"', + $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $contratlignestatic->LibStatut($objp->statut,3) ); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3287ac5d4b7..15272a19d6c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -744,7 +744,8 @@ abstract class CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql.= " WHERE element_id = ".$this->id; - $sql.= " AND fk_c_type_contact IN (".$listId.")"; + if ($listId) + $sql.= " AND fk_c_type_contact IN (".$listId.")"; dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); if ($this->db->query($sql)) @@ -4473,20 +4474,24 @@ abstract class CommonObject * This function is meant to be called from replaceThirdparty with the appropiate tables * Column name fk_soc MUST be used to identify thirdparties * - * @param DoliDB $db Database handler - * @param int $origin_id Old thirdparty id (the thirdparty to delete) - * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) - * @param string[] $tables Tables that need to be changed + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id (the thirdparty to delete) + * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) + * @param string[] $tables Tables that need to be changed + * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) * @return bool */ - public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables) + public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0) { foreach ($tables as $table) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET fk_soc = '.$dest_id.' WHERE fk_soc = '.$origin_id; - if (!$db->query($sql)) { - return false; + if (! $db->query($sql)) + { + if ($ignoreerrors) return true; + //$this->errors = $db->lasterror(); + return false; } } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 914c7077c8b..35b0d4024ec 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -378,6 +378,8 @@ class Conf // Set some default values + $this->global->MAIN_ACTIVATE_HTML5=1; + // societe if (empty($this->global->SOCIETE_CODECLIENT_ADDON)) $this->global->SOCIETE_CODECLIENT_ADDON="mod_codeclient_leopard"; if (empty($this->global->SOCIETE_CODECOMPTA_ADDON)) $this->global->SOCIETE_CODECOMPTA_ADDON="mod_codecompta_panicum"; @@ -403,6 +405,7 @@ class Conf $this->global->STOCK_CALCULATE_ON_BILL=0; $this->global->STOCK_CALCULATE_ON_VALIDATE_ORDER=0; $this->global->STOCK_CALCULATE_ON_SHIPMENT=1; + $this->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE=0; $this->global->STOCK_CALCULATE_ON_SUPPLIER_BILL=0; $this->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER=0; $this->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER=1; @@ -505,7 +508,7 @@ class Conf { $this->projet->warning_delay=(isset($this->global->MAIN_DELAY_PROJECT_TO_CLOSE)?$this->global->MAIN_DELAY_PROJECT_TO_CLOSE:7)*24*60*60; $this->projet->task = new StdClass(); - $this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_ACTIONS_TODO:7)*24*60*60; + $this->projet->task->warning_delay=(isset($this->global->MAIN_DELAY_TASKS_TODO)?$this->global->MAIN_DELAY_TASKS_TODO:7)*24*60*60; } if (isset($this->commande)) { diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8d61733e138..283d189377c 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1133,7 +1133,7 @@ class ExtraFields if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) { $object = new $InfoFieldList[0]($this->db); - $object->fetch($value); + if (!empty($value)) $object->fetch($value); $valuetoshow=$object->ref; if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique $out.=''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 70a4738366d..19c779dc2d2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -254,7 +254,7 @@ class Form * @param string $value Value to show/edit * @param string $htmlname DIV ID (field name) * @param int $condition Condition to edit - * @param string $inputType Type of input ('numeric', 'datepicker', 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx') + * @param string $inputType Type of input ('string', 'numeric', 'datepicker', 'textarea:rows:cols', 'ckeditor:dolibarr_zzz:width:height:?:1:rows:cols', 'select:xxx') * @param string $editvalue When in edit mode, use this value as $value instead of value * @param object $extObject External object * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') @@ -280,6 +280,7 @@ class Form $savemethod = false; $ext_element = false; $button_only = false; + $inputOption = ''; if (is_object($object)) { @@ -299,6 +300,7 @@ class Form $inputType=$tmp[0]; if (! empty($tmp[1])) $inputOption=$tmp[1]; if (! empty($tmp[2])) $savemethod=$tmp[2]; + $out.= ''."\n"; } else if ((preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) { @@ -363,7 +365,6 @@ class Form $out.= ''."\n"; $out.= ''."\n"; } - $out.= ''.$value.''."\n"; $out.= ''.(! empty($editvalue) ? $editvalue : $value).''."\n"; } @@ -1137,8 +1138,8 @@ class Form { $obj = $this->db->fetch_object($resql); $desc=dol_trunc($obj->description,40); - if ($desc=='(CREDIT_NOTE)') $desc=$langs->trans("CreditNote"); - if ($desc=='(DEPOSIT)') $desc=$langs->trans("Deposit"); + if (preg_match('/\(CREDIT_NOTE\)/', $desc)) $desc=preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc); + if (preg_match('/\(DEPOSIT\)/', $desc)) $desc=preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc); $selectstring=''; if ($selected > 0 && $selected == $obj->rowid) $selectstring=' selected'; @@ -1603,7 +1604,7 @@ class Form * @param string $selected_input_value Value of preselected input text (for use with ajax) * @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after) * @param array $ajaxoptions Options for ajax_autocompleter - * @param int $socid Thirdparty Id + * @param int $socid Thirdparty Id (to get also price dedicated to this customer) * @return void */ function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0) @@ -1662,7 +1663,7 @@ class Form * @param int $status -1=Return all products, 0=Products not on sell, 1=Products on sell * @param int $finished Filter on finished field: 2=No filter * @param int $outputmode 0=HTML select string, 1=Array - * @param int $socid Thirdparty Id + * @param int $socid Thirdparty Id (to get also price dedicated to this customer) * @return array Array of keys for json */ function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0) @@ -1673,7 +1674,7 @@ class Form $outarray=array(); $sql = "SELECT "; - $sql.= " p.rowid, p.label, p.ref, p.description, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression"; + $sql.= " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression"; //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { @@ -1860,6 +1861,7 @@ class Form $outref=''; $outlabel=''; $outdesc=''; + $outbarcode=''; $outtype=''; $outprice_ht=''; $outprice_ttc=''; @@ -1878,6 +1880,8 @@ class Form $outref=$objp->ref; $outlabel=$objp->label; $outdesc=$objp->description; + $outbarcode=$objp->barcode; + $outtype=$objp->fk_product_type; $outdurationvalue=$outtype == Product::TYPE_SERVICE?substr($objp->duration,0,dol_strlen($objp->duration)-1):''; $outdurationunit=$outtype == Product::TYPE_SERVICE?substr($objp->duration,-1):''; @@ -1891,12 +1895,16 @@ class Form else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; } $opt.= '>'; - $opt.= $objp->ref.' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $opt.= $objp->ref; + if ($outbarcode) $opt.=' ('.$outbarcode.')'; + $opt.=' - '.dol_trunc($label,$maxlengtharticle).' - '; + $objRef = $objp->ref; if (! empty($filterkey) && $filterkey != '') $objRef=preg_replace('/('.preg_quote($filterkey).')/i','$1',$objRef,1); - $outval.=$objRef.' - '.dol_trunc($label,$maxlengtharticle).' - '; - + $outval.=$objRef; + if ($outbarcode) $outval.=' ('.$outbarcode.')'; + $outval.=' - '.dol_trunc($label,$maxlengtharticle).' - '; + $found=0; // Multiprice @@ -2322,7 +2330,7 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON pfp.fk_soc = s.rowid"; - $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; + $sql.= " WHERE p.entity IN (".getEntity('productprice', 1).")"; $sql.= " AND p.tobuy = 1"; $sql.= " AND s.fournisseur = 1"; $sql.= " AND p.rowid = ".$productid; @@ -3805,7 +3813,7 @@ class Form print ''; print '
'.$langs->trans("Num")."'.$langs->trans("Supplier")."".$langs->trans("VATIntra")."
'.$elementsup.''.$productsup.'
'.$langs->trans("Total").'
'.$langs->trans("Total").'".price($total)." 
'; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 2f1c3697058..d0962ad757e 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2015 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * @@ -267,14 +267,14 @@ if ($resql) $productstatic->type=$obj->ptype; $productstatic->ref=$obj->pref; $productstatic->entity=$obj->pentity; - print $productstatic->getNomUrl(1,'',20); + print $productstatic->getNomUrl(1,'',24); print $obj->label?' - '.dol_trunc($obj->label,16):''; if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '
'.dol_nl2br($obj->description); } else { - if ($obj->type == 0) print img_object($obj->description,'product').dol_trunc($obj->description,20); - if ($obj->type == 1) print img_object($obj->description,'service').dol_trunc($obj->description,20); + if ($obj->type == 0) print img_object($obj->description,'product').' '.dol_trunc($obj->description,24); + if ($obj->type == 1) print img_object($obj->description,'service').' '.dol_trunc($obj->description,24); } print '
'; print ($obj->date_ouverture_prevue?dol_print_date($db->jdate($obj->date_ouverture_prevue)):' '); if ($db->jdate($obj->date_ouverture_prevue) && ($db->jdate($obj->date_ouverture_prevue) < ($now - $conf->contrat->services->inactifs->warning_delay))) - print img_picto($langs->trans("Late"),"warning"); + print ' '.img_picto($langs->trans("Late"),"warning"); else print '    '; print '
'; print ''; print ''; print '
'; - print $this->selectMultiCurrency($selected, $htmlname, 1); + print $this->selectMultiCurrency($selected, $htmlname, 0); print '
'; @@ -3887,7 +3895,7 @@ class Form } else { - if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description='(DEPOSIT)')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; + if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency)).': '; } $newfilter='fk_facture IS NULL AND fk_facture_line IS NULL'; // Remises disponibles @@ -3898,7 +3906,7 @@ class Form if ($nbqualifiedlines > 0) { print '   '; } if ($more) print $more; @@ -4084,7 +4092,7 @@ class Form $out=''; $out.= ''; + $formlength=0; + + $out = ''; return $out; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 60548969376..00790ebc9fd 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -661,7 +661,7 @@ class FormFile if (count($file_list) == 0 && $headershown) { - $out.=''.$langs->trans("None").''; + $out.=''.$langs->trans("None").''; } $this->numoffiles++; @@ -928,7 +928,7 @@ class FormFile } if ($nboffiles == 0) { - print ''; + print ''; if (empty($textifempty)) print $langs->trans("NoFileFound"); else print $textifempty; print ''; @@ -1267,7 +1267,7 @@ class FormFile print ''; print ''; print ''; - print $langs->trans('Link') . ': '; + print $langs->trans('Link') . ': '; print ''; print ''; print $langs->trans('Label') . ': '; @@ -1302,7 +1302,7 @@ class FormFile } if ($nboflinks == 0) { - print ''; + print ''; print $langs->trans("NoLinkFound"); print ''; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 23b0fc5d6e2..a0afc8bcc94 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -715,9 +715,11 @@ class FormMail extends Form $out.= "\n"; } + $out.= ''."\n"; + if ($this->withform == 1 || $this->withform == -1) { - $out.= '
'; + $out.= '
'; $out.= 'withfile == 2 && $conf->use_javascript_ajax) @@ -730,11 +732,9 @@ class FormMail extends Form $out.= '     '; $out.= ''; } - $out.= '
'."\n"; + $out.= '
'."\n"; } - $out.= ''."\n"; - if ($this->withform == 1) $out.= ''."\n"; // Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index a52238be1b9..6678d87ca60 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -255,7 +255,7 @@ class FormMargin if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) { - print ''; + print ''; print ''.$langs->trans('TotalMargin').''; print ''.price($marginInfo['pv_total'], null, null, null, null, $rounding).''; print ''.price($marginInfo['pa_total'], null, null, null, null, $rounding).''; diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 8ea3221c648..7c6fc0c5a77 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -162,68 +162,52 @@ class Ldap return -1; } - if (! function_exists('ldap_connect')) + if (! function_exists("ldap_connect")) { - $this->error='Your PHP need extension ldap'; + $this->error='LDAPFunctionsNotAvailableOnPHP'; dol_syslog(get_class($this)."::connect_bind ".$this->error, LOG_WARNING); - return -1; + $return=-1; } - - // Loop on each ldap server - foreach ($this->server as $key => $host) + + if (empty($this->error)) { - if ($connected) break; - if (empty($host)) continue; - - if (preg_match('/^ldap/',$host)) + // Loop on each ldap server + foreach ($this->server as $key => $host) { - $this->connection = ldap_connect($host); - } - else - { - $this->connection = ldap_connect($host,$this->serverPort); - } - - if (is_resource($this->connection)) - { - // Begin TLS if requested by the configuration - if (! empty($conf->global->LDAP_SERVER_USE_TLS)) - { - if (! ldap_start_tls($this->connection)) - { - dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING); - $connected = 0; - $this->close(); - } - } - - // Execute the ldap_set_option here (after connect and before bind) - $this->setVersion(); - ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true. - - - if ($this->serverType == "activedirectory") + if ($connected) break; + if (empty($host)) continue; + + if (preg_match('/^ldap/',$host)) { - $result=$this->setReferrals(); - dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); - $this->result=$this->bindauth($this->searchUser,$this->searchPassword); - if ($this->result) - { - $this->bind=$this->result; - $connected=2; - break; - } - else - { - $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); - } + $this->connection = ldap_connect($host); } else { - // Try in auth mode - if ($this->searchUser && $this->searchPassword) + $this->connection = ldap_connect($host,$this->serverPort); + } + + if (is_resource($this->connection)) + { + // Begin TLS if requested by the configuration + if (! empty($conf->global->LDAP_SERVER_USE_TLS)) + { + if (! ldap_start_tls($this->connection)) + { + dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING); + $connected = 0; + $this->close(); + } + } + + // Execute the ldap_set_option here (after connect and before bind) + $this->setVersion(); + ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true. + + + if ($this->serverType == "activedirectory") { - dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); + $result=$this->setReferrals(); + dol_syslog(get_class($this)."::connect_bind try bindauth for activedirectory on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); $this->result=$this->bindauth($this->searchUser,$this->searchPassword); if ($this->result) { @@ -236,26 +220,45 @@ class Ldap $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); } } - // Try in anonymous - if (! $this->bind) + else { - dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG); - $result=$this->bind(); - if ($result) + // Try in auth mode + if ($this->searchUser && $this->searchPassword) { - $this->bind=$this->result; - $connected=1; - break; + dol_syslog(get_class($this)."::connect_bind try bindauth on ".$host." user=".$this->searchUser." password=".preg_replace('/./','*',$this->searchPassword),LOG_DEBUG); + $this->result=$this->bindauth($this->searchUser,$this->searchPassword); + if ($this->result) + { + $this->bind=$this->result; + $connected=2; + break; + } + else + { + $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); + } } - else + // Try in anonymous + if (! $this->bind) { - $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); + dol_syslog(get_class($this)."::connect_bind try bind on ".$host,LOG_DEBUG); + $result=$this->bind(); + if ($result) + { + $this->bind=$this->result; + $connected=1; + break; + } + else + { + $this->error=ldap_errno($this->connection).' '.ldap_error($this->connection); + } } } } + + if (! $connected) $this->close(); } - - if (! $connected) $this->close(); } if ($connected) @@ -823,7 +826,7 @@ class Ldap * * @param string $dn DN entry key * @param string $filter Filter - * @return int|false|array <0 or false if KO, array if OK + * @return int|array <0 or false if KO, array if OK */ function getAttribute($dn,$filter) { @@ -848,7 +851,7 @@ class Ldap { $this->ldapErrorCode = -1; $this->ldapErrorText = "Couldn't find entry"; - return false; // Couldn't find entry... + return 0; // Couldn't find entry... } // Get values @@ -856,7 +859,7 @@ class Ldap { $this->ldapErrorCode = ldap_errno($this->connection); $this->ldapErrorText = ldap_error($this->connection); - return false; // No matching attributes + return 0; // No matching attributes } // Return an array containing the attributes. diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 2e58a686f8f..c8b9cc50f01 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -264,6 +264,8 @@ class Menubase $sql.= " t.mainmenu,"; $sql.= " t.leftmenu,"; $sql.= " t.fk_menu,"; + $sql.= " t.fk_mainmenu,"; + $sql.= " t.fk_leftmenu,"; $sql.= " t.position,"; $sql.= " t.url,"; $sql.= " t.target,"; @@ -293,6 +295,8 @@ class Menubase $this->mainmenu = $obj->mainmenu; $this->leftmenu = $obj->leftmenu; $this->fk_menu = $obj->fk_menu; + $this->fk_mainmenu = $obj->fk_mainmenu; + $this->fk_leftmenu = $obj->fk_leftmenu; $this->position = $obj->position; $this->url = $obj->url; $this->target = $obj->target; diff --git a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php index cf6306f9672..65703379dbe 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php +++ b/htdocs/core/filemanagerdol/browser/default/frmresourceslist.php @@ -71,7 +71,7 @@ function ProtectPath(path) oListManager.GetFolderRowHtml = function( folderName, folderPath ) { // Build the link to view the folder. - var sLink = '' ; + var sLink = '' ; return '' + '' + @@ -84,10 +84,11 @@ oListManager.GetFolderRowHtml = function( folderName, folderPath ) '<\/td><\/tr>' ; } +// Note: fileUrl must be already "URL encoded" oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) { // Build the link to view the folder. - var sLink = '' ; + var sLink = '' ; // Get the file icon. var sIcon = oIcons.GetIcon( fileName ); @@ -123,11 +124,13 @@ function GetUrlParam( paramName ) return '' ; } +// Note fileUrl must be already "URL encoded" function OpenFile( fileUrl ) { funcNum = GetUrlParam('CKEditorFuncNum'); - window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' )); - + //window.top.opener.CKEDITOR.tools.callFunction(funcNum, encodeURI( fileUrl ).replace( '#', '%23' )); + window.top.opener.CKEDITOR.tools.callFunction(funcNum, fileUrl.replace( '#', '%23' )); + /////////////////////////////////// window.top.close(); window.top.opener.focus(); diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index a14b843b465..f1fe5365e7a 100644 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -102,6 +102,8 @@ function SendError($number, $text) { SetXmlHeaders(); + dol_syslog('Error: '.$number.' '.$text, LOG_ERR); + // Create the XML document header echo '' ; diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index 0449635aaac..3f02b9f39fb 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -266,15 +266,15 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') break ; } - $permissions = 0777; - + $permissions = '0777'; if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) { - $permissions = $Config['ChmodOnUpload'] ; + $permissions = (string) $Config['ChmodOnUpload'] ; } - + $permissionsdec = octdec($permissions); + dol_syslog("commands.php permission = ".$permissions." ".$permissionsdec." ".decoct($permissionsdec)); $oldumask = umask(0); - chmod($sFilePath, $permissions); + chmod($sFilePath, $permissionsdec); umask($oldumask); } diff --git a/htdocs/core/filemanagerdol/connectors/php/connector.php b/htdocs/core/filemanagerdol/connectors/php/connector.php index 23d4eb79d77..2f3c6f64388 100644 --- a/htdocs/core/filemanagerdol/connectors/php/connector.php +++ b/htdocs/core/filemanagerdol/connectors/php/connector.php @@ -55,8 +55,9 @@ function DoResponse() // Check if it is an allowed command if (! IsAllowedCommand($sCommand)) + { SendError(1, 'The "' . $sCommand . '" command isn\'t allowed'); - + } // Check if it is an allowed type. if (! IsAllowedType($sResourceType)) SendError(1, 'Invalid type specified'); diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 72aea0e0eb0..731509b6e10 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -181,14 +181,17 @@ function CreateServerFolder($folderPath, $lastFolder = null) } else { - $permissions = 0777 ; - if ( isset( $Config['ChmodOnFolderCreate'] ) ) + $permissions = '0777'; + if ( isset( $Config['ChmodOnFolderCreate'] ) && $Config['ChmodOnFolderCreate']) { - $permissions = $Config['ChmodOnFolderCreate'] ; + $permissions = (string) $Config['ChmodOnFolderCreate']; } + $permissionsdec = octdec($permissions); + $permissionsdec |= octdec('0111'); // Set x bit required for directories + dol_syslog("io.php permission = ".$permissions." ".$permissionsdec." ".decoct($permissionsdec)); // To create the folder with 0777 permissions, we need to set umask to zero. $oldumask = umask(0); - mkdir($folderPath, $permissions); + mkdir($folderPath, $permissionsdec); umask($oldumask); } diff --git a/htdocs/core/js/editinplace.js b/htdocs/core/js/editinplace.js index 17d70220b31..7607ba6f885 100644 --- a/htdocs/core/js/editinplace.js +++ b/htdocs/core/js/editinplace.js @@ -127,7 +127,7 @@ $(document).ready(function() { $('.editval_string').editable(urlSaveInPlace, { type : 'text', id : 'field', - width : 300, + width : withInPlace, /* Size of string area in px ? */ tooltip : tooltipInPlace, placeholder : placeholderInPlace, cancel : cancelInPlace, diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 4f08650e56b..9661f619055 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -736,17 +736,24 @@ function activateModule($value,$withdeps=1) if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends)) { // Activation des modules dont le module depend + $TError=array(); $num = count($objMod->depends); for ($i = 0; $i < $num; $i++) { + $activate = false; foreach ($modulesdir as $dir) { if (file_exists($dir.$objMod->depends[$i].".class.php")) { activateModule($objMod->depends[$i]); + $activate = true; } } + + if (!$activate) $TError[] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $objMod->depends[$i]); } + + setEventMessages('', $TError, 'errors'); } if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && ! empty($objMod->conflictwith)) diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index ad40ba84938..cdc45de825e 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -41,12 +41,13 @@ * @param int $socid Third party id * @param string $action Action string * @param array $showextcals Array with list of external calendars (used to show links to select calendar), or -1 to show no legend - * @param string|array $actioncode Preselected value(s) of actioncode for filter on type + * @param string|array $actioncode Preselected value(s) of actioncode for filter on event type * @param int $usergroupid Id of group to filter on users - * @param string $excludetype A type to exclude ('systemauto', 'system', '') + * @param string $excludetype A type to exclude ('systemauto', 'system', '') + * @param int $resourceid Preselected value of resource for filter on resource * @return void */ -function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='') +function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0) { global $conf, $user, $langs, $db, $hookmanager; global $begin_h, $end_h, $begin_d, $end_d; @@ -80,6 +81,20 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit); print ''; + if ($conf->resource->enabled) + { + include_once DOL_DOCUMENT_ROOT . '/resource/class/html.formresource.class.php'; + $formresource=new FormResource($db); + + // Resource + print ''; + print ''; + print $langs->trans("Resource"); + print '  '; + print $formresource->select_resource_list($resourceid, "resourceid", '', 1, 0, 0, null, '', 2); + print ''; + } + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; $formactions=new FormActions($db); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index b2b6d8274a5..5b8bd70a566 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -163,7 +163,7 @@ function societe_prepare_head(Societe $object) if(!empty($object->note_private)) $nbNote++; if(!empty($object->note_public)) $nbNote++; $head[$h][0] = DOL_URL_ROOT.'/societe/note.php?id='.$object->id; - $head[$h][1] = $langs->trans("Note"); + $head[$h][1] = $langs->trans("Notes"); if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; $head[$h][2] = 'note'; $h++; @@ -551,7 +551,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin else { $var = false; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } $db->free($result); } @@ -766,7 +766,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') else { print ""; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print "\n"; } print "\n\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d4f1a38fbbb..495d7ce1c3c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -436,7 +436,7 @@ function dol_size($size,$type='') */ function dol_sanitizeFileName($str,$newstr='_',$unaccent=1) { - $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"'); + $filesystem_forbidden_chars = array('<','>',':','/','\\','?','*','|','"','°'); return dol_string_nospecial($unaccent?dol_string_unaccent($str):$str, $newstr, $filesystem_forbidden_chars); } @@ -718,8 +718,8 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi { $limittitle=30; $out.=''; - if ($picto) $out.=img_picto('',($pictoisfullpath?'':'object_').$picto,'',$pictoisfullpath).' '; - $out.=dol_trunc($title,$limittitle); + if ($picto) $out.=img_picto($title,($pictoisfullpath?'':'object_').$picto,'',$pictoisfullpath).' '; + $out.=''.dol_trunc($title,$limittitle).''; $out.=''; } @@ -902,8 +902,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->product->multidir_output[$object->entity],'small',-$maxvisiblephotos,0,0,0,$width,0).'
'; else { - $nophoto='/public/theme/common/nophoto.png'; - $morehtmlleft.='
No photo
'; + if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { + $nophoto=''; + $morehtmlleft.='
'; + } + else { + $nophoto='/public/theme/common/nophoto.png'; + $morehtmlleft.='
No photo
'; + } + } } else @@ -2778,7 +2785,7 @@ function dol_print_error($db='',$error='',$errors=null) if (empty($msg)) continue; if ($_SERVER['DOCUMENT_ROOT']) // Mode web { - $out.="".$langs->trans("Message").": ".$msg."
\n" ; + $out.="".$langs->trans("Message").": ".dol_escape_htmltag($msg)."
\n" ; } else // Mode CLI { @@ -2903,8 +2910,8 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m if (! preg_match('/^&/',$options)) $options='&'.$options; //print " "; - $sortimg.= ''; - $sortimg.= ''; + //$sortimg.= ''; + //$sortimg.= ''; if (! $sortorder || $field != $sortfield) { @@ -2916,16 +2923,16 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m if ($sortorder == 'DESC' ) { //$out.= ''.img_down("A-Z",0).''; //$out.= ''.img_up("Z-A",1).''; - $sortimg.= img_up("Z-A",0); + $sortimg.= ''.img_up("Z-A",0).''; } if ($sortorder == 'ASC' ) { //$out.= ''.img_down("A-Z",1).''; //$out.= ''.img_up("Z-A",0).''; - $sortimg.= img_down("A-Z",0); + $sortimg.= ''.img_down("A-Z",0).''; } } - $sortimg.= ''; + //$sortimg.= ''; } $out.=$sortimg; @@ -2974,10 +2981,11 @@ function print_fiche_titre($title, $mesg='', $picto='title_generic.png', $pictoi * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param int $id To force an id on html objects + * @param string $morecssontable More css on table * @return string * @see print_barre_liste */ -function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id=0) +function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='') { global $conf; @@ -2987,8 +2995,8 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois if (($conf->browser->name == 'ie') && $picto=='title.png') $picto='title.gif'; $return.= "\n"; - $return.= ''; - if ($picto) $return.= ''; + $return.= '
'.img_picto('',$picto, 'id="pictotitle"', $pictoisfullpath).'
'; + if ($picto) $return.= ''; $return.= ''; @@ -4128,8 +4136,7 @@ function yn($yesno, $case=1, $color=0) /** * Return a path to have a directory according to object. * New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') - * Old usage: '001' with level 3->"0/0/1/", '015' with level 3->"0/1/5/" - * Old usage: 'ABC-1' with level 3 ->"0/0/1/", '015' with level 1->"5/" + * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/" * * @param string $num Id of object (deprecated, $object will be used in future) * @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future) @@ -4864,6 +4871,7 @@ function get_htmloutput_mesg($mesgstring='',$mesgarray='', $style='ok', $keepemb if (block) { $.dolEventValid("","'.dol_escape_js($out).'"); } else { + /* jnotify(message, preset of message type, keepmessage) */ $.jnotify("'.dol_escape_js($out).'", "'.($style=="ok" ? 3000 : $style).'", '.($style=="ok" ? "false" : "true").', @@ -5321,6 +5329,7 @@ function printCommonFooter($zone='private') print "\n"; if (! empty($conf->use_javascript_ajax)) { + print ''."\n"; print ''."\n"; } diff --git a/htdocs/core/lib/loan.lib.php b/htdocs/core/lib/loan.lib.php index 9dbb2a9664b..fa80fe31a2b 100644 --- a/htdocs/core/lib/loan.lib.php +++ b/htdocs/core/lib/loan.lib.php @@ -41,15 +41,15 @@ function loan_prepare_head($object) $head[$tab][2] = 'card'; $tab++; - if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) - { - $nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1); - $head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id; - $head[$tab][1] = $langs->trans("Notes"); - if($nbNote > 0) $head[$tab][1].= ' '.$nbNote.''; - $head[$tab][2] = 'note'; - $tab++; - } + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1); + $head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id; + $head[$tab][1] = $langs->trans("Notes"); + if($nbNote > 0) $head[$tab][1].= ' '.$nbNote.''; + $head[$tab][2] = 'note'; + $tab++; + } // Show more tabs from modules // Entries must be declared in modules descriptor with line diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index f831de667bd..2a8074f6276 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1948,7 +1948,7 @@ function pdf_getLinkedObjects($object,$outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefSending"); if (! empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'].=' / '; $linkedobjects[$objecttype]['ref_value'].= $outputlangs->transnoentities($elementobject->ref); - //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateSending"); + //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("DateShipment"); //if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / '; //$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } @@ -1957,7 +1957,7 @@ function pdf_getLinkedObjects($object,$outputlangs) $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref); - //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateSending") : ''); + //$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ($elementobject->date_delivery ? ' / ' . $outputlangs->transnoentities("DateShipment") : ''); //if (empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs); //$linkedobjects[$objecttype]['date_value'].= ($elementobject->date_delivery ? ' / ' . dol_print_date($elementobject->date_delivery,'day','',$outputlangs) : ''); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7cb0e35e463..3aa000256ed 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -44,8 +44,10 @@ function project_prepare_head($object) $head[$h][2] = 'project'; $h++; + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id; $head[$h][1] = $langs->trans("ProjectContact"); + if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.''; $head[$h][2] = 'contact'; $h++; @@ -131,8 +133,10 @@ function task_prepare_head($object) $head[$h][2] = 'task_task'; $h++; + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/contact.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); $head[$h][1] = $langs->trans("TaskRessourceLinks"); + if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.''; $head[$h][2] = 'task_contact'; $h++; @@ -162,6 +166,7 @@ function task_prepare_head($object) $head[$h][0] = DOL_URL_ROOT.'/projet/tasks/document.php?id='.$object->id.(GETPOST('withproject')?'&withproject=1':''); $filesdir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($object->project->ref) . '/' .dol_sanitizeFileName($object->ref); include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $nbFiles = count(dol_dir_list($filesdir,'files',0,'','(\.meta|_preview\.png)$')); $nbLinks=Link::count($db, $object->element, $object->id); $head[$h][1] = $langs->trans('Documents'); @@ -1000,7 +1005,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks= $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")"; - $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; + $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; $sql2.= " ORDER BY p.title, p.ref"; $var=true; diff --git a/htdocs/core/lib/resource.lib.php b/htdocs/core/lib/resource.lib.php index 621cf800d99..58fffbae5b7 100644 --- a/htdocs/core/lib/resource.lib.php +++ b/htdocs/core/lib/resource.lib.php @@ -42,8 +42,10 @@ function resource_prepare_head($object) if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { - $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id; - $head[$h][1] = $langs->trans('Contact'); + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); + $head[$h][0] = DOL_URL_ROOT.'/resource/contact.php?id='.$object->id; + $head[$h][1] = $langs->trans('ContactsAddresses'); + if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.''; $head[$h][2] = 'contact'; $h++; } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 52e0b9b9e96..2c362a42c2c 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -62,11 +62,16 @@ function shipping_prepare_head($object) } } - $head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id; - $head[$h][1] = $langs->trans("ContactsAddresses"); - $head[$h][2] = 'contact'; - $h++; - + if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { + $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); + $head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id; + $head[$h][1] = $langs->trans("ContactsAddresses"); + if ($nbContact > 0) $head[$h][1].= ' '.$nbContact.''; + $head[$h][2] = 'contact'; + $h++; + } + $nbNote = 0; if (!empty($object->note_private)) $nbNote++; if (!empty($object->note_public)) $nbNote++; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index e900931037e..6fc0c9f013f 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -109,11 +109,17 @@ function tree_showpad(&$fulltree,$key,$silent=0) * @param int $pere Array with parent ids ('rowid'=>,'mainmenu'=>,'leftmenu'=>,'fk_mainmenu=>,'fk_leftmenu=>) * @param int $rang Level of element * @param string $iddivjstree Id to use for parent ul element + * @param int $donoresetalreadyloaded Do not reset global array $donoresetalreadyloaded used to avoid to go down on an aleady processed record + * @param int $showfk Show fk links to parent into label * @return void */ -function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree') +function tree_recur($tab, $pere, $rang, $iddivjstree='iddivjstree', $donoresetalreadyloaded=0, $showfk=0) { - if (empty($pere['rowid'])) + global $tree_recur_alreadyadded; + + if ($rang == 0 && empty($donoresetalreadyloaded)) $tree_recur_alreadyadded=array(); + + if ($rang == 0) { // Test also done with jstree and dynatree (not able to have inside label) print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index fe429f7c145..3b31cee302b 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -99,11 +99,11 @@ if ($user->rights->margins->read->all) { } // Start date -print ''; +print ''; print ''; -print ''; +print ''; print ''; diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index 79d4ceb3794..5daa387dc76 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -124,11 +124,11 @@ print '
'; print '
'.img_picto('',$picto, 'id="pictotitle"', $pictoisfullpath).''; $return.= '
'.$titre.'
'; $return.= '
'.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; $form->select_date($startdate,'startdate','','',1,"sel",1,1); print ''.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; $form->select_date($enddate,'enddate','','',1,"sel",1,1); print '
'; // Start date -print ''; +print ''; print ''; -print ''; +print ''; print ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 9977354e67a..83e173ca0ce 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -120,11 +120,11 @@ if (! $sortfield) } // Start date -print ''; +print ''; print ''; -print ''; +print ''; print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 789932320e5..d604ed5ed22 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -122,11 +122,11 @@ else { } // Start date -print ''; +print ''; print ''; -print ''; +print ''; print ''; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index b4baa550ce7..9b203ea0424 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -107,12 +107,19 @@ class MultiCurrency extends CommonObject */ public function create(User $user, $trigger = true) { - global $conf; + global $conf,$langs; dol_syslog('Currency::create', LOG_DEBUG); $error = 0; + if (self::checkCodeAlreadyExists($this->code)) + { + $error++; + $this->errors[] = $langs->trans('multicurrency_code_already_added'); + return -1; + } + if (empty($this->entity) || $this->entity <= 0) $this->entity = $conf->entity; $now=date('Y-m-d H:i:s'); @@ -505,9 +512,10 @@ class MultiCurrency extends CommonObject { $sql = 'SELECT m.rowid, mc.rate FROM '.MAIN_DB_PREFIX.'multicurrency m'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'multicurrency_rate mc ON (m.rowid = mc.fk_multicurrency)'; - // FIXME Is this comptible with SQL ? - $sql.= ' WHERE m.code = "'.$db->escape($code).'" AND mc.date_sync >= ALL (SELECT date_sync FROM '.MAIN_DB_PREFIX.'multicurrency_rate)'; - $sql.= " AND m.entity IN '".getEntity('multicurrency', 1)."'"; + $sql.= ' WHERE m.code = "'.$db->escape($code).'"'; + $sql.= " AND m.entity IN (".getEntity('multicurrency', 1).")"; + $sql.= ' ORDER BY mc.date_sync DESC LIMIT 1'; + $resql = $db->query($sql); if ($resql && $obj = $db->fetch_object($resql)) return array($obj->rowid, $obj->rate); else return array(0, 1); @@ -616,6 +624,21 @@ class MultiCurrency extends CommonObject } } } + + /** + * Check in database if the current code already exists + * + * @param string $code current code to search + * @return boolean True if exists, false if not exists + */ + public static function checkCodeAlreadyExists($code) + { + global $db; + + $currency = new MultiCurrency($db); + if ($currency->fetch('', $code) > 0) return true; + else return false; + } } /** diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ca6e6b14544..330e712cf1b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1121,7 +1121,7 @@ else else if ($object->id > 0) { // Fiche en mode edition - if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer)) + if ($action == 'edit' && ((($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)))) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -1733,7 +1733,8 @@ if (empty($reshook)) { if ($action == '' || $action == 'view') { - if ($user->rights->produit->creer || $user->rights->service->creer) + if (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer ) || + ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)) { if (! isset($object->no_button_edit) || $object->no_button_edit <> 1) print ''; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 50f5cd0c19a..982b109da99 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -131,7 +131,7 @@ class Product extends CommonObject var $status_buy; // Statut indique si le produit est un produit fini '1' ou une matiere premiere '0' var $finished; - // We must manage batch number, sell-by date and so on : '1':yes '0':no + // We must manage lot/batch number, sell-by date and so on : '1':yes '0':no var $status_batch; var $customcode; // Customs code @@ -879,9 +879,10 @@ class Product extends CommonObject * Delete a product from database (if not used) * * @param int $id Product id (usage of this is deprecated, delete should be called without parameters on a fetched object) + * @param int $notrigger Do not execute trigger * @return int < 0 if KO, 0 = Not possible, > 0 if OK */ - function delete($id=0) + function delete($id=0, $notrigger=0) { // Deprecation warning if ($id > 0) { @@ -914,7 +915,7 @@ class Product extends CommonObject { $this->db->begin(); - if (! $error) + if (! $error && empty($notrigger)) { // Call trigger $result=$this->call_trigger('PRODUCT_DELETE',$user); @@ -1353,7 +1354,8 @@ class Product extends CommonObject } $this->buyprice = $obj->price; // deprecated $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id - $this->ref_fourn = $obj->ref_fourn; // Ref supplier + $this->ref_fourn = $obj->ref_fourn; // deprecated + $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier $result=$obj->fk_product; return $result; @@ -2665,7 +2667,7 @@ class Product extends CommonObject $sql.= " WHERE fk_soc = ".$id_fourn; $sql.= " AND ref_fourn = '".$this->db->escape($ref_fourn)."'"; $sql.= " AND fk_product != ".$this->id; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('productprice', 1).")"; $resql=$this->db->query($sql); if ($resql) @@ -2688,7 +2690,7 @@ class Product extends CommonObject else $sql.= " AND (ref_fourn = '' OR ref_fourn IS NULL)"; $sql.= " AND quantity = '".$quantity."'"; $sql.= " AND fk_product = ".$this->id; - $sql.= " AND entity = ".$conf->entity; + $sql.= " AND entity IN (".getEntity('productprice', 1).")"; $resql=$this->db->query($sql); if ($resql) @@ -3477,7 +3479,7 @@ class Product extends CommonObject } // Stock decrease mode - if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { + if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { $this->stock_theorique=$this->stock_reel-$stock_commande_client+$stock_sending_client; } if (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) { diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index d0d26292251..15e44f8602d 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -116,13 +116,14 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se else if($action==='save_composed_product') { $TProduct = GETPOST('TProduct', 'array'); - if(!empty($TProduct)) + if (!empty($TProduct)) { foreach ($TProduct as $id_product => $row) { if ($row['qty'] > 0) $object->update_sousproduit($id, $id_product, $row['qty'], isset($row['incdec']) ? 1 : 0 ); else $object->del_sousproduit($id, $id_product); } + setEventMessages('RecordSaved', null); } $action=''; } @@ -282,7 +283,7 @@ if ($id > 0 || ! empty($ref)) else { print ''; - print ''; + print ''; print ''; } print '
' . $langs->trans('StartDate') . ' (' . $langs->trans("DateValidation") . ')' . $langs->trans('DateStart') . ' (' . $langs->trans("DateValidation") . ')'; $form->select_date($startdate, 'startdate', '', '', 1, "sel", 1, 1); print '' . $langs->trans('EndDate') . ' (' . $langs->trans("DateValidation") . ')' . $langs->trans('DateEnd') . ' (' . $langs->trans("DateValidation") . ')'; $form->select_date($enddate, 'enddate', '', '', 1, "sel", 1, 1); print ''.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; $form->select_date($startdate,'startdate','','',1,"sel",1,1); print ''.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; $form->select_date($enddate,'enddate','','',1,"sel",1,1); print ''.$langs->trans('StartDate').' ('.$langs->trans("DateValidation").')'.$langs->trans('DateStart').' ('.$langs->trans("DateValidation").')'; $form->select_date($startdate,'startdate','','',1,"sel",1,1); print ''.$langs->trans('EndDate').' ('.$langs->trans("DateValidation").')'.$langs->trans('DateEnd').' ('.$langs->trans("DateValidation").')'; $form->select_date($enddate,'enddate','','',1,"sel",1,1); print '
'.$langs->trans("None").''.$langs->trans("None").'
'; @@ -453,7 +454,7 @@ if ($id > 0 || ! empty($ref)) if (! empty($conf->stock->enabled)) $colspan++; print ''; - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; print ''; } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index ebc3b4eb6e5..c51bf7fae01 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -155,7 +155,7 @@ if (empty($reshook)) { $error++; $langs->load("errors"); - setEventMessages($langs->trans("ErrorFieldMustBeANumeric",'eeee'), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("VATRateForSupplierProduct")), null, 'errors'); } if (empty($quantity)) { diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 0fdafd64ae5..c95156b4393 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -73,7 +73,8 @@ $pagenext = $page + 1; if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; -$contextpage='productservicelist'; +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'productservicelist'; if ($type === '1') { $contextpage='servicelist'; if ($search_type=='') $search_type='1'; } if ($type === '0') { $contextpage='productlist'; if ($search_type=='') $search_type='0'; } @@ -334,7 +335,8 @@ else } $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($search_categ > 0) $param.="&search_categ=".$search_categ; if ($sref) $param="&sref=".$sref; if ($search_ref_supplier) $param="&search_ref_supplier=".$search_ref_supplier; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 67bb3165fb6..694297b5b2f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1315,7 +1315,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action=='showlog_default_ { $objp = $db->fetch_object($result); $var = ! $var; - print ""; + print ''; // Date print "" . dol_print_date($db->jdate($objp->dp), "dayhour") . ""; diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 3a01d952acd..138cfe45a2b 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -146,7 +146,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') // Choice of type of product if (! empty($conf->dol_use_jmobile)) print "\n".'
'."\n"; - if ((string) $type != '0') print 'id).'&type=0">'; + if ((string) $type != '0') print 'id).'&type=0'.($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("Products"); if ((string) $type != '0') print ''; @@ -154,7 +154,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') if (! empty($conf->dol_use_jmobile)) print '
'."\n".'
'."\n"; else print '   /   '; - if ((string) $type != '1') print 'id).'&type=1">'; + if ((string) $type != '1') print 'id).'&type=1'.($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("Services"); if ((string) $type != '1') print ''; @@ -162,7 +162,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') if (! empty($conf->dol_use_jmobile)) print '
'."\n".'
'."\n"; else print '   /   '; - if ((string) $type == '0' || (string) $type == '1') print 'id).'">'; + if ((string) $type == '0' || (string) $type == '1') print 'id).($mode?'&mode='.$mode:'').'">'; else print img_picto('','tick').' '; print $langs->trans("ProductsAndServices"); if ((string) $type == '0' || (string) $type == '1') print ''; @@ -172,7 +172,7 @@ if (! empty($id) || ! empty($ref) || GETPOST('id') == 'all') print '
'; } - // Choice of stats + // Choice of stats mode (byunit or bynumber) if (! empty($conf->dol_use_jmobile)) print "\n".'
'."\n"; if ($mode == 'bynumber') print 'id).($type != '' ? '&type='.$type:'').'&mode=byunit">'; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 659bea1f5a8..9dcb51fe8ef 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -197,7 +197,7 @@ if ($action == 'create') $doleditor->Create(); print ''; - print ''.$langs->trans('Address').''; @@ -546,7 +546,7 @@ else $doleditor->Create(); print ''; - print ''.$langs->trans('Address').''; diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index b9859f9ec9b..a19a39beb45 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -126,7 +126,6 @@ class MouvementStock extends CommonObject return -2; } - // FIXME Code not complete to implement this // Check table llx_product_lot from batchnumber for same product // If found and eatby/sellby defined into table and provided and differs, return error // If found and eatby/sellby defined into table and not provided, we take value from table @@ -218,7 +217,7 @@ class MouvementStock extends CommonObject $i++; } } - else + else // If not found, we add record { $productlot = new Productlot($this->db); $productlot->fk_product = $fk_product; diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 58f95625d94..a1f19958cc9 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -108,7 +108,8 @@ if ($result) llxHeader("",$langs->trans("ListOfWarehouses"),$help_url); $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; print ''; print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index b18ca146a25..8c5f55fb8af 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -66,7 +66,29 @@ if (! $sortorder) $sortorder="DESC"; $pdluoid=GETPOST('pdluoid','int'); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'movementlist'; + +// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('movement'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + + + +/* + * Actions + */ + +if ($cancel) $action=''; // Protection to avoid action for all cancel buttons + +include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + +// Do we click on purge search criteria ? +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $year=''; $month=''; @@ -77,15 +99,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_user=""; $search_batch=""; $sall=""; + $search_array_options=array(); } - -/* - * Actions - */ - -if ($cancel) $action=''; // Protection to avoid action for all cancel buttons - // Correct stock if ($action == "correct_stock") { @@ -344,10 +360,7 @@ $sql.= " WHERE m.fk_product = p.rowid"; $sql.= " AND m.fk_entrepot = e.rowid"; $sql.= " AND e.entity IN (".getEntity('stock', 1).")"; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) $sql.= " AND p.fk_product_type = 0"; -if ($id) -{ - $sql.= " AND e.rowid ='".$id."'"; -} +if ($id > 0) $sql.= " AND e.rowid ='".$id."'"; if ($month > 0) { if ($year > 0) @@ -359,17 +372,14 @@ else if ($year > 0) { $sql.= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } -if ($idproduct > 0) -{ - $sql.= " AND p.rowid = '".$idproduct."'"; -} -if (! empty($search_movement)) $sql.= " AND m.label LIKE '%".$db->escape($search_movement)."%'"; -if (! empty($search_inventorycode)) $sql.= " AND m.inventorycode LIKE '%".$db->escape($search_inventorycode)."%'"; -if (! empty($search_product_ref)) $sql.= " AND p.ref LIKE '%".$db->escape($search_product_ref)."%'"; -if (! empty($search_product)) $sql.= " AND p.label LIKE '%".$db->escape($search_product)."%'"; -if (! empty($search_warehouse)) $sql.= " AND e.rowid = '".$db->escape($search_warehouse)."'"; -if (! empty($search_user)) $sql.= " AND u.login LIKE '%".$db->escape($search_user)."%'"; -if (! empty($search_batch)) $sql.= " AND m.batch LIKE '%".$db->escape($search_batch)."%'"; +if ($idproduct > 0) $sql.= " AND p.rowid = '".$idproduct."'"; +if (! empty($search_movement)) $sql.= natural_search('m.label', $search_movement); +if (! empty($search_inventorycode)) $sql.= natural_search('m.inventorycode', $search_inventorycode); +if (! empty($search_product_ref)) $sql.= natural_search('p.ref', $search_product_ref); +if (! empty($search_product)) $sql.= natural_search('p.label', $search_product); +if ($search_warehouse > 0) $sql.= " AND e.rowid = '".$db->escape($search_warehouse)."'"; +if (! empty($search_user)) $sql.= natural_search('u.login', $search_user); +if (! empty($search_batch)) $sql.= natural_search('m.batch', $search_batch); $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -527,89 +537,6 @@ if ($resql) print '
'; } - /* - * Correct stock - */ - /* - if ($action == "correction") - { - print load_fiche_titre($langs->trans("StockCorrection")); - print ''."\n"; - print ''; - print ''; - print ''; - - // Product - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Label - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Product").''; - print $form->select_produits(GETPOST('productid'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); - print ''; - print ''.$langs->trans("NumberOfUnit").'
'.$langs->trans("Label").''; - print ''; - print '
'; - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print ''; - } - - if ($action == "transfert") - { - print load_fiche_titre($langs->trans("Transfer")); - print '
'."\n"; - print ''; - print ''; - print ''; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - // Label - print ''; - print ''; - print ''; - print ''; - - print '
'.$langs->trans("Product").''; - print $form->select_produits(GETPOST('productid'),'product_id'); - print ''.$langs->trans("WarehouseTarget").''; - print $formproduct->selectWarehouses('','id_entrepot_destination','',1); - print ''.$langs->trans("NumberOfUnit").'
'.$langs->trans("Label").''; - print ''; - print '
'; - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print '
'; - } - */ /* ************************************************************************** */ /* */ @@ -636,22 +563,40 @@ if ($resql) $param=''; - if ($id > 0) $param.='&id='.$id; - if ($search_movement) $param.='&search_movement='.urlencode($search_movement); + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($id > 0) $param.='&id='.$id; + if ($search_movement) $param.='&search_movement='.urlencode($search_movement); if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); - if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); - if ($search_product) $param.='&search_product='.urlencode($search_product); - if ($search_warehouse) $param.='&search_warehouse='.urlencode($search_warehouse); - if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined - if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined - if ($search_user) $param.='&search_user='.urlencode($search_user); - if ($idproduct > 0) $param.='&idproduct='.$idproduct; - if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords,''); - else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords); - - print '
'; + if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); + if ($search_product) $param.='&search_product='.urlencode($search_product); + if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse); + if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined + if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined + if ($search_user) $param.='&search_user='.urlencode($search_user); + if ($idproduct > 0) $param.='&idproduct='.$idproduct; + // Add $param from extra fields + foreach ($search_array_options as $key => $val) + { + $crit=$val; + $tmpkey=preg_replace('/search_options_/','',$key); + if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); + } + + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; if ($id > 0) print ''; - + + if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, '', 0, '', '', $limit); + else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit); + print ''; print ""; //print_liste_field_titre($langs->trans("Id"),$_SERVER["PHP_SELF"], "m.rowid","",$param,"",$sortfield,$sortorder); @@ -669,8 +614,9 @@ if ($resql) print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("InventoryCodeShort"),$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("LabelMovement"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Units"),$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Qty"),$_SERVER["PHP_SELF"], "m.value","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(""); print "\n"; // Lignes des champs de filtre @@ -722,17 +668,21 @@ if ($resql) print ''; - + // Qty + print ''; + // Actions print ''; print "\n"; $arrayofuniqueproduct=array(); $var=True; - while ($i < min($num,$conf->liste_limit)) + while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); @@ -799,6 +749,9 @@ if ($resql) print ''; + + print ''; + print "\n"; $i++; } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 1b4c159b1d6..d8051465626 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -485,25 +485,26 @@ if ($id > 0 || $ref) } // Stock alert threshold - print ''; // Desired stock - print ''; // Real stock $text_stock_options = ''; - $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'
':''); + $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)?$langs->trans("DeStockOnShipment").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)?$langs->trans("ReStockOnBill").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)?$langs->trans("ReStockOnValidateOrder").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)?$langs->trans("ReStockOnDispatchOrder").'
':''); print ''; print ''; - print ''; + print ''; if (!empty($conf->service->enabled) && $type == 1) { diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index d9f02781fd5..b137bde592e 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -56,14 +56,14 @@ { print ''; print ''; } if ($object->element == 'stock') { print ''; print ''; } print ''; - // Opportunity status - print ''; - - // Opportunity Amount - print ''; - + if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + // Opportunity status + print ''; + + // Opportunity Amount + print ''; + } + // Budget print '\n"; @@ -558,6 +560,9 @@ if ($resql) $projectstatic->user_author_id = $obj->fk_user_creat; $projectstatic->public = $obj->public; $projectstatic->ref = $obj->ref; + $projectstatic->datee = $obj->date_end; + $projectstatic->statut = $obj->fk_statut; + $projectstatic->opp_status = $obj->fk_opp_status; $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) @@ -570,6 +575,7 @@ if ($resql) { print ''; } // Title @@ -621,6 +627,8 @@ if ($resql) $userstatic->lastname=$val['lastname']; $userstatic->firstname=$val['firstname']; $userstatic->email=$val['email']; + $userstatic->statut=$val['statut']; + $userstatic->entity=$val['entity']; print $userstatic->getNomUrl(1); $j++; if ($j < $nbofsalesrepresentative) print ', '; @@ -656,10 +664,11 @@ if ($resql) else print $langs->trans('PrivateProject'); print ''; } + // Amount if (! empty($arrayfields['p.opp_amount']['checked'])) { print ''; } if (! empty($arrayfields['p.fk_opp_status']['checked'])) diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index 47423491930..43df7ce3b3d 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -84,7 +84,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + // Budget + print ''; + print "
'; print '  '; print ''; + print '  '; + print ''; - print ''; - print ''; + $searchpitco=$form->showFilterAndCheckAddButtons(0); + print $searchpitco; print '
'; if ($objp->value > 0) print '+'; print $objp->value.'
'.$form->editfieldkey("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; - print $form->editfieldval("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer); + print '
'.$form->editfieldkey("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; + print $form->editfieldval("StockLimit",'seuil_stock_alerte',$object->seuil_stock_alerte,$object,$user->rights->produit->creer,'string'); print '
'.$form->editfieldkey("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer).''; - print $form->editfieldval("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer); + print '
'.$form->editfieldkey($form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1),'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer); + print ''; + print $form->editfieldval("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer,'string'); print '
'; - print $form->textwithtooltip($langs->trans("PhysicalStock"), $text_stock_options, 2, 1, img_picto('', 'info'), '', 2); + print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); print ''.$object->stock_reel; if ($object->seuil_stock_alerte != '' && ($object->stock_reel < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index a8fd68f6a34..65bd340fa85 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -305,16 +305,14 @@ if ($resql) $num = $db->num_rows($resql); $params=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - -if ($search_entity != '') $params.= '&search_entity='.urlencode($search_entity); -if ($search_fk_product != '') $params.= '&search_fk_product='.urlencode($search_fk_product); -if ($search_batch != '') $params.= '&search_batch='.urlencode($search_batch); -if ($search_fk_user_creat != '') $params.= '&search_fk_user_creat='.urlencode($search_fk_user_creat); -if ($search_fk_user_modif != '') $params.= '&search_fk_user_modif='.urlencode($search_fk_user_modif); -if ($search_import_key != '') $params.= '&search_import_key='.urlencode($search_import_key); - - + if ($search_entity != '') $params.= '&search_entity='.urlencode($search_entity); + if ($search_fk_product != '') $params.= '&search_fk_product='.urlencode($search_fk_product); + if ($search_batch != '') $params.= '&search_batch='.urlencode($search_batch); + if ($search_fk_user_creat != '') $params.= '&search_fk_user_creat='.urlencode($search_fk_user_creat); + if ($search_fk_user_modif != '') $params.= '&search_fk_user_modif='.urlencode($search_fk_user_modif); + if ($search_import_key != '') $params.= '&search_import_key='.urlencode($search_import_key); if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields foreach ($search_array_options as $key => $val) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 21f492e0c00..25dd6728df8 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -1,7 +1,8 @@ - * Copyright (C) 2013-2015 Laurent Destaileur + * Copyright (C) 2013-2016 Laurent Destaileur * Copyright (C) 2014 Regis Houssin + * Copyright (C) 2016 Juanjo Menent * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -71,7 +72,9 @@ if (!$sortorder) { // Define virtualdiffersfromphysical $virtualdiffersfromphysical=0; -if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) +if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) +|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) +|| ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. } @@ -238,7 +241,7 @@ $form = new Form($db); $title = $langs->trans('Status'); -$sql = 'SELECT p.rowid, p.ref, p.label, p.price,'; +$sql = 'SELECT p.rowid, p.ref, p.label,p.description, p.price,'; $sql.= ' p.price_ttc, p.price_base_type,p.fk_product_type,'; $sql.= ' p.tms as datem, p.duration, p.tobuy,'; $sql.= ' p.desiredstock, p.seuil_stock_alerte as alertstock,'; @@ -487,7 +490,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) { - $sql = 'SELECT label'; + $sql = 'SELECT label,description'; $sql .= ' FROM ' . MAIN_DB_PREFIX . 'product_lang'; $sql .= ' WHERE fk_product = ' . $objp->rowid; $sql .= ' AND lang = "' . $langs->getDefaultLang() . '"'; @@ -497,6 +500,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) if ($resqlm) { $objtp = $db->fetch_object($resqlm); + if (!empty($objtp->description)) $objp->description = $objtp->description; if (!empty($objtp->label)) $objp->label = $objtp->label; } } @@ -554,7 +558,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''.$prod->getNomUrl(1, '').'' . $objp->label . '' . $objp->label . ''.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')),'id_entrepot','',1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', '', 1); print ''.$langs->trans("Product").''; - print $form->select_produits(GETPOST('product_id'),'product_id',(empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); + print $form->select_produits(GETPOST('product_id'), 'product_id', (empty($conf->global->STOCK_SUPPORTS_SERVICES)?'0':'')); print ''; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index c489910064d..e7ce1625aad 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -741,7 +741,7 @@ else $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { @@ -886,7 +886,7 @@ else } // Close - if (($object->statut == 0 || $object->statut == 1) && $user->rights->projet->creer) + if ($object->statut == 1 && $user->rights->projet->creer) { if ($userWrite > 0) { @@ -956,7 +956,6 @@ else } if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->creer) { - $langs->load("expensereports"); $langs->load("trips"); print ''; } @@ -981,9 +980,9 @@ else } // Delete - if ($user->rights->projet->supprimer) + if ($user->rights->projet->supprimer || ($object->statut == 0 && $user->rights->projet->creer)) { - if ($userDelete > 0) + if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer)) { print ''; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1de8027dd0e..236a8154578 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -1627,8 +1627,8 @@ class Project extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $conf->projet->warning_delay/60/60/24; $response->label = $langs->trans("OpenedProjects"); - if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/index.php?search_status=1&mainmenu=project'; - else $response->url = DOL_URL_ROOT.'/projet/index.php?mode=mine&search_status=1&mainmenu=project'; + if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project'; + else $response->url = DOL_URL_ROOT.'/projet/list.php?mode=mine&search_status=1&mainmenu=project'; $response->img = img_object($langs->trans("Projects"),"project"); // This assignment in condition is not a bug. It allows walking the results. @@ -1711,7 +1711,7 @@ class Project extends CommonObject /** - * Is the action delayed? + * Is the project delayed? * * @return bool */ @@ -1719,9 +1719,8 @@ class Project extends CommonObject { global $conf; - if (! ($this->statut == 1)) { - return false; - } + if (! ($this->statut == 1)) return false; + if (! $this->datee) return false; $now = dol_now(); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index ea156b340d5..6db12174539 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1599,7 +1599,7 @@ class Task extends CommonObject $task_static->projectstatus = $obj->projectstatus; $task_static->progress = $obj->progress; $task_static->fk_statut = $obj->status; - $task_static->datee = $this->db->jdate($obj->datee); + $task_static->date_end = $this->db->jdate($obj->datee); if ($task_static->hasDelay()) { $response->nbtodolate++; @@ -1616,7 +1616,7 @@ class Task extends CommonObject } /** - * Is the action delayed? + * Is the task delayed? * * @return bool */ @@ -1630,6 +1630,8 @@ class Task extends CommonObject $now = dol_now(); - return ($this->datee > 0 && $this->datee < ($now - $conf->projet->task->warning_delay)); + $datetouse = ($this->date_end > 0) ? $this->date_end : ($this->datee > 0 ? $this->datee : 0); + + return ($datetouse > 0 && ($datetouse < ($now - $conf->projet->task->warning_delay))); } } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 3ef4f777124..794e9c3af00 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -157,7 +157,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'.$langs->trans('Ref').''; + print '
'.$langs->trans('Ref').''; // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { @@ -196,17 +196,20 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print '
'.$langs->trans("OpportunityStatus").''; - $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); - if ($code) print $langs->trans("OppStatus".$code); - print '
'.$langs->trans("OpportunityAmount").''; - if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); - print '
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("OpportunityAmount").''; + if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); + print '
'.$langs->trans("Budget").''; if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index d75c503445c..d59dec0dc4a 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -111,7 +111,7 @@ if ($object->id > 0) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index fe6fe738110..1664f2e7269 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -121,7 +121,7 @@ print ''; $linkback = ''.$langs->trans("BackToList").''; -print ''; -// Opportunity status -print ''; - -// Opportunity Amount -print ''; +if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) +{ + // Opportunity status + print ''; + + // Opportunity Amount + print ''; +} // Budget print ''; - + // Budget + print ''; + print '
'.$langs->trans("Ref").''; +print '
'.$langs->trans("Ref").''; // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { @@ -157,16 +157,19 @@ print '
'.$langs->trans("DateEnd").''; print dol_print_date($object->date_end,'day'); print '
'.$langs->trans("OpportunityStatus").''; -$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); -if ($code) print $langs->trans("OppStatus".$code); -print '
'.$langs->trans("OpportunityAmount").''; -if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); -print '
'.$langs->trans("OpportunityStatus").''; + $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); + if ($code) print $langs->trans("OppStatus".$code); + print '
'.$langs->trans("OpportunityAmount").''; + if (strcmp($object->opp_amount,'')) print price($object->opp_amount,'',$langs,0,0,0,$conf->currency); + print '
'.$langs->trans("Budget").''; diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 822489b643a..b86a961bd69 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -103,7 +103,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print '
'; + print '
'; print $langs->trans("Ref"); print ''; // Define a complementary filter for search of next/prev ref. @@ -142,7 +142,11 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print '
'.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + print '
'; print ''; @@ -263,7 +267,7 @@ if (count($tasksarray)>0) } else { - print $langs->trans("NoTasks"); + print '
'.$langs->trans("NoTasks").'
'; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 7968b0a809a..ce2ff974013 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -90,8 +90,8 @@ $year = GETPOST('year','int'); if ($search_status == '') $search_status=-1; // -1 or 1 -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$contextpage='projectlist'; +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'projectlist'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array($contextpage)); @@ -308,7 +308,8 @@ if ($resql) $num = $db->num_rows($resql); $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sday) $param.='&sday='.$day; if ($smonth) $param.='&smonth='.$smonth; if ($syear) $param.='&syear=' .$syear; @@ -346,7 +347,8 @@ if ($resql) print ''; print ''; print ''; - + print ''; + print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'title_project', 0, '', '', $limit); // Show description of content @@ -425,7 +427,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "
'; print $projectstatic->getNomUrl(1); + if ($projectstatic->hasDelay()) print img_warning($langs->trans('Late')); print ''; - if ($obj->opp_status_code) print price($obj->opp_amount, 1, '', 1, -1, -1, $conf->currency); + if ($obj->opp_status_code) print price($obj->opp_amount, 1, '', 1, -1, -1, ''); print '
'.$langs->trans("Ref").''; + print '
'.$langs->trans("Ref").''; // Define a complementary filter for search of next/prev ref. if (! $user->rights->projet->all->lire) { @@ -122,11 +122,16 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print '
'.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + print '
"; print '
'; - $colwidth=30; + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; dol_fiche_end(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f1400cb4643..3d61c96299b 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -209,7 +209,7 @@ if ($id > 0 || ! empty($ref)) $linkback = ''.$langs->trans("BackToList").''; // Ref - print ''; + print ''; print $langs->trans("Ref"); print ''; // Define a complementary filter for search of next/prev ref. @@ -248,6 +248,11 @@ if ($id > 0 || ! empty($ref)) print dol_print_date($object->date_end,'day'); print ''; + // Budget + print ''.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount,'',$langs,0,0,0,$conf->currency); + print ''; + // Other options $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook @@ -274,7 +279,8 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; if (! empty($object->id)) print ''; if (! empty($mode)) print ''; - + print ''; + dol_fiche_head(''); print ''; @@ -291,8 +297,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (is_numeric($defaultref) && $defaultref <= 0) $defaultref=''; // Ref - print ''; - print ''; + print ''; print ''; + print ''; } print "
'.$langs->trans("Ref").''.($_POST["ref"]?$_POST["ref"]:$defaultref).'
'.$langs->trans("Ref").''.($_POST["ref"]?$_POST["ref"]:$defaultref).'
'.$langs->trans("Label").''; print ''; @@ -444,7 +449,7 @@ else if ($id > 0 || ! empty($ref)) } else { - print '
'.$langs->trans("NoTasks").'
'.$langs->trans("NoTasks").'
"; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 8ec4eeffedb..52e01d445a8 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2006-2016 Laurent Destailleur * Copyright (C) 2006-2010 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -58,8 +58,8 @@ $day = GETPOST('day','int'); $month = GETPOST('month','int'); $year = GETPOST('year','int'); -// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array -$contextpage='tasklist'; +// Initialize context for list +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'tasklist'; // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array($contextpage)); @@ -213,7 +213,7 @@ else dol_print_error($db); if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0]='0'; // To avoid sql syntax error if not found $distinct='DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. -$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate"; +$sql = "SELECT ".$distinct." p.rowid as projectid, p.ref as projectref, p.title as projecttitle, p.fk_statut as projectstatus, p.datee as projectdatee, p.fk_opp_status, p.public, p.fk_user_creat as projectusercreate"; $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", t.datec as date_creation, t.dateo as date_start, t.datee as date_end, t.tms as date_update"; $sql.= ", t.rowid as id, t.ref, t.label, t.planned_workload, t.duration_effective, t.progress, t.fk_statut"; @@ -314,6 +314,7 @@ if ($resql) $num = $db->num_rows($resql); $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sday) $param.='&sday='.$day; if ($smonth) $param.='&smonth='.$smonth; @@ -550,12 +551,15 @@ if ($resql) $projectstatic->title = $obj->projecttitle; $projectstatic->public = $obj->public; $projectstatic->statut = $obj->projectstatus; + $projectstatic->datee = $db->jdate($obj->projectdatee); $taskstatic->id = $obj->id; $taskstatic->ref = $obj->ref; $taskstatic->label = $obj->label; $taskstatic->fk_statut = $obj->fk_statut; $taskstatic->progress = $obj->progress; + $taskstatic->datee = $db->jdate($obj->date_end); // deprecated + $taskstatic->date_end = $db->jdate($obj->date_end); $userAccess = $projectstatic->restrictedProjectArea($user); // why this ? if ($userAccess >= 0) @@ -568,6 +572,7 @@ if ($resql) { print ''; print $projectstatic->getNomUrl(1, 'task'); + if ($projectstatic->hasDelay()) print img_warning("Late"); print ''; } // Title @@ -605,6 +610,7 @@ if ($resql) { print ''; print $taskstatic->getNomUrl(1,'withproject'); + if ($taskstatic->hasDelay()) print img_warning("Late"); print ''; } // Label diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 8c1d1fc40cb..5b3b8c9fe61 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -437,6 +437,7 @@ if ($id > 0 || ! empty($ref)) // Date end print ''.$langs->trans("DateEnd").''; print dol_print_date($object->date_end,'dayhour'); + if ($object->hasDelay()) print img_warning("Late"); print ''; // Planned workload diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 29c3cd85bad..b69c731a1d7 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -408,7 +408,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0) /* * Form to add time spent */ - if ($user->rights->projet->creer) + if ($user->rights->projet->lire) { print '
'; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 2fb6fb61a91..c026ad859e5 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -460,7 +460,7 @@ print ''.$langs->trans("Firstname").' *'.$langs->trans("Company").''."\n"; // Address print ''.$langs->trans("Address").''."\n"; -print ''."\n"; +print ''."\n"; // Zip / Town print ''.$langs->trans('Zip').' / '.$langs->trans('Town').''; print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town','selectcountry_id','state_id'), 6, 1); diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index 44911b8fa9b..28ff4bdb743 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -30,7 +30,7 @@ if (empty($usedolheader)) Test page - + @@ -40,6 +40,7 @@ if (empty($usedolheader)) + @@ -87,8 +88,9 @@ This page is a sample of page using tables. It is designed to make test with
- tablednd
-


Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form
+ +


Example 0a : Table with div+div+div containg a select that should be overflowed and truncated => Use this to align text or form
@@ -127,12 +129,31 @@ This page is a sample of page using tables. It is designed to make test with
- +


Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines or for long result tables
+ + + + -" id="tablelines3"> + +
" id="tablelines3"> +trans('title1'),0,$_SERVER["PHP_SELF"],'aaa','','','align="left"',$sortfield,$sortorder); ?> trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?> trans('title3'),0,$_SERVER["PHP_SELF"],'ccc','','','align="center"',$sortfield,$sortorder); ?> + + - + +
getNomUrl(1); ?>b1c1
a2b2c2
a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2 a2b2c2
a3b3c3
+ +
@@ -323,7 +351,7 @@ $('xxxth').replaceWith( line2 dfsdf - xxx + xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx line3 diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 163eeab13ce..95f5cf0574b 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -168,22 +168,22 @@ if ( $object->fetch($id) > 0 ) print ''; print ''; - dol_fiche_head($head, 'resource', $langs->trans("ResourceSingular"),0,'resource@resource'); + dol_fiche_head($head, 'resource', $langs->trans("ResourceSingular"),0,'resource'); print ''; // Ref - print ''; + print ''; print ''; // Type - print ''; + print ''; print ''; // Description - print ''; + print ''; print ''; @@ -201,7 +201,7 @@ if ( $object->fetch($id) > 0 ) } else { - dol_fiche_head($head, 'resource', $langs->trans("ResourceSingular"),0,'resource@resource'); + dol_fiche_head($head, 'resource', $langs->trans("ResourceSingular"),0,'resource'); // Confirm deleting resource line if ($action == 'delete') @@ -215,7 +215,7 @@ if ( $object->fetch($id) > 0 ) */ print '
'.$langs->trans("ResourceFormLabel_ref").'
'.$langs->trans("ResourceFormLabel_ref").'
'.$langs->trans("ResourceType").'
'.$langs->trans("ResourceType").''; $ret = $formresource->select_types_resource($object->fk_code_type_resource,'fk_code_type_resource','',2); print '
'.$langs->trans("Description").'
'.$langs->trans("Description").''; print ''; print '
'; - print ''; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 87794b92392..4f08e6f4209 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -875,7 +875,7 @@ class Dolresource extends CommonObject if ($option == '') { $link = ''; - $picto='resource@resource'; + $picto='resource'; $label=$langs->trans("ShowResource").': '.$this->ref; } diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 891ed33d1e5..b094aacd1ea 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -17,11 +17,12 @@ */ /** - * \file place/class/html.formresource.class.php + * \file resource/class/html.formresource.class.php * \ingroup core * \brief Class file to manage forms into resource module */ require_once(DOL_DOCUMENT_ROOT ."/core/class/html.form.class.php"); +require_once(DOL_DOCUMENT_ROOT ."/resource/class/dolresource.class.php"); /** @@ -56,7 +57,7 @@ class FormResource /** * Output html form to select a resource * - * @param string $selected Preselected type + * @param int $selected Preselected resource id * @param string $htmlname Name of field in form * @param string $filter Optionnal filters criteras (example: 's.rowid <> x') * @param int $showempty Add an empty field diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index d635ee2e1e6..97dbb0de1be 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -119,7 +119,7 @@ if ($id > 0 || ! empty($ref)) $head = resource_prepare_head($object); - dol_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), 0, 'resource@resource'); + dol_fiche_head($head, 'contact', $langs->trans("ResourceSingular"), 0, 'resource'); /* @@ -127,7 +127,7 @@ if ($id > 0 || ! empty($ref)) */ print '
'.$langs->trans("ResourceFormLabel_ref").''; + print '
'.$langs->trans("ResourceFormLabel_ref").''; $linkback = $objet->ref.' '.$langs->trans("BackToList").''; print $form->showrefnav($object, 'id', $linkback,1,"rowid"); print '
'; - print ''; diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index a21bc88c319..099fb4f7d2b 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -104,7 +104,7 @@ if ($object->id) print '
'.$langs->trans("ResourceFormLabel_ref").''; + print '
'.$langs->trans("ResourceFormLabel_ref").''; $linkback = $objet->ref.' '.$langs->trans("BackToList").''; print $form->showrefnav($object, 'id', $linkback,1,"rowid"); print '
'; - print ''; diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 59a95f6f57a..7cb5b74fac3 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -168,7 +168,7 @@ if($ret == -1) { dol_print_error($db,$object->error); exit; } -if(!$ret) { +if (!$ret) { print '
'.$langs->trans('NoResourceInDatabase').'
'; } else @@ -304,6 +304,7 @@ else //print load_fiche_titre($langs->trans('ResourcesLinkedToElement'),'',''); + // Show list of resource links foreach ($object->available_resources as $modresources => $resources) { diff --git a/htdocs/resource/img/index.html b/htdocs/resource/img/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/resource/img/object_resource.png b/htdocs/resource/img/object_resource.png deleted file mode 100644 index 55f2e1bf937..00000000000 Binary files a/htdocs/resource/img/object_resource.png and /dev/null differ diff --git a/htdocs/resource/img/resource.png b/htdocs/resource/img/resource.png deleted file mode 100644 index 7d5bbfa5a3d..00000000000 Binary files a/htdocs/resource/img/resource.png and /dev/null differ diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index b33bbec259e..777bcb374d6 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -106,10 +106,9 @@ else print '
'.$langs->trans("ResourceFormLabel_ref").''; + print '
'.$langs->trans("ResourceFormLabel_ref").''; $linkback = $objet->ref.' '.$langs->trans("BackToList").''; print $form->showrefnav($object, 'id', $linkback,1,"rowid"); print '
'."\n"; print ''; - print_liste_field_titre($langs->trans('Id'),$_SERVER['PHP_SELF'],'t.rowid','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'t.ref','',$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans('ResourceType'),$_SERVER['PHP_SELF'],'ty.code','',$param,'',$sortfield,$sortorder); - print_liste_field_titre($langs->trans('Action'),"","","","",'width="60" align="center"',"",""); + print_liste_field_titre('',"","","","",'width="60" align="center"',"",""); print "\n"; foreach ($object->lines as $resource) @@ -117,15 +116,12 @@ else $var=!$var; $style=''; - if($resource->id == GETPOST('lineid')) - $style='style="background: orange;"'; + if ($resource->id == GETPOST('lineid')) $style='style="background: orange;"'; - print ''; + print ''; print ''; print ''; - print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 51945677694..6a19be4da1e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1285,7 +1285,7 @@ class User extends CommonObject $sql.= ", login = '".$this->db->escape($this->login)."'"; $sql.= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); $sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' - $sql.= ", admin = ".$this->admin; + if (! empty($user->admin)) $sql.= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user $sql.= ", address = '".$this->db->escape($this->address)."'"; $sql.= ", zip = '".$this->db->escape($this->zip)."'"; $sql.= ", town = '".$this->db->escape($this->town)."'"; diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 716db97b911..1da40878a62 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -491,7 +491,7 @@ else } else { - print ''; + print ''; } print "
'; - print ''.$resource->id.''; - print '
'; - print $resource->ref; + print $resource->getNomUrl(5); print ''; diff --git a/htdocs/resource/note.php b/htdocs/resource/note.php index e404a3bdef8..30e37eba77f 100644 --- a/htdocs/resource/note.php +++ b/htdocs/resource/note.php @@ -1,8 +1,9 @@ * Copyright (C) 2011-2012 Juanjo Menent + * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2013 Florian Henry - * Copyright (C) 2016 Gilles Poirier + * Copyright (C) 2016 Gilles Poirier * * 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 @@ -44,6 +45,7 @@ $object->fetch($id,$ref); $permissionnote=$user->rights->resource->write; // Used by the include of actions_setnotes.inc.php + /* * Actions */ @@ -62,7 +64,7 @@ $form = new Form($db); if ($id > 0 || ! empty($ref)) { $head = resource_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans('ResourceSingular'), 0, 'resource@resource'); + dol_fiche_head($head, 'note', $langs->trans('ResourceSingular'), 0, 'resource'); print ''; print ''; + if ($i == 0) print ''; print ''; print ''; if ($i == 0) print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 32206ada156..019542810e8 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -362,7 +362,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s. $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; // We'll need this table joined to the select in order to filter by categ -if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ +if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_".($type=='f'?"fournisseur":"societe")." as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ $sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; // We'll need this table joined to the select in order to filter by sale if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -438,7 +438,8 @@ if ($resql) $i = 0; $param=''; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sall != '') $param .= "&sall=".urlencode($sall); if ($search_categ > 0) $param.='&search_categ='.urlencode($search_categ); if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index cfbf3529bba..9e412f1a7f0 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -162,11 +162,6 @@ if ($result > 0) print '
'; print '
'.$langs->trans("ResourceFormLabel_ref").''; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index cb1d783497c..69262715b31 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -43,7 +43,7 @@ class Societe extends CommonObject public $element='societe'; public $table_element = 'societe'; public $fk_element='fk_soc'; - protected $childtables=array("supplier_proposal","propal","commande","facture","contrat","facture_fourn","commande_fournisseur","projet"); // To test if we can delete object + protected $childtables=array("supplier_proposal","propal","commande","facture","contrat","facture_fourn","commande_fournisseur","projet","expedition"); // To test if we can delete object /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -1002,14 +1002,16 @@ class Societe extends CommonObject * @param string $idprof2 Prof id 2 of third party (Warning, this can return several records) * @param string $idprof3 Prof id 3 of third party (Warning, this can return several records) * @param string $idprof4 Prof id 4 of third party (Warning, this can return several records) + * @param string $idprof5 Prof id 5 of third party (Warning, this can return several records) + * @param string $idprof6 Prof id 6 of third party (Warning, this can return several records) * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='') + function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $idprof1='',$idprof2='',$idprof3='',$idprof4='',$idprof5='',$idprof6='') { global $langs; global $conf; - if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4)) return -1; + if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int) && empty($idprof1) && empty($idprof2) && empty($idprof3) && empty($idprof4) && empty($idprof5) && empty($idprof6)) return -1; $sql = 'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'; $sql .= ', s.status'; @@ -1049,9 +1051,11 @@ class Societe extends CommonObject else if ($ref_int) $sql .= " WHERE s.ref_int = '".$this->db->escape($ref_int)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof1) $sql .= " WHERE s.siren = '".$this->db->escape($idprof1)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof2) $sql .= " WHERE s.siret = '".$this->db->escape($idprof2)."' AND s.entity IN (".getEntity($this->element, 1).")"; - else if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($idprof3)."' AND s.entity IN (".getEntity($this->element, 1).")"; // TODO This request is used ? Multiple database recording provided !! + else if ($idprof3) $sql .= " WHERE s.ape = '".$this->db->escape($idprof3)."' AND s.entity IN (".getEntity($this->element, 1).")"; else if ($idprof4) $sql .= " WHERE s.idprof4 = '".$this->db->escape($idprof4)."' AND s.entity IN (".getEntity($this->element, 1).")"; - + else if ($idprof5) $sql .= " WHERE s.idprof5 = '".$this->db->escape($idprof5)."' AND s.entity IN (".getEntity($this->element, 1).")"; + else if ($idprof6) $sql .= " WHERE s.idprof6 = '".$this->db->escape($idprof6)."' AND s.entity IN (".getEntity($this->element, 1).")"; + $resql=$this->db->query($sql); dol_syslog(get_class($this)."::fetch ".$sql); if ($resql) @@ -1059,11 +1063,11 @@ class Societe extends CommonObject $num=$this->db->num_rows($resql); if ($num > 1) { - $this->error='Fetch several records found request'; + $this->error='Fetch found several records. Rename one of tirdparties to avoid duplicate.'; dol_syslog($this->error, LOG_ERR); $result = -2; } - if ($num) + elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); @@ -1347,7 +1351,7 @@ class Societe extends CommonObject $this->db->begin(); // User is mandatory for trigger call - if ($call_trigger) + if (! $error && $call_trigger) { // Call trigger $result=$this->call_trigger('COMPANY_DELETE',$fuser); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index d5b68057ff1..70dee1ab8eb 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -115,7 +115,7 @@ $head = societe_prepare_head($object); dol_fiche_head($head, 'consumption', $langs->trans("ThirdParty"),0,'company'); dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); - + print '
'; print '
'; @@ -266,7 +266,7 @@ if ($type_element == 'contract') { // Supplier : Show products from orders. require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $documentstatic=new Contrat($db); - $documentstaticline=new ContratLigne($db); + $documentstaticline=new ContratLigne($db); $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, '; $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; @@ -276,44 +276,47 @@ if ($type_element == 'contract') $thirdTypeSelect='customer'; } -$sql = $sql_select; -$sql.= ' d.description as description,'; -if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; -if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; -if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; -$sql.= " s.rowid as socid "; -if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; -$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; -if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; -$sql.= $where; -if ($month > 0) { - if ($year > 0) { - $start = dol_mktime(0, 0, 0, $month, 1, $year); - $end = dol_time_plus_duree($start,1,'m') - 1; - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; - } else { - $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; - } -} else if ($year > 0) { - $start = dol_mktime(0, 0, 0, 1, 1, $year); - $end = dol_time_plus_duree($start,1,'y') - 1; - $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; -} -if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; -if ($sprod_fulldescr) +if ($sql_select) { - $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; - if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; - $sql.=")"; + $sql = $sql_select; + $sql.= ' d.description as description,'; + if ($type_element != 'fichinter' && $type_element != 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty,'; + if ($type_element == 'contract') $sql.= ' d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty,'; + if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity,'; + $sql.= " s.rowid as socid "; + if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".$tables_from; + if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid '; + $sql.= $where; + if ($month > 0) { + if ($year > 0) { + $start = dol_mktime(0, 0, 0, $month, 1, $year); + $end = dol_time_plus_duree($start,1,'m') - 1; + $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; + } else { + $sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'"; + } + } else if ($year > 0) { + $start = dol_mktime(0, 0, 0, 1, 1, $year); + $end = dol_time_plus_duree($start,1,'y') - 1; + $sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'"; + } + if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'"; + if ($sprod_fulldescr) + { + $sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'"; + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'"; + if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'"; + $sql.=")"; + } + $sql.= $db->order($sortfield,$sortorder); + + $resql=$db->query($sql); + $totalnboflines = $db->num_rows($resql); + + $sql.= $db->plimit($limit + 1, $offset); + //print $sql; } -$sql.= $db->order($sortfield,$sortorder); - -$resql=$db->query($sql); -$totalnboflines = $db->num_rows($resql); - -$sql.= $db->plimit($limit + 1, $offset); -//print $sql; // Define type of elements $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), 2); @@ -328,23 +331,24 @@ if ($sql_select) $var=true; $num = $db->num_rows($resql); - + $param="&socid=".$socid."&type_element=".$type_element; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr); if ($sref) $param.= "&sref=".urlencode($sref); if ($month) $param.= "&month=".$month; if ($year) $param.= "&year=".$year; if ($optioncss != '') $param.='&optioncss='.$optioncss; - + print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit); - + print ''."\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('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 "\n"; @@ -379,7 +383,7 @@ if ($sql_select) $documentstatic->statut=$objp->status; $documentstatic->status=$objp->status; $documentstatic->paye=$objp->paid; - + if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status; $var=!$var; @@ -545,7 +549,7 @@ if ($sql_select) } print "
"; - + if ($num > $limit) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); } @@ -554,7 +558,7 @@ if ($sql_select) else if (empty($type_element) || $type_element == -1) { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); - + print ''."\n"; // Titles with sort buttons print ''; @@ -564,16 +568,16 @@ else if (empty($type_element) || $type_element == -1) 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 "\n"; - + print ''; print "
'.$langs->trans("SelectElementAndClickRefresh").'
"; } else { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', ''); - + print ''."\n"; - + print ''; print "
'.$langs->trans("FeatureNotYetAvailable").'
"; diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 98ee42afc57..1cc44777438 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -77,7 +77,7 @@ if (count($listofsearchfields)) $i=0; foreach($listofsearchfields as $key => $value) { - if ($i == 0) print '
'.$langs->trans("Search").'
'.$langs->trans("Search").'
:
'; - // Alias names (commercial, trademark or alias names) - print '"; - // Prefix if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { @@ -258,7 +253,7 @@ if ($result > 0) } else { - print ''; } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index f9b924c9240..4c988603417 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -158,11 +158,6 @@ print '
'; print '
'; print '
'.$langs->trans('AliasNames').''; - print $object->name_alias; - print "
'; + print '
'; print $langs->trans("YouMustCreateContactFirst"); print '
'; -// Alias names (commercial, trademark or alias names) -print '"; - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; @@ -421,7 +416,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { foreach ( $prodcustprice->lines as $line ) { - print ""; + print ''; $staticprod = new Product($db); $staticprod->fetch($line->fk_product); diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 71df6128afb..fb758c52f29 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -168,6 +168,7 @@ if (empty($reshook)) if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) { $errors++; + setEventMessages($db->lasterror(), null, 'errors'); } } @@ -202,6 +203,7 @@ if (empty($reshook)) } else { + $langs->load("errors"); setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); $db->rollback(); } @@ -403,7 +405,7 @@ if (empty($reshook)) // Only for companies if (!($object->particulier || $private)) { - for ($i = 1; $i < 5; $i++) + for ($i = 1; $i <= 6; $i++) { $slabel="idprof".$i; $_POST[$slabel]=trim($_POST[$slabel]); @@ -418,15 +420,18 @@ if (empty($reshook)) } } - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - - if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); - $action = (($action=='add'||$action=='create')?'create':'edit'); - } + // Check for mandatory prof id (but only if country is than than ours) + if ($mysoc->country_id > 0 && $object->country_id == $mysoc->country_id) + { + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); + $action = (($action=='add'||$action=='create')?'create':'edit'); + } + } } } } @@ -974,11 +979,11 @@ else if ($conf->use_javascript_ajax) { print ''; - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; + print ''; } // Alias names (commercial, trademark or alias names) @@ -1044,7 +1049,7 @@ else // Address print ''; - print ''; @@ -1101,12 +1106,9 @@ else if (($j % 2) == 0) print ''; $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - if(empty($conf->global->$idprof_mandatory)) - print ''; if (($j % 2) == 1) print ''; $j++; @@ -1150,12 +1152,12 @@ else print ''; // Type - Size - print ''; - print ''; @@ -1601,7 +1603,7 @@ else // Address print ''; - print ''; @@ -1757,11 +1759,11 @@ else } // Type - Size - print ''; - print ''; @@ -1889,7 +1891,7 @@ else /* * View */ - $res=$object->fetch_optionals($object->id,$extralabels); + if (!empty($object->id)) $res=$object->fetch_optionals($object->id,$extralabels); //if ($res < 0) { dol_print_error($db); exit; } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 78bde5d1ea5..8e8c69b0ce9 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1076,31 +1076,32 @@ if ($action == 'create') // Terms of payment print ''; // Mode of payment print ''; // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled) { print ''; } // Shipping Method if (! empty($conf->expedition->enabled)) { print ''; } // Delivery date (or manufacturing) print ''; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f5675db86f3..fd7f266e159 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2244,9 +2244,12 @@ class SupplierProposal extends CommonObject $line->remise_percent=00; } - $prodid = mt_rand(1, $num_prods); - $line->fk_product=$prodids[$prodid]; - + if ($num_prods > 0) + { + $prodid = mt_rand(1, $num_prods); + $line->fk_product=$prodids[$prodid]; + } + $this->lines[$xnbp]=$line; $this->total_ht += $line->total_ht; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ea9b68d30be..967a510d714 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -277,7 +277,8 @@ if ($result) } $param='&socid='.$socid.'&viewstatut='.$viewstatut; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($month) $param.='&month='.$month; if ($year) $param.='&year='.$year; if ($search_ref) $param.='&search_ref=' .$search_ref; diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index d0b1b19278a..8f72744486a 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -19,7 +19,7 @@ ?> - + $objectlink) $var=!$var; ?> > - + diff --git a/htdocs/theme/eldy/img/object_calendargantt.png b/htdocs/theme/eldy/img/object_calendargantt.png new file mode 100644 index 00000000000..4d727dd6f24 Binary files /dev/null and b/htdocs/theme/eldy/img/object_calendargantt.png differ diff --git a/htdocs/theme/eldy/img/object_calendarpertype.png b/htdocs/theme/eldy/img/object_calendarpertype.png new file mode 100644 index 00000000000..ba16a4ab6c0 Binary files /dev/null and b/htdocs/theme/eldy/img/object_calendarpertype.png differ diff --git a/htdocs/theme/eldy/img/object_resource.png b/htdocs/theme/eldy/img/object_resource.png index 8cda1f3f220..2d93019b62f 100644 Binary files a/htdocs/theme/eldy/img/object_resource.png and b/htdocs/theme/eldy/img/object_resource.png differ diff --git a/htdocs/theme/eldy/img/object_tax.png b/htdocs/theme/eldy/img/object_tax.png new file mode 100644 index 00000000000..b4022e77740 Binary files /dev/null and b/htdocs/theme/eldy/img/object_tax.png differ diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 0d53504f337..18e42d6e3be 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -81,7 +81,7 @@ $dol_use_jmobile=$conf->dol_use_jmobile; // Colors $colorbackhmenu1='110,120,160'; // topmenu $colorbackvmenu1='255,255,255'; // vmenu -$colortopbordertitle1='40,40,40'; // top border of title +$colortopbordertitle1='120,120,120'; // top border of title $colorbacktitle1='230,230,230'; // title of tables,list $colorbacktabcard1='255,255,255'; // card $colorbacktabactive='234,234,234'; @@ -100,6 +100,7 @@ $fontsizesmaller='11'; $usegradienttop=(isset($conf->global->THEME_ELDY_TOPMENU_BACK1)?0:1); $usegradienttitle=(isset($conf->global->THEME_ELDY_BACKTITLE1)?0:1); $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); +$borderwith=2; // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; @@ -129,6 +130,7 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); $colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1); +$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1); $colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1); $colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1); $colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE); @@ -151,7 +153,7 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); } -$colortopbordertitle1=$colorbackhmenu1; +//$colortopbordertitle1=$colorbackhmenu1; // Set text color to black or white @@ -306,7 +308,7 @@ span.timesheetalreadyrecorded input { select.flat, form.flat select { font-weight: normal; } -.optiongrey { +.optiongrey, .opacitymedium { opacity: 0.5; } .opacityhigh { @@ -563,6 +565,18 @@ div.myavailability { max-width: 0; overflow: auto; } +.tablelistofcalendars { + margin-top: 25px !important; +} + +/* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ +.table-responsive { + width: calc(100% - 330px); + margin-bottom: 15px; + overflow-y: hidden; + -ms-overflow-style: -ms-autohiding-scrollbar; +} + /* ============================================================================== */ @@ -587,6 +601,13 @@ div.myavailability { .titlefield { width: 25%; } .titlefieldcreate { width: 20%; } +/* Force values for small screen */ +@media only screen and (max-width: 1400px) +{ + .titlefield { width: 30% !important; } + .titlefieldcreate { width: 30% !important; } +} + /* Force values for small screen */ @media only screen and (max-width: 570px) { @@ -626,16 +647,14 @@ td.showDragHandle { /* ============================================================================== */ #id-container { - /* margin-top: 12px; - margin-bottom: 8px; */ - display: table; + display: table; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ table-layout: fixed; } #id-right, #id-left { padding-top: 12px; padding-bottom: 8px; - display: table-cell; + display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ float: none; vertical-align: top; } @@ -648,11 +667,76 @@ td.showDragHandle { height: calc(100% - 50px);*/ } +.side-nav { + display: table-cell; + border-right: 1px solid #d0d0d0; +} +div.blockvmenulogo +{ + border-bottom: 0 !important; +} +div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks { + border-top: none !important; + border-left: none !important; + border-right: none !important; + border-bottom: 1px solid #e0e0e0; + padding-left: 0 !important; +} +div.blockvmenuend { + border: none !important; + padding-left: 0 !important; +} +div.vmenu, td.vmenu { + padding-right: 6px !important; +} + + + +/* For smartphone (testmenuhider is on) */ +global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +#id-container { + width: 100%; +} +.side-nav { + border-bottom: 1px solid #BBB; + background: #FFF; +} +.side-nav { + position: absolute; + z-index: 200; + display: none; +} +div.blockvmenulogo +{ + border-bottom: 0 !important; +} +div.blockvmenusearch { + padding-bottom: 12px !important; + border-bottom: 1px solid #e0e0e0; +} +div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmenuend { + border-top: none !important; + border-left: none !important; + border-right: none !important; + border-bottom: 1px solid #e0e0e0; + padding-left: 0 !important; +} +div.vmenu, td.vmenu { + padding-right: 6px !important; +} +div.fiche { + margin-: 6px !important; + margin-: 6px !important; +} + + + div.fiche { margin-: px; margin-: dol_optimize_smallscreen)?'12':'6')); ?>px; - dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'; ?> + dol_hide_leftmenu) && ! empty($conf->dol_hide_topmenu)) print 'margin-top: 4px;'."\n"; ?> + dol_use_jmobile)) print ' margin-bottom: 10px;'."\n"; ?> } div.fichecenter { width: 100%; @@ -722,13 +806,18 @@ div.ficheaddleft { } } +/* For table into table into card */ +div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { + padding: 0 0 0 0; +} + .containercenter { display : table; margin : 0px auto; } #pictotitle { - margin-right: 8px; + margin-: 8px; margin-bottom: 4px; } .pictosubstatus { @@ -784,7 +873,7 @@ img.photoref { .underrefbanner { } .underbanner { - border-bottom: 2px solid rgb(); + border-bottom: px solid rgb(); } @@ -814,11 +903,11 @@ div#id-top { background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) ); - + /* height: 34px; height: px; - + */ } @@ -870,7 +959,6 @@ a.tmenu:link, a.tmenu:visited, a.tmenu:hover, a.tmenu:active { font-weight: normal; padding: 0px 5px 0px 3px; white-space: nowrap; - /* text-shadow: 1px 1px 1px #000000; */ color: #; text-decoration: none; } @@ -888,9 +976,10 @@ ul.tmenu { /* t r b l */ padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; list-style: none; + display: table; } ul.tmenu li { /* We need this to have background color when menu entry wraps on new lines */ - background: rgb(); +/* background: rgb(); background-image: linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -o-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); @@ -898,7 +987,7 @@ ul.tmenu li { /* We need this to have background color when menu entry wraps on background-image: -webkit-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -ms-linear-gradient(top, rgba(255,255,255,.1) 0%, rgba(0,0,0,.4) 100%); background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.1)), color-stop(1, rgba(0,0,0,.4)) ); - + */ } li.tmenu, li.tmenusel { @@ -906,7 +995,6 @@ li.tmenu, li.tmenusel { vertical-align: bottom; global->MAIN_MENU_INVERT)) { ?> float: ; - /* height: px; */ position:relative; display: block; @@ -914,13 +1002,16 @@ li.tmenu, li.tmenusel { margin: 0 0 0 0; font-weight: normal; } +li.menuhider:hover { + background-image: none !important; +} li.tmenusel, li.tmenu:hover { - background-image: -o-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%) !important; - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%) !important; - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%) !important; - background-image: -ms-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%) !important; - background-image: linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%) !important; - background: rgb(); + background-image: -o-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.5) 0%, rgba(250,250,250,0) 100%); + background-image: -ms-linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%); + background-image: linear-gradient(bottom, rgba(250,250,250,0.3) 0%, rgba(0,0,0,0.5) 100%); + /* background: rgb(); */ } .tmenuend .tmenuleft { width: 0px; } .tmenuend { display: none; } @@ -950,9 +1041,21 @@ div.tmenucenter height: px; width: 100%; + /* + max-width: px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: #; + */ +} +#menu_titre_logo { + padding-top: 0; + padding-bottom: 0; } div.menu_titre { - padding-top: 5px; + padding-top: 4px; + padding-bottom: 4px; } .mainmenuaspan { @@ -1067,9 +1170,12 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; // Put here list of menu entries when the div.mainmenu.menuentry was previously defined $divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','holiday','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices','websites'); +// Put here list of menu entries we are sure we don't want +$divnotrequired=array('multicurrency','salaries','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; + if (in_array($val,$divnotrequired)) continue; //print "XXX".$val; // Search img file in module dir @@ -1089,7 +1195,7 @@ foreach($mainmenuusedarray as $val) $url=dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.$generic.".png",1); $found=1; if ($generic < 4) $generic++; - print "/* A mainmenu entry but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; + print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; } if ($found) { @@ -1304,12 +1410,12 @@ div.vmenu, td.vmenu { } .menu_contenu { - padding-top: 5px; - padding-bottom: 2px; + padding-top: 3px; + padding-bottom: 3px; overflow: hidden; text-overflow: ellipsis; } -#menu_contenu_logo { padding-right: 4px; } +#menu_contenu_logo { padding-top: 0; } .companylogo { } .searchform { padding-top: 4px; } @@ -1333,15 +1439,20 @@ a.vsmenu.addbookmarkpicto { } .vmenu div.blockvmenubookmarks, .vmenu div.blockvmenuend, .vmenu div.blockvmenulogo, .vmenu div.blockvmenusearchphone { - border-bottom: 1px solid #BBB; +/* border-bottom: 1px solid #BBB; */ +} +div.blockvmenusearchphone +{ + border-bottom: none !important; } .vmenu div.blockvmenuend, .vmenu div.blockvmenulogo { margin: 0 0 8px 2px; } -.vmenu div.blockvmenusearch +.vmenu div.blockvmenusearch { - padding-bottom: 5px; + padding-bottom: 14px; + border-bottom: 1px solid #e0e0e0; } .vmenu div.blockvmenuend { @@ -1350,6 +1461,7 @@ a.vsmenu.addbookmarkpicto { .vmenu div.blockvmenulogo { padding-bottom: 10px; + padding-top: 0; } div.blockvmenubookmarks { @@ -1365,21 +1477,12 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks, div.blockvmen padding-right: 1px; padding-top: 3px; padding-bottom: 3px; - /* margin: 1px 0 8px 2px; */ margin: 0 0 0 2px; background: rgb(); border-left: 1px solid #AAA; border-right: 1px solid #BBB; -/* border-bottom: 1px solid #BBB; - border-top: 1px solid #BBB; - border-radius: 4px; - -moz-border-radius: 4px; - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD; - */ } div.blockvmenusearch @@ -1388,26 +1491,11 @@ div.blockvmenusearch color: #000000; text-align: ; text-decoration: none; - /*padding-left: 5px; - padding-right: 1px; - padding-top: 3px; - padding-bottom: 3px; */ - margin: 1px 0px 4px 2px; + margin: 1px 0px 0px 2px; background: rgb(); - - /*border-left: 1px solid #AAA; - border-right: 1px solid #BBB; - border-bottom: 1px solid #BBB; - border-top: 1px solid #BBB;*/ - /*border-radius: 4px; - -moz-border-radius: 4px; - -moz-box-shadow: 3px 3px 4px #DDD; - -webkit-box-shadow: 3px 3px 4px #DDD; - box-shadow: 3px 3px 4px #DDD;*/ } div.blockvmenusearch > form > div { -/* min-height: 40px; */ padding-top: 3px; } div.blockvmenusearch > form > div > label { @@ -1778,7 +1866,7 @@ a.tabTitle { a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { font-family: ; - padding: 7px 12px 7px; + padding: 8px 9px 8px; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; @@ -2183,7 +2271,7 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-collapse: separate !important; border-spacing: 0px; - border-top-width: 2px; + border-top-width: px; border-top-color: rgb(); border-top-style: solid; @@ -2209,13 +2297,6 @@ table.liste, table.noborder, table.formdoc, div.noborder { -webkit-border-radius: 0.2em; border-radius: 0.2em;*/ } -/* -#tablelines tr.liste_titre:first-child td, form.formnoborder div, tr.liste_titre.trnoborder td { - border-top-width: 1px; - border-top-color: rgb(); - border-top-style: solid; -} -*/ .liste_titre_add td, .liste_titre_add .tagtd { border-top-width: 1px; @@ -2226,9 +2307,10 @@ table.liste tr, table.noborder tr, div.noborder form { border-top-color: #FEFEFE; min-height: 20px; } -table.liste th, table.noborder th { - padding: 10px 2px 10px 3px; /* t r b l */ +table.liste th, table.noborder th, table.noborder tr.liste_titre td, table.noborder tr.box_titre td { + padding: 8px 2px 8px 3px; /* t r b l */ } +tr.box_titre .nobordernopadding td { padding: 0px ! important; } table.liste td, table.noborder td, div.noborder form, div.noborder form div { padding: 5px 2px 5px 3px; /* t r b l */ } @@ -2549,7 +2631,7 @@ div.liste_titre { border-top-style: solid; } div.liste_titre_bydiv { - border-top-width: 2px; + border-top-width: px; border-top-color: rgb(); border-top-style: solid; @@ -2571,11 +2653,11 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list /* TO MATCH ELDY */ - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); background: rgb(); @@ -2599,6 +2681,11 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a { text-shadow: none !important; } +tr.liste_titre_topborder td { + border-top-width: px; + border-top-color: rgb(); + border-top-style: solid; +} .liste_titre td a { text-shadow: none !important; color: rgb(); @@ -2637,6 +2724,12 @@ form.liste_total div { border-bottom: none; } +.paymenttable, .margintable { + border-top-width: px !important; + border-top-color: rgb() !important; + border-top-style: solid !important; +} + .margintable td { border: 0px !important; } @@ -2724,11 +2817,11 @@ tr.box_titre { /* TO MATCH ELDY */ - background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); - background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.3) 100%); + background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); + background-image: linear-gradient(bottom, rgba(0,0,0,0.1) 0%, rgba(,0.4) 100%); background: rgb(); @@ -2859,6 +2952,8 @@ a.impayee:hover { font-weight: bold; color: #550000; } .fieldrequired { font-weight: bold; color: #000055; } +.widthpictotitle { width: 40px; text-align: ; } + .dolgraphtitle { margin-top: 6px; margin-bottom: 4px; } .dolgraphtitlecssboxes { margin: 0px; } .legendColorBox, .legendLabel { border: none !important; } @@ -3962,8 +4057,8 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i .ui-btn-inner { min-width: .4em; - padding-left: 10px; - padding-right: 10px; + padding-left: 6px; + padding-right: 6px; font-size: 13px; @@ -3972,20 +4067,26 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i /* white-space: normal; */ /* Warning, enable this break the truncate feature */ } .ui-btn-icon-right .ui-btn-inner { - padding-right: 34px; + padding-right: 30px; } .ui-btn-icon-left .ui-btn-inner { - padding-left: 34px; + padding-left: 30px; } .ui-select .ui-btn-icon-right .ui-btn-inner { - padding-right: 38px; + padding-right: 30px; } .ui-select .ui-btn-icon-left .ui-btn-inner { - padding-left: 38px; + padding-left: 30px; +} +.ui-select .ui-btn-icon-right .ui-icon { + right: 8px; +} +.ui-btn-icon-left > .ui-btn-inner > .ui-icon, .ui-btn-icon-right > .ui-btn-inner > .ui-icon { + margin-top: -10px; } select { /* display: inline-block; */ /* We can't set this. This disable ability to make */ - /* TODO added by jmobile, replace jmobile with pure css*/ + /* TODO modified by jmobile, replace jmobile with pure css*/ overflow:hidden; white-space: nowrap; text-overflow: ellipsis; @@ -4227,7 +4328,7 @@ img.demothumb { /* nboftopmenuentries = , fontsize= */ /* rule to reduce top menu - 1st reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) { div.tmenucenter { max-width: px; /* size of viewport */ @@ -4246,7 +4347,7 @@ img.demothumb { } li.tmenu, li.tmenusel { - min-width: 32px; + min-width: 36px; } div.mainmenu { min-width: auto; @@ -4256,7 +4357,7 @@ img.demothumb { } } /* rule to reduce top menu - 2nd reduction */ -@media only screen and (max-width: px) +@media only screen and (max-width: px) { div.mainmenu { height: 23px; @@ -4275,7 +4376,7 @@ img.demothumb { } } /* rule to reduce top menu - 3rd reduction */ -@media only screen and (max-width: 605px) +@media only screen and (max-width: 660px) { /* Reduce login top right info */ .usertextatoplogin { @@ -4302,7 +4403,7 @@ img.demothumb { } li.tmenu, li.tmenusel { - min-width: 30px; + min-width: 32px; } div.mainmenu { height: 23px; diff --git a/htdocs/theme/md/img/object_calendargantt.png b/htdocs/theme/md/img/object_calendargantt.png new file mode 100644 index 00000000000..b49fe7b2bfb Binary files /dev/null and b/htdocs/theme/md/img/object_calendargantt.png differ diff --git a/htdocs/theme/md/img/object_calendarpertype.png b/htdocs/theme/md/img/object_calendarpertype.png new file mode 100644 index 00000000000..244da5bedd0 Binary files /dev/null and b/htdocs/theme/md/img/object_calendarpertype.png differ diff --git a/htdocs/theme/md/img/object_calendarperuser.png b/htdocs/theme/md/img/object_calendarperuser.png index 98a013a4014..244da5bedd0 100644 Binary files a/htdocs/theme/md/img/object_calendarperuser.png and b/htdocs/theme/md/img/object_calendarperuser.png differ diff --git a/htdocs/theme/md/img/object_tax.png b/htdocs/theme/md/img/object_tax.png new file mode 100644 index 00000000000..b4022e77740 Binary files /dev/null and b/htdocs/theme/md/img/object_tax.png differ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 78208e06ce4..6a9defb7451 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -100,6 +100,7 @@ $fontsize='13'; $fontsizesmaller='11'; $usegradient=0; $useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); +$borderwith=2; // Case of option always editable if (! isset($conf->global->THEME_ELDY_BACKBODY)) $conf->global->THEME_ELDY_BACKBODY=$colorbackbody; @@ -131,6 +132,7 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) // Case of option availables only if THEME_ELDY_ENABLE_PERSONALIZED is on $colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1); $colorbackvmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$conf->global->THEME_ELDY_VERMENU_BACK1) :(empty($user->conf->THEME_ELDY_VERMENU_BACK1)?$colorbackvmenu1:$user->conf->THEME_ELDY_VERMENU_BACK1); +$colortopbordertitle1=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$conf->global->THEME_ELDY_TOPBORDER_TITLE1) :(empty($user->conf->THEME_ELDY_TOPBORDER_TITLE1)?$colortopbordertitle1:$user->conf->THEME_ELDY_TOPBORDER_TITLE1); $colorbacktitle1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTITLE1) ?$colorbacktitle1:$conf->global->THEME_ELDY_BACKTITLE1) :(empty($user->conf->THEME_ELDY_BACKTITLE1)?$colorbacktitle1:$user->conf->THEME_ELDY_BACKTITLE1); $colorbacktabcard1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABCARD1) ?$colorbacktabcard1:$conf->global->THEME_ELDY_BACKTABCARD1) :(empty($user->conf->THEME_ELDY_BACKTABCARD1)?$colorbacktabcard1:$user->conf->THEME_ELDY_BACKTABCARD1); $colorbacktabactive =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$conf->global->THEME_ELDY_BACKTABACTIVE):(empty($user->conf->THEME_ELDY_BACKTABACTIVE)?$colorbacktabactive:$user->conf->THEME_ELDY_BACKTABACTIVE); @@ -153,7 +155,7 @@ if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); } -$colortopbordertitle1=$colorbackhmenu1; +if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; // Set text color to black or white @@ -168,7 +170,7 @@ else { $colortextbackvmenu='000000'; } $tmppart=explode(',',$colorbacktitle1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); if ($tmpval <= 260) { $colortexttitle='FFFFFF'; $colorshadowtitle='888888'; } -else { $colortexttitle='404040'; $colorshadowtitle='FFFFFF'; } +else { $colortexttitle='101010'; $colorshadowtitle='FFFFFF'; } $tmppart=explode(',',$colorbacktabcard1); $tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : ''); if ($tmpval <= 340) { $colortextbacktab='FFFFFF'; } @@ -305,7 +307,7 @@ select.flat, form.flat select { input:disabled { background:#f4f4f4; } -.optiongrey { +.optiongrey, .opacitymedium { opacity: 0.5; } .opacityhigh { @@ -562,6 +564,17 @@ div.myavailability { max-width: 0; overflow: auto; } +.tablelistofcalendars { + margin-top: 25px !important; +} + +/* for future usage (when left menu has been removed) */ +.table-responsive { + width: calc(100% - 330px); + margin-bottom: 15px; + overflow-y: hidden; + -ms-overflow-style: -ms-autohiding-scrollbar; +} /* ============================================================================== */ @@ -586,6 +599,13 @@ div.myavailability { .titlefield { width: 30%; } .titlefieldcreate { width: 20%; } +/* Force values for small screen */ +@media only screen and (max-width: 1400px) +{ + .titlefield { width: 30% !important; } + .titlefieldcreate { width: 30% !important; } +} + /* Force values for small screen */ @media only screen and (max-width: 570px) { @@ -637,10 +657,6 @@ td.showDragHandle { vertical-align: top; } #id-top { -/* min-width: 100%; - position: relative; - heigth: 52px; - background: #f00;*/ } #id-left { min-height: 100%; @@ -701,6 +717,40 @@ td.showDragHandle { margin-left: 228px; } +/* For smartphone (testmenuhider is on) */ +global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?> +#id-container { + width: 100%; +} +.side-nav-vert { + margin-left: 0; +} +div.login_block { + border-right: none ! important; + top: inherit !important; +} +.side-nav { + /*top: inherit !important;*/ + overflow-x: initial !important; + overflow-y: scroll; + /*position: initial !important;*/ + display: none; +} +div.login_block { + /* position: initial !important;*/ + display: none; +} +#id-right { + padding-left: 0 ! important; +} +#id-left { + top: 60px ! important; +} +div.fiche { + margin-: 6px !important; + margin-: 6px !important; +} + div.fiche { margin-: px; @@ -777,13 +827,22 @@ div.ficheaddleft { } } +/* For table into table into card */ +div.ficheaddleft tr.liste_titre:first-child td table.nobordernopadding td { + padding: 0 0 0 0; +} + +table.noborder tr.liste_titre td { + padding: 3px !important; +} + .containercenter { display : table; margin : 0px auto; } #pictotitle { - margin-right: 8px; + margin-: 8px; margin-bottom: 4px; } .pictosubstatus { @@ -836,7 +895,7 @@ img.photoref { .underrefbanner { } .underbanner { - border-bottom: 2px solid rgb();; + border-bottom: px solid rgb(); } @@ -935,7 +994,7 @@ ul.tmenu { /* t r b l */ padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; list-style: none; - /* box-shadow: 0 0 6px rgba(0, 0, 0, .4) !important; */ + display: table; } ul.tmenu li { background: rgb(); @@ -980,10 +1039,8 @@ li.tmenusel, li.tmenu:hover { opacity: .50; /* show only a slight shadow */ } .tmenuend .tmenuleft { width: 0px; } -/* .tmenuend { display: none; } We keep tmenuend it to show background for rest of line */ -.tmenuend .tmenucenter { - width: 1px; -} +.tmenuend { display: none; } + div.tmenuleft { float: ; @@ -1125,9 +1182,12 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; // Put here list of menu entries when the div.mainmenu.menuentry was previously defined $divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','holiday','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','webservices','websites'); +// Put here list of menu entries we are sure we don't want +$divnotrequired=array('multicurrency','salaries','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); foreach($mainmenuusedarray as $val) { if (empty($val) || in_array($val,$divalreadydefined)) continue; + if (in_array($val,$divnotrequired)) continue; //print "XXX".$val; // Search img file in module dir @@ -1421,6 +1481,11 @@ div.blockvmenusearch padding-bottom: 10px; border-bottom: 1px solid #f4f4f4; } +div.blockvmenusearchphone +{ + border-bottom: none; + margin-bottom: 0px; +} div.blockvmenuhelp { @@ -1722,7 +1787,7 @@ div.tabs { clear:both; height:100%; } -div.tabsElem { margin-top: 8px; } /* To avoid overlap of tabs when not browser */ +div.tabsElem { margin-top: 6px; } /* To avoid overlap of tabs when not browser */ div.tabBar { color: #; @@ -1787,7 +1852,7 @@ a.tabTitle { a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { font-family: ; - padding: 5px 12px 5px; + padding: 7px 9px 7px; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; @@ -1866,7 +1931,10 @@ span.tabspan { /* Boutons actions */ /* ============================================================================== */ -div.divButAction { margin-bottom: 1.4em; } +div.divButAction { + margin-bottom: 1.4em; + vertical-align: top; +} span.butAction, span.butActionDelete { cursor: pointer; @@ -2074,7 +2142,7 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-collapse: separate !important; border-spacing: 0px; - border-top-width: 1px; + border-top-width: px; border-top-color: rgb(); border-top-style: solid; @@ -2121,7 +2189,7 @@ table.noborder tr, div.noborder form { } table.liste th, table.noborder th, table.noborder tr.liste_titre td { - padding: 12px 2px 12px 3px; /* t r b l */ + padding: 8px 2px 8px 3px; /* t r b l */ } table.noborder td, div.noborder form, div.noborder form div { padding: 4px 2px 4px 3px; /* t r b l */ @@ -2410,7 +2478,7 @@ div.liste_titre { border-top-style: solid; } div.liste_titre_bydiv { - border-top-width: 1px; + border-top-width: px; border-top-color: rgb(); border-top-style: solid; @@ -2459,6 +2527,11 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a { text-shadow: none !important; } +tr.liste_titre_topborder td { + border-top-width: px; + border-top-color: rgb(); + border-top-style: solid; +} .liste_titre td a { text-shadow: none !important; color: rgb(); @@ -2498,6 +2571,12 @@ input.liste_titre { border-bottom: none; } +.paymenttable, .margintable { + border-top-width: px !important; + border-top-color: rgb() !important; + border-top-style: solid !important; +} + .margintable td { border: 0px !important; } @@ -2725,6 +2804,8 @@ a.impayee:hover { font-weight: bold; color: #550000; } .fieldrequired { font-weight: bold; color: #000055; } +.widthpictotitle { width: 40px; text-align: ; } + .dolgraphtitle { margin-top: 6px; margin-bottom: 4px; } .dolgraphtitlecssboxes { margin: 0px; } .legendColorBox, .legendLabel { border: none !important; } @@ -3835,8 +3916,8 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i .ui-btn-inner { min-width: .4em; - padding-left: 10px; - padding-right: 10px; + padding-left: 6px; + padding-right: 6px; font-size: 13px; @@ -3845,16 +3926,29 @@ a.ui-link, a.ui-link:hover, .ui-btn:hover, span.ui-btn-text:hover, span.ui-btn-i /* white-space: normal; */ /* Warning, enable this break the truncate feature */ } .ui-btn-icon-right .ui-btn-inner { - padding-right: 34px; + padding-right: 30px; } .ui-btn-icon-left .ui-btn-inner { - padding-left: 34px; + padding-left: 30px; } .ui-select .ui-btn-icon-right .ui-btn-inner { - padding-right: 38px; + padding-right: 30px; } .ui-select .ui-btn-icon-left .ui-btn-inner { - padding-left: 38px; + padding-left: 30px; +} +.ui-select .ui-btn-icon-right .ui-icon { + right: 8px; +} +.ui-btn-icon-left > .ui-btn-inner > .ui-icon, .ui-btn-icon-right > .ui-btn-inner > .ui-icon { + margin-top: -10px; +} +select { + /* display: inline-block; */ /* We can't set this. This disable ability to make */ + /* TODO modified by jmobile, replace jmobile with pure css*/ + overflow:hidden; + white-space: nowrap; + text-overflow: ellipsis; } .fiche .ui-controlgroup { margin: 0px; diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 95ff6365dac..823f5ad307e 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -104,17 +104,17 @@ if (empty($reshook)) { break; } - if (! $error) - { - $result=dol_set_user_param($db, $conf, $object, $tabparam); - if (! $result > 0) $error++; - } + $tabparam['AGENDA_EXT_NAME_'.$id.'_'.$i]=$name; + $tabparam['AGENDA_EXT_SRC_'.$id.'_'.$i]=$src; + $tabparam['AGENDA_EXT_OFFSETTZ_'.$id.'_'.$i]=$offsettz; + $tabparam['AGENDA_EXT_COLOR_'.$id.'_'.$i]=$color; + $tabparam['AGENDA_EXT_ENABLED_'.$id.'_'.$i]=$enabled; $i ++; } if (!$error) { - $result = dol_set_user_param($db, $conf, $fuser, $tabparam); + $result = dol_set_user_param($db, $conf, $object, $tabparam); if (!$result > 0) { $error ++; } @@ -157,10 +157,6 @@ $linkback = ''.$langs->trans("BackToLi dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); -print '
'; - -print '
'; - print $langs->trans("AgendaExtSitesDesc")."
\n"; print "
\n"; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index acfe1c85cd7..28b1040f579 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -333,7 +333,7 @@ if (empty($reshook)) { $object->gender = GETPOST("gender", 'alpha'); $object->pass = GETPOST("password"); $object->api_key = (GETPOST("api_key", 'alpha')) ? GETPOST("api_key", 'alpha') : $object->api_key; - $object->admin = empty($user->admin) ? 0 : GETPOST("admin"); // A user can only be set admin by an admin + if (! empty($user->admin)) $object->admin = GETPOST("admin"); // admin flag can only be set/unset by an admin user. A test is also done later when forging sql request $object->address = GETPOST('address', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha'); $object->town = GETPOST('town', 'alpha'); @@ -889,7 +889,7 @@ if (($action == 'create') || ($action == 'adduserldap')) // Address print '
'; - print ''; @@ -1738,7 +1738,7 @@ else } else { - print ''; + print ''; } print "
'.$langs->trans('AliasNames').''; -print $object->name_alias; -print "
' . $langs->trans('Prefix') . '' . $object->prefix_comm . '
'.fieldLabel('FirstName','firstname').' 
'.fieldLabel('UserTitle','civility_id').''; + print '
'.fieldLabel('UserTitle','civility_id').''; print $formcompany->select_civility($object->civility_id).' 
'.fieldLabel('Address','address').'
'.fieldLabel($idprof,$key).''; - else - print ''.fieldLabel($idprof,$key,1).''; + print ''.fieldLabel($idprof,$key, (empty($conf->global->$idprof_mandatory)?0:1)).''; - print $formcompany->get_input_id_prof($i,$key,$object->$key,$object->country_code); + print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
'.fieldLabel('ThirdPartyType','typent_id').''."\n"; + print '
'.fieldLabel('ThirdPartyType','typent_id').''."\n"; $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''.fieldLabel('Staff','effectif_id').''; + print ''.fieldLabel('Staff','effectif_id').''; print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
'.fieldLabel('Address','address').'
'.fieldLabel('ThirdPartyType','typent_id').''; + print '
'.fieldLabel('ThirdPartyType','typent_id').''; print $form->selectarray("typent_id",$formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print ''.fieldLabel('Staff','effectif_id').''; + print ''.fieldLabel('Staff','effectif_id').''; print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $object->effectif_id); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); print '
' . $langs->trans('PaymentConditionsShort') . ''; - $form->select_conditions_paiements($soc->cond_reglement_id, 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements(GETPOST('cond_reglement_id') > 0 ? GETPOST('cond_reglement_id') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1); print '
' . $langs->trans('PaymentMode') . ''; - $form->select_types_paiements($soc->mode_reglement_id, 'mode_reglement_id'); + $form->select_types_paiements(GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $soc->mode_reglement_id, 'mode_reglement_id'); print '
' . $langs->trans('BankAccount') . ''; - $form->select_comptes($fk_account, 'fk_account', 0, '', 1); + $form->select_comptes(GETPOST('fk_account')>0 ? GETPOST('fk_account','int') : $fk_account, 'fk_account', 0, '', 1); print '
' . $langs->trans('SendingMethod') . ''; - print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1); + print $form->selectShippingMethod(GETPOST('shipping_method_id') > 0 ? GETPOST('shipping_method_id', 'int') : $shipping_method_id, 'shipping_method_id', '', 1); print '
' . $langs->trans("DeliveryDate") . ''; + $datedelivery = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); @@ -1108,7 +1109,7 @@ if ($action == 'create') $sday = date("d", $tmpdte); $form->select_date($syear."-".$smonth."-".$sday, 'liv_', '', '', '', "addask"); } else { - $form->select_date(-1, 'liv_', '', '', '', "addask", 1, 1); + $form->select_date($datedelivery ? $datedelivery : -1, 'liv_', '', '', '', "addask", 1, 1); } print '
trans("SupplierProposal"); ?>trans("SupplierProposal"); ?> trans("ShowSupplierProposal"),"supplier_proposal").' '.$objectlink->ref; ?> datec,'day'); ?>
'.fieldLabel('Address','address').'
'.$langs->trans("None").'
'.$langs->trans("None").'
"; @@ -1914,7 +1914,7 @@ else if ($user->admin // Need to be admin to allow downgrade of an admin && ($user->id != $object->id) // Don't downgrade ourself && ( - (empty($conf->multicompany->enabled) && $nbAdmin > 1) + (empty($conf->multicompany->enabled) && $nbAdmin >= 1) || (! empty($conf->multicompany->enabled) && ($object->entity > 0 || $nbSuperAdmin > 1)) // Don't downgrade a superadmin if alone ) ) @@ -1998,7 +1998,7 @@ else // Address print '
'.fieldLabel('Address','address').'
'.$langs->trans("None").'
'.$langs->trans("None").'
"; print "
"; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 199041551c5..bf39a128137 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -177,7 +177,7 @@ if ($result > 0) //var_dump($records); // Affichage arbre - if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) + if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index e8a6a8fc1c9..1da5911861c 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -181,12 +181,12 @@ if ($result > 0) $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info,1); $search = "(".$object->_load_ldap_dn($info,2).")"; - $records=$ldap->getAttribute($dn,$search); + $records = $ldap->getAttribute($dn,$search); //print_r($records); // Affichage arbre - if (count($records) && $records != false && (! isset($records['count']) || $records['count'] > 0)) + if ((! is_numeric($records) || $records != 0) && (! isset($records['count']) || $records['count'] > 0)) { if (! is_array($records)) { diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index a853870ee8c..4d254349a7d 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -166,12 +166,6 @@ if ($action == 'edit') dol_banner_tab($object,'id',$linkback,$user->rights->user->user->lire || $user->admin); - - print '
'; - - print '
'; - - if (! empty($conf->use_javascript_ajax)) {/* print '