Merge branch 'develop' into actionrefused

This commit is contained in:
Laurent Destailleur 2018-12-14 15:48:24 +01:00 committed by GitHub
commit 2011afe6fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1577 changed files with 82293 additions and 45499 deletions

View File

@ -288,7 +288,8 @@ script:
echo "Checking PHP syntax errors" echo "Checking PHP syntax errors"
# Ensure we catch errors # Ensure we catch errors
set -e set -e
parallel-lint --exclude htdocs/includes --blame . #parallel-lint --exclude htdocs/includes --blame .
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/sebastian --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
set +e set +e
echo echo
@ -341,6 +342,9 @@ script:
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log
php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log
php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log
cd - cd -
set +e set +e
echo echo

105
ChangeLog
View File

@ -5,20 +5,111 @@ English Dolibarr ChangeLog
***** ChangeLog for 9.0.0 compared to 8.0.0 ***** ***** ChangeLog for 9.0.0 compared to 8.0.0 *****
For Users: For Users:
NEW: Stable module: Website NEW: Stable module: DAV (WebDAV only for the moment)
NEW: Stable module: WebDAV
NEW: Stable module: Module Builder
NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more services. NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more services.
NEW: Stable module "Module Builder"
NEW: Stable module: Website
NEW: Experimental module "TakePos" NEW: Experimental module "TakePos"
NEW: Experimental module "Ticket" NEW: Experimental module "Ticket"
NEW: Experimental module "Data Privacy"
NEW: Experimental module "Email Collector"
NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making
Android application like DoliDroid able to provide native features for multicompany module. Android application like DoliDroid able to provide native features for multicompany module.
NEW: Compatibility with PHP 7.3 NEW: Compatibility with PHP 7.3 =>
NEW: Add admin page for modulebuilder
NEW: Add civility in list of members. Close #9251
NEW: Add configuration to disable "customer/prospect" thirdparty type
NEW: Add CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY and CONTRACT_HIDE_UNSELECTABLES by SELECT_HIDE_UNSELECTABLES
NEW: Add __DAY_TEXT__ and __MONTH_TEXT__ substitutions vars
NEW: Add due date column in payment lists
NEW: Add email in event history, for reminder email of expired subsription
NEW: Add event tab on resource record
NEW: Add FEC Export in accountancy
NEW: Add filter on staff range in list of thirdparties
NEW: Add a first complete template of website
NEW: Add format code into exported filename of ledger
NEW: Add hidden option EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE
NEW: Add hidden option MAIN_DOCUMENTS_DESCRIPTION_FIRST
NEW: Add link to inventory code
NEW: Add more common social networks fields for business
NEW: Add option PDF_DISABLE_MYCOMPANY_LOGO to disable logo on PDF
NEW: add option PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT
NEW: Add option to display thirdparty adress in combolist
NEW: Add option to swap sender/recipient address on PDF
NEW: Add option to display thirdparty adress in combolist
NEW: Add project on pament of salaries
NEW: Add SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME and
NEW: Add somes hooks in bank planned entries
NEW: Add supplier ref in item reception page
NEW: Advanced permission to ignore price min
NEW: Allow to enter a timespent with a numeric value
NEW: Automatic position of scroll when creating an extrafield
NEW: Can add autorefresh=X in any URLs to refresh page after X seconds
NEW: can add project's task to agenda on create event form
NEW: Can delete a website in experimental website module
NEW: Can disable meteo on smartphone only
NEW: Can export/import a website template
NEW: Can filter on EEC, not EEC, etc... in binding step of accountancy
NEW: Can mix offset before and after with rules for due date of invoices
NEW: Can record the supplier product description
NEW: Can select several prospect level in thirdparty filter.
NEW: Can set 2 url in url field of thirdparty
NEW: Can set if a field is mandatory on form level.
NEW: Can set the default focus of each page.
NEW: Add category filter on user list
NEW: Change forgotten password link in general parameters
NEW: Child label of variants change if parent label changes
NEW: Compatibility with new Paybox HMAC requirement
NEW: Each user can set its prefered default calendar page
NEW: Enhancement in process to make manual bank conciliation
NEW: Enhancement in the generic file manager
NEW: Extrafield totalizable
NEW: Hidden conf INVOICE_USE_DEFAULT_DOCUMENT
NEW: hidden conf to search product by supplier ref
NEW: hidden constant to be able to use a thirdparty for donation
NEW: hidden option to define an invoice template for each invoice type
NEW: Highlight lines on lists when they are checked
NEW: Notification module support expense report+holiday validation and approval
NEW: On customer/supplier card, add simple tooltip to amount boxes
NEW: Page to check if the operations/items created between two dates have attached item(s) and possibility to download all attachements
NEW: possibility to add all rights of all modules in one time
NEW: redirect if only one result on global search on card
NEW: Permission to ignore price min
NEW: Can build an archive of full documents directory from backup page
NEW: tag odt line_product_ref_fourn for supplier doc lines
NEW: The binding step in accountancy has a country filter with autocompletion
NEW: Top menu is always on screen with MD theme.
NEW: Withdraw request massaction can include already partially paid invoices
For developers: For developers:
* Code changes to be more compatible with PSR2 NEW: Add lib for multiselect with checkboxes
* Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that) NEW: Add function isValidMXRecord
NEW: Add hook changeRoundingMode in update_price
NEW: Add hook formconfirm to contractcard
NEW: Add hook for virtual stock
NEW: ADD url to see the last version of a external module
NEW: Can enable a module, even external module, from command line
NEW: Can set a tooltip help text on extrafields
NEW: Add product search from barcode via REST api
NEW: can add documents on agenda events using API REST
NEW: Can set the datestart and dateend of cron job into module descriptor
NEW: Close #9296 Add field ref_ext into llx_categorie
NEW: move ticket dictionary in API /setup
NEW: PHPUnitTest on Loan class #3163
NEW: Code changes to be more compatible with PSR2
NEW: Removed trigger USER_LOGOUT, USER_LOGIN, USER_LOGIN_FAILED (Some hooks are already dedicated for that)
NEW: Add agenda documents in API REST
NEW: Add "checked" field for new list engine compatibility
NEW: REST API improvements
NEW: Save external payment IDs into table of payment
NEW: triggers add commercial and del commercial
NEW: #9236 Allow to import shipment lines via API
NEW: ADD civility list in API
NEW: support selllist in the module builder
NEW: optional param to show a specific extrafield
NEW: hook formConfirm always called if hooked
NEW: hook on dispatch order fourn
WARNING: WARNING:
@ -27,6 +118,8 @@ Following changes may create regressions for some external modules, but were nec
replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for replace them with links like viewimages.php?modulepart=mycompany&file=logos/... (note that link change only for
modulepart=mycompany that now works like others). modulepart=mycompany that now works like others).
* Hidden option MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT has been renamed into SHIPPING_PDF_DISPLAY_AMOUNT_HT * Hidden option MAIN_PDF_SHIPPING_DISPLAY_AMOUNT_HT has been renamed into SHIPPING_PDF_DISPLAY_AMOUNT_HT
* Remove the no more used and deprecated dol_print_graph function
***** ChangeLog for 8.0.3 compared to 8.0.2 ***** ***** ChangeLog for 8.0.3 compared to 8.0.2 *****

View File

@ -0,0 +1 @@
htdocs/install/doctemplates/websites/website_template-corporate.zip

View File

@ -3,18 +3,30 @@ FROM php:7.0-apache
ENV HOST_USER_ID 33 ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC' ENV PHP_INI_DATE_TIMEZONE 'UTC'
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \ RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libldap2-dev \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \ && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd \ && docker-php-ext-install gd \
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \ && docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
&& docker-php-ext-install ldap \ && docker-php-ext-install ldap \
&& docker-php-ext-install mysqli \ && docker-php-ext-install mysqli \
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev && apt-get purge -y libjpeg-dev libldap2-dev
COPY docker-run.sh /usr/local/bin/ COPY docker-run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-run.sh RUN chmod +x /usr/local/bin/docker-run.sh
RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
RUN echo 'zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so"' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_autostart=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.default_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_host=docker.for.mac.host.internal' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_connect_back=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.profiler_enable=0' >> /usr/local/etc/php/php.ini
RUN echo 'xdebug.remote_log="/tmp/xdebug.log"' >> /usr/local/etc/php/php.ini
EXPOSE 80 EXPOSE 80
ENTRYPOINT ["docker-run.sh"] ENTRYPOINT ["docker-run.sh"]

View File

@ -535,6 +535,8 @@ if ($nboftargetok) {
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files $ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs, even symbolic links, but not files
# Removed known external modules to avoid any error when packaging from env where external modules are tested # Removed known external modules to avoid any error when packaging from env where external modules are tested
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/abricot*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/allscreens*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
@ -549,12 +551,14 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ndf*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nomenclature*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/of/`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/oscim*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/accountingexport*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
# Removed other test files # Removed other test files

View File

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions() # script_dolibarr_versions()
sub script_dolibarr_versions sub script_dolibarr_versions
{ {
return ( "7.0.0", "6.0.5", "5.0.7" ); return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" );
} }
sub script_dolibarr_release sub script_dolibarr_release
@ -263,15 +263,16 @@ if ($upgrade) {
local @params = ( [ "action", "upgrade" ], local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ], [ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ], [ "versionto", $ver ],
[ "installlock", "444" ],
); );
local $p = $ver >= 3.8 ? "step5" : "etape5"; local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory. # Remove the installation directory. (deprecated)
local $dinstall = "$opts->{'dir'}/install"; # local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; # $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
} }
else { else {
@ -306,15 +307,18 @@ else {
[ "login", "admin" ], [ "login", "admin" ],
[ "pass", $dompass ], [ "pass", $dompass ],
[ "pass_verif", $dompass ], [ "pass_verif", $dompass ],
[ "installlock", "444" ],
); );
local $p = $ver >= 3.8 ? "step5" : "etape5"; local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts); local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err); return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file. # Remove the installation directory (deprecated)
local $dinstall = "$opts->{'dir'}/install"; # local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//; # $dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall)); # $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Protect config file
&set_permissions_as_domain_user($d, 0644, $cfile); &set_permissions_as_domain_user($d, 0644, $cfile);
&set_permissions_as_domain_user($d, 0755, $cfiledir); &set_permissions_as_domain_user($d, 0755, $cfiledir);
} }
@ -386,6 +390,8 @@ sub script_dolibarr_check_latest
{ {
local ($ver) = @_; local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr", local @vers = &osdn_package_versions("dolibarr",
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" : $ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -171,6 +171,8 @@ export list="
--ignore-table=$base.llx_abonne_extrafields --ignore-table=$base.llx_abonne_extrafields
--ignore-table=$base.llx_abonne_type --ignore-table=$base.llx_abonne_type
--ignore-table=$base.llx_abonnement --ignore-table=$base.llx_abonnement
--ignore-table=$base.llx_accountingaccount
--ignore-table=$base.llx_accountingsystem
--ignore-table=$base.llx_advanced_extrafields --ignore-table=$base.llx_advanced_extrafields
--ignore-table=$base.llx_advanced_extrafields_options --ignore-table=$base.llx_advanced_extrafields_options
--ignore-table=$base.llx_advanced_extrafields_values --ignore-table=$base.llx_advanced_extrafields_values

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1" xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" xmi:id="_qb8akM37EdqwVrslYOdUDA">
<packagedElement xmi:type="uml:Package" xmi:id="_w8IxIM37EdqwVrslYOdUDA" name="dolibarr">
<packagedElement xmi:type="uml:Package" xmi:id="_T5aZ4FK9Ed60vaZbVikprw" name="OrdersModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_ZhuGMlK9Ed60vaZbVikprw" name="InvoiceModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_cf3SUlK9Ed60vaZbVikprw" name="UserModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_maM0glK9Ed60vaZbVikprw" name="FoundationModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_oqTO4lK9Ed60vaZbVikprw" name="ContractsModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_rEq_klK9Ed60vaZbVikprw" name="ProposalsModule"/>
<packagedElement xmi:type="uml:Package" xmi:id="_vxYmUlK9Ed60vaZbVikprw" name="EMailingManagement"/>
</packagedElement>
</uml:Model>

View File

@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<diagrams:Diagrams xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.topcased.org/DI/1.0" xmlns:diagrams="http://www.topcased.org/Diagrams/1.0" xmi:id="_SI6FkFK9Ed60vaZbVikprw" activeDiagram="_SI6FkVK9Ed60vaZbVikprw">
<model href="dolibarr.uml#_w8IxIM37EdqwVrslYOdUDA"/>
<diagrams xmi:id="_SI6FkVK9Ed60vaZbVikprw" position="0,0" size="100,100" name="dolibarr" viewport="0,0">
<property xmi:id="_SJ9OcFK9Ed60vaZbVikprw" key="pageFormatName" value="A4"/>
<property xmi:id="_SJ9OcVK9Ed60vaZbVikprw" key="diagramWidth" value="840"/>
<property xmi:id="_SJ9OclK9Ed60vaZbVikprw" key="diagramHeight" value="1188"/>
<property xmi:id="_SJ9Oc1K9Ed60vaZbVikprw" key="pageMarginName" value="Small Margin"/>
<property xmi:id="_SJ9OdFK9Ed60vaZbVikprw" key="diagramTopMargin" value="20"/>
<property xmi:id="_SJ9OdVK9Ed60vaZbVikprw" key="diagramBottomMargin" value="20"/>
<property xmi:id="_SJ9OdlK9Ed60vaZbVikprw" key="diagramLeftMargin" value="20"/>
<property xmi:id="_SJ9Od1K9Ed60vaZbVikprw" key="diagramRightMargin" value="20"/>
<property xmi:id="_SJ9OeFK9Ed60vaZbVikprw" key="orientation" value="portrait"/>
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_SI6FklK9Ed60vaZbVikprw" presentation="org.topcased.modeler.uml.classdiagram">
<element href="dolibarr.uml#_w8IxIM37EdqwVrslYOdUDA"/>
</semanticModel>
<contained xsi:type="di:GraphNode" xmi:id="_T2b-YFK9Ed60vaZbVikprw" position="15,190" size="176,81">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_T2b-YVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_T5aZ4FK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_ZhuGMFK9Ed60vaZbVikprw" position="15,118" size="177,68">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_ZhuGMVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_ZhuGMlK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_cf3SUFK9Ed60vaZbVikprw" position="15,10" size="174,81">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_cf3SUVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_cf3SUlK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_maM0gFK9Ed60vaZbVikprw" position="291,118" size="145,73">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_maM0gVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_maM0glK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_oqTO4FK9Ed60vaZbVikprw" position="15,274" size="179,80">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_oqTO4VK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_oqTO4lK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_rEq_kFK9Ed60vaZbVikprw" position="15,358" size="181,73">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_rEq_kVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_rEq_klK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
<contained xsi:type="di:GraphNode" xmi:id="_vxYmUFK9Ed60vaZbVikprw" position="15,490" size="181,80">
<semanticModel xsi:type="di:EMFSemanticModelBridge" xmi:id="_vxYmUVK9Ed60vaZbVikprw" presentation="default">
<element href="dolibarr.uml#_vxYmUlK9Ed60vaZbVikprw"/>
</semanticModel>
</contained>
</diagrams>
</diagrams:Diagrams>

View File

@ -7,12 +7,12 @@ Download
-------------------------------- --------------------------------
* Dolibarr ERP/CRM can be downloaded at sourceforge: * Dolibarr ERP/CRM can be downloaded at sourceforge:
http://sourceforge.net/projects/dolibarr/files https://sourceforge.net/projects/dolibarr/files
or from Dolibarr official web site: or from Dolibarr official web site:
http://www.dolibarr.org https://www.dolibarr.org
* Most external modules are only available on DoliStore: * Most external modules are only available on DoliStore:
http://www.dolistore.org https://www.dolistore.com
-------------------------------- --------------------------------
@ -22,4 +22,4 @@ Install
* For a Quick guide, take a look at README file into root directory. * For a Quick guide, take a look at README file into root directory.
* More complete documentations are also available on line on the Dolibarr Wiki: * More complete documentations are also available on line on the Dolibarr Wiki:
http://wiki.dolibarr.org https://wiki.dolibarr.org

33
doc/install/README-DE Normal file
View File

@ -0,0 +1,33 @@
README (deutsch / german / allemand)
--------------------------------
--------------------------------
Download / Herunterladen
--------------------------------
* Dolibarr ERP/CRM kann man über die offizielle Dolibarr Website
https://www.dolibarr.org/downloads
oder direkt von Sourceforge
https://sourceforge.net/projects/dolibarr/files/
herunterladen.
* Die meisten externen Module/Themens sind über den DoliStore verfügbar:
https://www.dolistore.com/de/
--------------------------------
Installation
--------------------------------
* Für eine kurze Einleitung, schau auf die README Datei im Hauptverzeichnis.
* Umfangreiche Dokumentationen sind im Dolibarr Wiki zu finden:
https://wiki.dolibarr.org/index.php/Hauptseite
* eine Deutsche Community bietet der Dolibarr e.V. unter
https://www.dolibarr.de/

6
htdocs/.gitignore vendored
View File

@ -23,4 +23,8 @@
/cabinetmed* /cabinetmed*
/webmail* /webmail*
/conf/conf.php /conf/conf.php
/subtotal/ /subtotal*
/abricot*
/nomenclature*
/of/
/workstation/

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -41,6 +41,7 @@ $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel','alpha'); $cancel = GETPOST('cancel','alpha');
$accountingaccount = GETPOST('accountingaccount','alpha');
// Security check // Security check
@ -229,7 +230,7 @@ if ($action == 'create') {
// Account number // Account number
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>'; print '<tr><td class="titlefieldcreate"><span class="fieldrequired">' . $langs->trans("AccountNumber") . '</span></td>';
print '<td><input name="account_number" size="30" value="' . $object->account_number . '"></td></tr>'; print '<td><input name="account_number" size="30" value="' . $accountingaccount . '"></td></tr>';
// Label // Label
print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>'; print '<tr><td><span class="fieldrequired">' . $langs->trans("Label") . '</span></td>';

View File

@ -58,7 +58,7 @@ $pagenext = $page + 1;
$search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
$search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); $search_date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha'); $search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
if ($search_accountancy_code_start == - 1) { if ($search_accountancy_code_start == - 1) {
@ -127,7 +127,6 @@ if (! empty($search_accountancy_code_end)) {
$param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end; $param .= '&amp;search_accountancy_code_end=' . $search_accountancy_code_end;
} }
/* /*
* Action * Action
*/ */
@ -154,7 +153,7 @@ if ($action == 'export_csv')
$type_export = 'balance'; $type_export = 'balance';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); $result = $object->fetchAllBalance($sortorder, $sortfield, $limit, 0, $filter);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -266,7 +265,7 @@ if ($action != 'export_csv')
$description = $object->get_compte_desc($line->numero_compte); // Search description of the account $description = $object->get_compte_desc($line->numero_compte); // Search description of the account
$root_account_description = $object->get_compte_racine($line->numero_compte); $root_account_description = $object->get_compte_racine($line->numero_compte);
if (empty($description)) { if (empty($description)) {
$link = '<a href="../admin/card.php?action=create&compte=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; $link = '<a href="../admin/card.php?action=create&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>';
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';

View File

@ -78,7 +78,7 @@ class AccountancyCategory // extends CommonObject
public $range_account; public $range_account;
/** /**
* @var mixed Sample property 1 * @var int Sens of the account: 0: credit - debit, 1: debit - credit
*/ */
public $sens; public $sens;
@ -163,16 +163,17 @@ class AccountancyCategory // extends CommonObject
// Insert request // Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_accounting_category(";
if ($this->rowid > 0) $sql.= "rowid,"; if ($this->rowid > 0) $sql.= "rowid, ";
$sql.= "code,"; $sql.= "code, ";
$sql.= "label,"; $sql.= "label, ";
$sql.= "range_account,"; $sql.= "range_account, ";
$sql.= "sens,"; $sql.= "sens, ";
$sql.= "category_type,"; $sql.= "category_type, ";
$sql.= "formula,"; $sql.= "formula, ";
$sql.= "position,"; $sql.= "position, ";
$sql.= "fk_country,"; $sql.= "fk_country, ";
$sql.= "active"; $sql.= "active, ";
$sql.= "entity";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
if ($this->rowid > 0) $sql.= " ".$this->rowid.","; if ($this->rowid > 0) $sql.= " ".$this->rowid.",";
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").","; $sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
@ -184,6 +185,7 @@ class AccountancyCategory // extends CommonObject
$sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).","; $sql.= " ".(! isset($this->position)?'NULL':$this->db->escape($this->position)).",";
$sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).","; $sql.= " ".(! isset($this->fk_country)?'NULL':$this->db->escape($this->fk_country)).",";
$sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active)); $sql.= " ".(! isset($this->active)?'NULL':$this->db->escape($this->active));
$sql.= ", ".$conf->entity;
$sql.= ")"; $sql.= ")";
$this->db->begin(); $this->db->begin();
@ -237,9 +239,8 @@ class AccountancyCategory // extends CommonObject
* @param string $label Label * @param string $label Label
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch($id,$code='',$label='') function fetch($id, $code='', $label='')
{ {
global $langs;
$sql = "SELECT"; $sql = "SELECT";
$sql.= " t.rowid,"; $sql.= " t.rowid,";
$sql.= " t.code,"; $sql.= " t.code,";
@ -253,8 +254,12 @@ class AccountancyCategory // extends CommonObject
$sql.= " t.active"; $sql.= " t.active";
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t"; $sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql.= " WHERE t.rowid = ".$id; if ($id) $sql.= " WHERE t.rowid = ".$id;
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'"; else
elseif ($label) $sql.= " WHERE t.label = '".$this->db->escape($label)."'"; {
$sql.= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
if ($code) $sql.= " AND t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql.= " AND t.label = '".$this->db->escape($label)."'";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -480,7 +485,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1"; $sql .= " AND aa.active = 1";
$sql .= " AND aa.entity = = " . $conf->entity . ")"; $sql .= " AND aa.entity = " . $conf->entity . ")";
$sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref"; $sql .= " GROUP BY t.numero_compte, t.label_operation, t.doc_ref";
$sql .= " ORDER BY t.numero_compte"; $sql .= " ORDER BY t.numero_compte";
@ -712,49 +717,76 @@ class AccountancyCategory // extends CommonObject
/** /**
* Function to show result of an accounting account from the ledger with a direction and a period * Function to show result of an accounting account from the ledger with a direction and a period
* *
* @param int $cpt Id accounting account * @param int|array $cpt Accounting account or array of accounting account
* @param string $month Specifig month - Can be empty
* @param string $date_start Date start * @param string $date_start Date start
* @param string $date_end Date end * @param string $date_end Date end
* @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit * @param int $sens Sens of the account: 0: credit - debit, 1: debit - credit
* @param string $thirdparty_code Thirdparty code * @param string $thirdparty_code Thirdparty code
* @return integer Result in table * @param int $month Specifig month - Can be empty
* @param int $year Specifig year - Can be empty
* @return integer <0 if KO, >= 0 if OK
*/ */
public function getResult($cpt, $month, $date_start, $date_end, $sens, $thirdparty_code='nofilter') public function getSumDebitCredit($cpt, $date_start, $date_end, $sens, $thirdparty_code='nofilter', $month=0, $year=0)
{ {
global $conf;
$this->sdc = 0;
$this->sdcpermonth = array();
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit"; $sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
if (is_array($cpt)) $sql.=", t.numero_compte as accountancy_account";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
$sql .= " WHERE t.numero_compte = '" . $cpt."'"; //if (in_array($this->db->type, array('mysql', 'mysqli'))) $sql.=' USE INDEX idx_accounting_bookkeeping_doc_date';
if (! empty($date_start) && ! empty($date_end)) $sql .= " WHERE t.entity = ".$conf->entity;
$sql.= " AND t.doc_date >= '".$this->db->idate($date_start)."' AND t.doc_date <= '".$this->db->idate($date_end)."'"; if (is_array($cpt))
if (! empty($month)) { {
$sql .= " AND MONTH(t.doc_date) = " . $month; $listofaccount='';
foreach($cpt as $cptcursor)
{
if ($listofaccount) $listofaccount.=",";
$listofaccount.="'".$cptcursor."'";
}
$sql .= " AND t.numero_compte IN (" .$listofaccount. ")";
}
else
{
$sql .= " AND t.numero_compte = '" . $this->db->escape($cpt) . "'";
}
if (! empty($date_start) && ! empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate($date_start)."' AND '".$this->db->idate($date_end)."')";
if (! empty($month) && ! empty($year)) {
$sql .= " AND (t.doc_date BETWEEN '".$this->db->idate(dol_get_first_day($year, $month))."' AND '".$this->db->idate(dol_get_last_day($year, $month))."')";
} }
if ($thirdparty_code != 'nofilter') if ($thirdparty_code != 'nofilter')
{ {
$sql .= " AND thirdparty_code = '".$this->db->escape($thirdparty_code)."'"; $sql .= " AND t.thirdparty_code = '".$this->db->escape($thirdparty_code)."'";
} }
if (is_array($cpt)) $sql.=" GROUP BY t.numero_compte";
//print $sql;
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql)
if ($resql) { {
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$this->sdc = 0; if ($num)
if ($num) { {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
if ($sens == 1) { if ($sens == 1) {
$this->sdc = $obj->debit - $obj->credit; $this->sdc = $obj->debit - $obj->credit;
} else { } else {
$this->sdc = $obj->credit - $obj->debit; $this->sdc = $obj->credit - $obj->debit;
} }
if (is_array($cpt))
{
$this->sdcperaccount[$obj->accountancy_account] = $this->sdc;
}
} }
return $num; return $num;
} else { } else {
$this->error = "Error " . $this->db->lasterror(); $this->error = "Error " . $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR); dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
return - 1;
} }
} }
@ -766,7 +798,7 @@ class AccountancyCategory // extends CommonObject
*/ */
public function getCats($categorytype=-1) public function getCats($categorytype=-1)
{ {
global $db, $langs, $user, $mysoc, $conf; global $conf, $mysoc;
if (empty($mysoc->country_id)) { if (empty($mysoc->country_id)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
@ -775,7 +807,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type"; $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 "; $sql .= " WHERE c.active = 1";
$sql .= " AND c.entity = " . $conf->entity; $sql .= " AND c.entity = " . $conf->entity;
if ($categorytype >= 0) $sql.=" AND c.category_type = 1"; if ($categorytype >= 0) $sql.=" AND c.category_type = 1";
$sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)"; $sql .= " AND (c.fk_country = ".$mysoc->country_id." OR c.fk_country = 0)";
@ -823,7 +855,7 @@ class AccountancyCategory // extends CommonObject
*/ */
public function getCptsCat($cat_id, $predefinedgroupwhere='') public function getCptsCat($cat_id, $predefinedgroupwhere='')
{ {
global $mysoc; global $conf, $mysoc;
$sql = ''; $sql = '';
if (empty($mysoc->country_id) && empty($mysoc->country_code)) { if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
@ -836,6 +868,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id; $sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
else else
@ -843,6 +876,7 @@ class AccountancyCategory // extends CommonObject
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere; $sql .= " WHERE ".$predefinedgroupwhere;
$sql .= " AND t.entity = " . $conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
//echo $sql; //echo $sql;
@ -856,13 +890,12 @@ class AccountancyCategory // extends CommonObject
if ($num) { if ($num) {
while ($obj = $this->db->fetch_object($resql)) while ($obj = $this->db->fetch_object($resql))
{ {
$name_cat = $obj->name_cat;
$data[] = array ( $data[] = array (
'id' => $obj->rowid, 'id' => $obj->rowid,
'account_number' => $obj->account_number, 'account_number' => $obj->account_number,
'account_label' => $obj->account_label, 'account_label' => $obj->account_label,
); );
$i ++; $i++;
} }
} }
return $data; return $data;

View File

@ -817,7 +817,7 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) { while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -866,14 +866,13 @@ class BookKeeping extends CommonObject
/** /**
* Load object in memory from the database * Load object in memory from the database
* *
* @param string $sortorder Sort Order * @param string $sortorder Sort Order
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param int $limit offset limit * @param int $limit Offset limit
* @param int $offset offset limit * @param int $offset Offset limit
* @param array $filter filter array * @param array $filter Filter array
* @param string $filtermode filter mode (AND or OR) * @param string $filtermode Filter mode (AND or OR)
* * @return int <0 if KO, >0 if OK
* @return int <0 if KO, >0 if OK
*/ */
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{ {
@ -932,7 +931,7 @@ class BookKeeping extends CommonObject
} }
} }
} }
$sql.= ' WHERE entity IN (' . getEntity('accountancy') . ')'; $sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }
@ -950,7 +949,8 @@ class BookKeeping extends CommonObject
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($obj = $this->db->fetch_object($resql) && (empty($limit) || $i < min($limit, $num))) { while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num)))
{
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;
@ -989,8 +989,7 @@ class BookKeeping extends CommonObject
} else { } else {
$this->errors[] = 'Error ' . $this->db->lasterror(); $this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
return -1;
return - 1;
} }
} }
@ -1067,6 +1066,7 @@ class BookKeeping extends CommonObject
$line->numero_compte = $obj->numero_compte; $line->numero_compte = $obj->numero_compte;
$line->debit = $obj->debit; $line->debit = $obj->debit;
$line->credit = $obj->credit; $line->credit = $obj->credit;
$this->lines[] = $line; $this->lines[] = $line;
$i++; $i++;
@ -1577,7 +1577,7 @@ class BookKeeping extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) { if ($result) {
while ( $obj = $this->db->fetch_object($result) ) { while ($obj = $this->db->fetch_object($result)) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
@ -1641,7 +1641,7 @@ class BookKeeping extends CommonObject
$this->linesexport = array (); $this->linesexport = array ();
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
while ( $obj = $this->db->fetch_object($resql) ) { while ($obj = $this->db->fetch_object($resql)) {
$line = new BookKeepingLine(); $line = new BookKeepingLine();
$line->id = $obj->rowid; $line->id = $obj->rowid;

View File

@ -211,7 +211,7 @@ class Lettering extends BookKeeping
} }
if (count($ids) > 1) { if (count($ids) > 1) {
$result = $this->updatelettrage($ids); $result = $this->updateLettering($ids);
} }
} }
} }

View File

@ -94,7 +94,7 @@ $facture_static = new Facture($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
if (! empty($id)) { if (! empty($id)) {
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,"; $sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,"; $sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,";
$sql .= " l.fk_code_ventilation, aa.account_number, aa.label"; $sql .= " l.fk_code_ventilation, aa.account_number, aa.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l";
@ -128,7 +128,7 @@ if (! empty($id)) {
// Ref facture // Ref facture
print '<tr><td>' . $langs->trans("Invoice") . '</td>'; print '<tr><td>' . $langs->trans("Invoice") . '</td>';
$facture_static->ref = $objp->facnumber; $facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid; $facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>'; print '<td>' . $facture_static->getNomUrl(1) . '</td>';
print '</tr>'; print '</tr>';

View File

@ -64,7 +64,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
$offset = $limit * $page; $offset = $limit * $page;
if (! $sortfield) if (! $sortfield)
$sortfield = "f.datef, f.facnumber, fd.rowid"; $sortfield = "f.datef, f.ref, fd.rowid";
if (! $sortorder) { if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
@ -167,7 +167,7 @@ print '<script type="text/javascript">
/* /*
* Customer Invoice lines * Customer Invoice lines
*/ */
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.type, f.datef, f.ref_client,"; $sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,"; $sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,"; $sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
@ -195,7 +195,7 @@ if ($search_lineid) {
$sql .= natural_search("fd.rowid", $search_lineid, 1); $sql .= natural_search("fd.rowid", $search_lineid, 1);
} }
if (strlen(trim($search_invoice))) { if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.facnumber", $search_invoice); $sql .= natural_search("f.ref", $search_invoice);
} }
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref); $sql .= natural_search("p.ref", $search_ref);
@ -331,8 +331,8 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);

View File

@ -75,7 +75,7 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortfield) if (! $sortfield)
$sortfield = "f.datef, f.facnumber, l.rowid"; $sortfield = "f.datef, f.ref, l.rowid";
if (! $sortorder) { if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC"; $sortorder = "DESC";
@ -209,7 +209,7 @@ if (empty($chartaccountcode))
} }
// Customer Invoice lines // Customer Invoice lines
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.datef, f.type as ftype,"; $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
$sql.= " aa.rowid as aarowid,"; $sql.= " aa.rowid as aarowid,";
@ -233,7 +233,7 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1); $sql .= natural_search("l.rowid", $search_lineid, 1);
} }
if (strlen(trim($search_invoice))) { if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.facnumber", $search_invoice); $sql .= natural_search("f.ref", $search_invoice);
} }
if (strlen(trim($search_ref))) { if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref); $sql .= natural_search("p.ref", $search_ref);
@ -399,8 +399,8 @@ if ($result) {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder); //print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);

View File

@ -1142,7 +1142,7 @@ $db->close();
* *
* @param string $val Array of val * @param string $val Array of val
* @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...) * @param string $typerecord Type of record ('payment', 'payment_supplier', 'payment_expensereport', 'payment_vat', ...)
* @return string|unknown * @return string A string label to describe a record into llx_bank_url
*/ */
function getSourceDocRef($val, $typerecord) function getSourceDocRef($val, $typerecord)
{ {
@ -1179,7 +1179,7 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = ''; $sqlmid = '';
if ($typerecord == 'payment') if ($typerecord == 'payment')
{ {
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref'; $sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f"; $sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"]; $sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
$ref = $langs->trans("Invoice"); $ref = $langs->trans("Invoice");
@ -1250,7 +1250,8 @@ function getSourceDocRef($val, $typerecord)
{ {
dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG); dol_syslog("accountancy/journal/bankjournal.php::sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid); $resultmid = $db->query($sqlmid);
if ($resultmid) { if ($resultmid)
{
while ($objmid = $db->fetch_object($resultmid)) while ($objmid = $db->fetch_object($resultmid))
{ {
$ref.=' '.$objmid->ref; $ref.=' '.$objmid->ref;
@ -1259,6 +1260,6 @@ function getSourceDocRef($val, $typerecord)
else dol_print_error($db); else dol_print_error($db);
} }
$ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 ... i< < than max size of 300 $ref = dol_trunc($langs->trans("BankId").' '.$val['fk_bank'].' - '.$ref, 295); // 295 + 3 dots (...) is < than max size of 300
return $ref; return $ref;
} }

View File

@ -97,7 +97,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
$idpays = $mysoc->country_id; $idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,"; $sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
@ -195,7 +195,7 @@ if ($result) {
// Invoice lines // Invoice lines
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df); $tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr); $tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
$tabfac[$obj->rowid]["ref"] = $obj->facnumber; $tabfac[$obj->rowid]["ref"] = $obj->ref;
$tabfac[$obj->rowid]["type"] = $obj->type; $tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->label_compte; $tabfac[$obj->rowid]["description"] = $obj->label_compte;
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries) $tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)

View File

@ -96,7 +96,7 @@ $facturefournisseur_static = new FactureFournisseur($db);
$formaccounting = new FormAccounting($db); $formaccounting = new FormAccounting($db);
if (! empty($id)) { if (! empty($id)) {
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; $sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
$sql .= ", aa.account_number, aa.label"; $sql .= ", aa.account_number, aa.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
@ -129,7 +129,7 @@ if (! empty($id)) {
// ref invoice // ref invoice
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>'; print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
$facturefournisseur_static->ref = $objp->facnumber; $facturefournisseur_static->ref = $objp->ref;
$facturefournisseur_static->id = $objp->facid; $facturefournisseur_static->id = $objp->facid;
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>'; print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
print '</tr>'; print '</tr>';

View File

@ -1031,7 +1031,7 @@ else
// Categories // Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
print '<tr><td>' . fieldLabel('Categories', 'memcars') . '</td><td>'; print '<tr><td>' .$form->editfieldkey("Categories", 'memcats', '', $object, 0) . '</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%'); print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%');
print "</td></tr>"; print "</td></tr>";
@ -1154,7 +1154,7 @@ else
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="login" class="minwidth300" maxlength="50" value="'.(isset($_POST["login"])?GETPOST("login",'alpha',2):$object->login).'"></td></tr>';
} }
// Password // Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{ {
print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Password").'</td><td><input type="password" name="pass" class="minwidth300" maxlength="50" value="'.(isset($_POST["pass"])?GETPOST("pass",'',2):$object->pass).'"></td></tr>';
@ -1281,13 +1281,16 @@ else
// Categories // Categories
if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire ))
{ {
print '<tr><td>' . fieldLabel('Categories', 'memcats') . '</td>'; print '<tr><td>' . $form->editfieldkey("Categories", 'memcats', '', $object, 0) . '</td>';
print '<td>'; print '<td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
$c = new Categorie($db); $c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_MEMBER); $cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
foreach ($cats as $cat) { $arrayselected = array();
$arrayselected[] = $cat->id; if (is_array($cats)) {
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
} }
print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>"; print "</td></tr>";
@ -1634,11 +1637,8 @@ else
if (! empty($conf->societe->enabled)) if (! empty($conf->societe->enabled))
{ {
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->adherent->creer;
print $langs->trans("LinkedToDolibarrThirdParty"); print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable);
print '</td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
if ($action == 'editthirdparty') if ($action == 'editthirdparty')
{ {
@ -1672,19 +1672,8 @@ else
// Login Dolibarr // Login Dolibarr
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer;
print $langs->trans("LinkedToDolibarrUser"); print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable);
print '</td>';
if ($action != 'editlogin' && $user->rights->adherent->creer)
{
print '<td align="right">';
if ($user->rights->user->user->creer)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a>';
}
print '</td>';
}
print '</tr></table>';
print '</td><td colspan="2" class="valeur">'; print '</td><td colspan="2" class="valeur">';
if ($action == 'editlogin') if ($action == 'editlogin')
{ {

View File

@ -59,6 +59,9 @@ class Adherent extends CommonObject
public $mesgs; public $mesgs;
/**
* @var string login of member
*/
public $login; public $login;
//! Clear password in memory //! Clear password in memory
@ -68,29 +71,70 @@ class Adherent extends CommonObject
//! Encrypted password in database (always defined) //! Encrypted password in database (always defined)
public $pass_indatabase_crypted; public $pass_indatabase_crypted;
/**
* @var string company name
* @deprecated
*/
public $societe; public $societe;
/** /**
* @var Societe $company {@type Societe} * @var string company name
*/ */
public $company; public $company;
/**
* @var int Thirdparty ID
*/
public $fk_soc;
/** /**
* @var string Address * @var string Address
*/ */
public $address; public $address;
public $zip; /**
* @var string zipcode
*/
public $zip;
/**
* @var string town
*/
public $town; public $town;
public $state_id; // Id of department /**
public $state_code; // Code of department * @var int Id of state
public $state; // Label of department */
public $state_id;
/**
* @var string Code of state
*/
public $state_code;
/**
* @var string Label of state
*/
public $state;
/**
* @var string email
*/
public $email; public $email;
public $skype; /**
public $twitter; * @var string skype account
*/
public $skype;
/**
* @var string twitter account
*/
public $twitter;
/**
* @var string facebook account
*/
public $facebook; public $facebook;
/** /**
@ -120,8 +164,12 @@ class Adherent extends CommonObject
public $morphy; public $morphy;
public $public; public $public;
public $statut; // -1:brouillon, 0:resilie, >=1:valide,paye
public $photo; // -1:brouillon, 0:resilie, >=1:valide,paye
// def in common object
//public $statut;
public $photo;
public $datec; public $datec;
public $datem; public $datem;
@ -129,21 +177,20 @@ class Adherent extends CommonObject
public $birth; public $birth;
public $note_public; /**
public $note_private; * @var int id type member
*/
public $typeid;
public $typeid; // Id type adherent /**
public $type; // Libelle type adherent * @var string label type member
*/
public $type;
public $need_subscription; public $need_subscription;
public $user_id; public $user_id;
public $user_login; public $user_login;
/**
* @var int Thirdparty ID
*/
public $fk_soc;
public $datefin; // From member table public $datefin; // From member table
// Fields loaded by fetch_subscriptions() // Fields loaded by fetch_subscriptions()
@ -155,7 +202,10 @@ class Adherent extends CommonObject
public $last_subscription_amount; public $last_subscription_amount;
public $subscriptions=array(); public $subscriptions=array();
public $oldcopy; // To contains a clone of this when we need to save old properties of object /**
* @var Adherent To contains a clone of this when we need to save old properties of object
*/
public $oldcopy;
/** /**
* @var int Entity * @var int Entity
@ -593,11 +643,11 @@ class Adherent extends CommonObject
$luser->societe_id=$this->societe; $luser->societe_id=$this->societe;
$luser->birth=$this->birth; $luser->birth=$this->birth;
$luser->address=$this->address; $luser->address=$this->address;
$luser->zip=$this->zip; $luser->zip=$this->zip;
$luser->town=$this->town; $luser->town=$this->town;
$luser->country_id=$this->country_id; $luser->country_id=$this->country_id;
$luser->state_id=$this->state_id; $luser->state_id=$this->state_id;
$luser->email=$this->email; $luser->email=$this->email;
$luser->skype=$this->skype; $luser->skype=$this->skype;
@ -2656,7 +2706,7 @@ class Adherent extends CommonObject
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent")); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Adherent"));
return 0; return 0;
} }
$now = dol_now(); $now = dol_now();
$nbok = 0; $nbok = 0;
$nbko = 0; $nbko = 0;
@ -2760,9 +2810,9 @@ class Adherent extends CommonObject
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message); $actionmsg = dol_concatdesc($actionmsg, $message);
} }
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Insert record of emails sent // Insert record of emails sent
$actioncomm = new ActionComm($this->db); $actioncomm = new ActionComm($this->db);
@ -2787,10 +2837,10 @@ class Adherent extends CommonObject
$actioncomm->email_tobcc = $sendtobcc; $actioncomm->email_tobcc = $sendtobcc;
$actioncomm->email_subject = $subject; $actioncomm->email_subject = $subject;
$actioncomm->errors_to = ''; $actioncomm->errors_to = '';
$actioncomm->fk_element = $adherent->id; $actioncomm->fk_element = $adherent->id;
$actioncomm->elementtype = $adherent->element; $actioncomm->elementtype = $adherent->element;
$actioncomm->extraparams = $extraparams; $actioncomm->extraparams = $extraparams;
$actioncomm->create($user); $actioncomm->create($user);

View File

@ -337,11 +337,14 @@ class Subscription extends CommonObject
/** /**
* Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* *
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $notooltip 1=Disable tooltip * @param int $notooltip 1=Disable tooltip
* @return string Chaine avec URL * @param string $option Page for link ('', 'nolink', ...)
* @param string $morecss Add more css on link
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0, $notooltip=0) function getNomUrl($withpicto=0, $notooltip=0, $option='', $morecss='', $save_lastsearch_value=-1)
{ {
global $langs; global $langs;
@ -350,8 +353,18 @@ class Subscription extends CommonObject
$langs->load("members"); $langs->load("members");
$label=$langs->trans("ShowSubscription").': '.$this->ref; $label=$langs->trans("ShowSubscription").': '.$this->ref;
$linkstart = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; $url = DOL_URL_ROOT.'/adherents/subscription/card.php?rowid='.$this->id;
$linkend='</a>';
if ($option != 'nolink')
{
// Add param to save lastsearch_values or not
$add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1;
if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1';
}
$linkstart = '<a href="'.$url.'" class="classfortooltip" title="'.dol_escape_htmltag($label, 1).'">';
$linkend = '</a>';
$picto='payment'; $picto='payment';

View File

@ -79,8 +79,9 @@ $pagenext = $page + 1;
if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); } if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); } if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new Adherent($db); $object = new Adherent($db);
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('memberlist')); $hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
@ -348,8 +349,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
// 'presend'=>$langs->trans("SendByMail"), //'presend'=>$langs->trans("SendByMail"),
// 'builddoc'=>$langs->trans("PDFMerge"), //'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
@ -603,6 +604,7 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="c
print "</tr>\n"; print "</tr>\n";
$i = 0; $i = 0;
$totalarray=array();
while ($i < min($num, $limit)) while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -631,6 +633,7 @@ while ($i < min($num, $limit))
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
{ {
print '<td align="center">'.$obj->rowid.'</td>'; print '<td align="center">'.$obj->rowid.'</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Ref // Ref
@ -639,6 +642,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print $memberstatic->getNomUrl(-1, 0, 'card', 'ref');
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Civility // Civility
if (! empty($arrayfields['d.civility']['checked'])) if (! empty($arrayfields['d.civility']['checked']))
@ -646,6 +650,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $obj->civility; print $obj->civility;
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Firstname // Firstname
if (! empty($arrayfields['d.firstname']['checked'])) if (! empty($arrayfields['d.firstname']['checked']))
@ -653,6 +658,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $obj->firstname; print $obj->firstname;
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Lastname // Lastname
if (! empty($arrayfields['d.lastname']['checked'])) if (! empty($arrayfields['d.lastname']['checked']))
@ -660,6 +666,7 @@ while ($i < min($num, $limit))
print "<td>"; print "<td>";
print $obj->lastname; print $obj->lastname;
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Company // Company
if (! empty($arrayfields['d.company']['checked'])) if (! empty($arrayfields['d.company']['checked']))
@ -672,11 +679,13 @@ while ($i < min($num, $limit))
if (! empty($arrayfields['d.login']['checked'])) if (! empty($arrayfields['d.login']['checked']))
{ {
print "<td>".$obj->login."</td>\n"; print "<td>".$obj->login."</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Moral/Physique // Moral/Physique
if (! empty($arrayfields['d.morphy']['checked'])) if (! empty($arrayfields['d.morphy']['checked']))
{ {
print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n"; print "<td>".$memberstatic->getmorphylib($obj->morphy)."</td>\n";
if (! $i) $totalarray['nbfield']++;
} }
// Type label // Type label
if (! empty($arrayfields['t.libelle']['checked'])) if (! empty($arrayfields['t.libelle']['checked']))
@ -686,6 +695,7 @@ while ($i < min($num, $limit))
print '<td class="nowrap">'; print '<td class="nowrap">';
print $membertypestatic->getNomUrl(1,32); print $membertypestatic->getNomUrl(1,32);
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Address // Address
if (! empty($arrayfields['d.address']['checked'])) if (! empty($arrayfields['d.address']['checked']))
@ -693,6 +703,7 @@ while ($i < min($num, $limit))
print '<td class="nocellnopadd">'; print '<td class="nocellnopadd">';
print $obj->address; print $obj->address;
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++;
} }
// Zip // Zip
if (! empty($arrayfields['d.zip']['checked'])) if (! empty($arrayfields['d.zip']['checked']))
@ -828,6 +839,36 @@ while ($i < min($num, $limit))
$i++; $i++;
} }
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql); $db->free($resql);
$parameters=array('sql' => $sql); $parameters=array('sql' => $sql);

View File

@ -191,7 +191,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment'); dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
print "\n"; print "\n";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -290,7 +290,7 @@ if ($rowid && $action != 'edit')
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback, 1); dol_banner_tab($object, 'rowid', $linkback, 1);

View File

@ -28,12 +28,18 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("members"); $langs->load(array("members","companies"));
$filter=$_GET["filter"]; $action=GETPOST('action','aZ09');
$statut=isset($_GET["statut"])?$_GET["statut"]:1; $massaction=GETPOST('massaction','alpha');
$confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array');
$filter=GETPOST("filter","alpha");
$statut=(GETPOSTISSET("statut")?GETPOST("statut","alpha"):1);
$search_ref=GETPOST('search_ref','alpha'); $search_ref=GETPOST('search_ref','alpha');
$search_lastname=GETPOST('search_lastname','alpha'); $search_lastname=GETPOST('search_lastname','alpha');
$search_firstname=GETPOST('search_firstname','alpha');
$search_login=GETPOST('search_login','alpha'); $search_login=GETPOST('search_login','alpha');
$search_note=GETPOST('search_note','alpha'); $search_note=GETPOST('search_note','alpha');
$search_account=GETPOST('search_account','int'); $search_account=GETPOST('search_account','int');
@ -67,6 +73,20 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
$fieldstosearchall = array( $fieldstosearchall = array(
); );
$arrayfields=array( $arrayfields=array(
'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1),
'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1),
'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1),
't.libelle'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(! empty($conf->banque->enabled))),
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
'd.datedebut'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
// 'd.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000)
); );
// Security check // Security check
@ -74,7 +94,7 @@ $result=restrictedArea($user,'adherent','','','cotisation');
/* /*
* Actions * Actions
*/ */
if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; }
@ -111,15 +131,16 @@ if (empty($reshook))
*/ */
$form=new Form($db); $form=new Form($db);
$subscription=new Subscription($db);
$adherent=new Adherent($db);
$accountstatic=new Account($db);
llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros'); $now=dol_now();
// List of subscriptions // List of subscriptions
$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,"; $sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,";
$sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.rowid as crowid, c.subscription,";
$sql.= " c.dateadh,"; $sql.= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,";
$sql.= " c.datef,";
$sql.= " c.fk_bank as bank, c.note,"; $sql.= " c.fk_bank as bank, c.note,";
$sql.= " b.fk_account"; $sql.= " b.fk_account";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
@ -136,253 +157,444 @@ if ($search_ref)
if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")"; if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")";
else $sql.=" AND 1 = 2"; // Always wrong else $sql.=" AND 1 = 2"; // Always wrong
} }
if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname); if ($search_lastname) $sql.= natural_search(array('d.lastname','d.societe'), $search_lastname);
if ($search_login) $sql.= natural_search('c.subscription', $search_login); if ($search_firstname) $sql.= natural_search(array('d.firstname'), $search_firstname);
if ($search_login) $sql.= natural_search('d.login', $search_login);
if ($search_note) $sql.= natural_search('c.note', $search_note); if ($search_note) $sql.= natural_search('c.note', $search_note);
if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; if ($search_account > 0) $sql.= " AND b.fk_account = ".urldecode($search_account);
if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
// Count total nb of records with no order and no limits
$nbtotalofrecords = ''; $nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
$result = $db->query($sql); $resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result); if ($resql) $nbtotalofrecords = $db->num_rows($resql);
else dol_print_error($db);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{ {
$page = 0; $page = 0;
$offset = 0; $offset = 0;
} }
} }
// Add limit
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if (! $result)
{ {
$num = $db->num_rows($result); dol_print_error($db);
exit;
}
$arrayofselected=is_array($toselect)?$toselect:array(); $num = $db->num_rows($result);
$i = 0; $arrayofselected=is_array($toselect)?$toselect:array();
$title=$langs->trans("ListOfSubscriptions"); if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; {
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/adherents/subscription/card.php?id='.$id);
exit;
}
$param=''; llxHeader('',$langs->trans("ListOfSubscriptions"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
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 ($search_lastname) $param.="&search_lastname=".$search_lastname;
if ($search_login) $param.="&search_login=".$search_login;
if ($search_acount) $param.="&search_account=".$search_account;
if ($search_amount) $param.="&search_amount=".$search_amount;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// List of mass actions available $i = 0;
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$newcardbutton=''; $title=$langs->trans("ListOfSubscriptions");
if ($user->rights->adherent->cotisation->creer) if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
{
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; $param='';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">'; if ($statut != '') $param.="&statut=".urlencode($statut);
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">'; if ($date_select) $param.="&date_select=".urlencode($date_select);
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname);
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; if ($search_login) $param.="&search_login=".urlencode($search_login);
print '<input type="hidden" name="page" value="'.$page.'">'; if ($search_acount) $param.="&search_account=".urlencode($search_account);
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; if ($search_amount) $param.="&search_amount=".urlencode($search_amount);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); // List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
//'builddoc'=>$langs->trans("PDFMerge"),
);
//if ($user->rights->adherent->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$topicmail="Information"; $newcardbutton='';
$modelmail="subscription"; if ($user->rights->adherent->cotisation->creer)
$objecttmp=new Subscription($db); {
$trackid='sub'.$object->id; $newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/adherents/list.php?status=-1,1"><span class="valignmiddle">'.$langs->trans('NewSubscription').'</span>';
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
if ($sall) print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
{ if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
} print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
$moreforfilter = ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit);
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $topicmail="Information";
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $modelmail="subscription";
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); $objecttmp=new Subscription($db);
$trackid='sub'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
print '<div class="div-table-responsive">'; if ($sall)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; {
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
// Line for filters fields $moreforfilter = '';
print '<tr class="liste_titre_filter">';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
// Line for filters fields
print '<tr class="liste_titre_filter">';
// Line numbering
if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
{
print '<td class="liste_titre">&nbsp;</td>';
}
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="4"></td>'; print '<input class="flat" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'" size="4"></td>';
}
if (! empty($arrayfields['d.lastname']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>'; print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="7"></td>';
}
if (! empty($arrayfields['d.firstname']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_firstname" value="'.dol_escape_htmltag($search_firstname).'" size="12"></td>';
}
if (! empty($arrayfields['d.login']['checked']))
{
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>'; print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>';
}
print '<td class="liste_titre" align="left">'; if (! empty($arrayfields['t.libelle']['checked']))
print '<input class="flat" type="text" name="search_note" value="'.dol_escape_htmltag($search_note).'" size="7"></td>'; {
print '<td class="liste_titre">';
print '';
print '</td>';
}
if (! empty($conf->banque->enabled)) if (! empty($arrayfields['d.bank']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $form->select_comptes($search_account, 'search_account', 0, '', 1); print $form->select_comptes($search_account, 'search_account', 0, '', 1);
print '</td>'; print '</td>';
} }
if (! empty($arrayfields['d.date_debut']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['d.date_fin']['checked']))
{
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
}
if (! empty($arrayfields['d.amount']['checked']))
{
print '<td align="right" class="liste_titre">'; print '<td align="right" class="liste_titre">';
print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">'; print '<input class="flat" type="text" name="search_amount" value="'.dol_escape_htmltag($search_amount).'" size="4">';
print '</td>'; print '</td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled))
{
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
}
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Static objects
$subscription=new Subscription($db);
$adherent=new Adherent($db);
$accountstatic=new Account($db);
$total=0;
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$total+=$obj->subscription;
$subscription->ref=$obj->crowid;
$subscription->id=$obj->crowid;
$adherent->lastname=$obj->lastname;
$adherent->firstname=$obj->firstname;
$adherent->ref=$obj->rowid;
$adherent->id=$obj->rowid;
$adherent->statut=$obj->statut;
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
print '<tr class="oddeven">';
// Ref
print '<td>'.$subscription->getNomUrl(1).'</td>';
// Lastname
print '<td>'.$adherent->getNomUrl(-1).'</td>';
// Login
print '<td>'.$adherent->login.'</td>';
// Libelle
print '<td>';
print dol_trunc($obj->note,32);
print '</td>';
// Banque
if (! empty($conf->banque->enabled))
{
if ($obj->fk_account > 0)
{
$accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account);
//$accountstatic->label=$obj->label;
print '<td>'.$accountstatic->getNomUrl(1).'</td>';
}
else
{
print "<td>";
print "</td>\n";
}
}
// Date start
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";
// Date end
print '<td align="center">'.dol_print_date($db->jdate($obj->datef),'day')."</td>\n";
// Price
print '<td align="right">'.price($obj->subscription).'</td>';
print '<td></td>';
print "</tr>";
$i++;
}
// Total
print '<tr class="liste_total">';
print "<td>".$langs->trans("Total")."</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";
if (! empty($conf->banque->enabled))
{
print '<td>&nbsp;</td>';
}
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="right">'.price($total)."</td>\n";
print '<td></td>';
print "</tr>\n";
print "</table>";
print '</div>';
print '</form>';
} }
else // Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{ {
dol_print_error($db); print '<td class="liste_titre">';
print '</td>';
} }
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['d.ref']['checked']))
{
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.lastname']['checked']))
{
print_liste_field_titre("LastName",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.firstname']['checked']))
{
print_liste_field_titre("FirstName",$_SERVER["PHP_SELF"],"d.firstname",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.login']['checked']))
{
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['t.libelle']['checked']))
{
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
}
if (! empty($arrayfields['d.bank']['checked']))
{
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
}
if (! empty($arrayfields['d.date_debut']['checked']))
{
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
}
if (! empty($arrayfields['d.date_fin']['checked']))
{
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
}
if (! empty($arrayfields['d.amount']['checked']))
{
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['d.tms']['checked'])) print_liste_field_titre($arrayfields['d.tms']['label'],$_SERVER["PHP_SELF"],"d.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$total=0;
$totalarray=array();
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
$total+=$obj->subscription;
$subscription->ref=$obj->crowid;
$subscription->id=$obj->crowid;
$adherent->lastname=$obj->lastname;
$adherent->firstname=$obj->firstname;
$adherent->ref=$obj->rowid;
$adherent->id=$obj->rowid;
$adherent->statut=$obj->statut;
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
print '<tr class="oddeven">';
// Ref
if (! empty($arrayfields['d.ref']['checked']))
{
print '<td>'.$subscription->getNomUrl(1).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Lastname
if (! empty($arrayfields['d.lastname']['checked']))
{
$adherent->firstname = '';
print '<td>'.$adherent->getNomUrl(-1).'</td>';
$adherent->firstname = $obj->firstname;
if (! $i) $totalarray['nbfield']++;
}
// Firstname
if (! empty($arrayfields['d.firstname']['checked']))
{
print '<td>'.$adherent->firstname.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Login
if (! empty($arrayfields['d.login']['checked']))
{
print '<td>'.$adherent->login.'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Label
if (! empty($arrayfields['t.libelle']['checked']))
{
print '<td>';
print dol_trunc($obj->note,128);
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Banque
if (! empty($arrayfields['d.bank']['checked']))
{
print "<td>";
if ($obj->fk_account > 0)
{
$accountstatic->id=$obj->fk_account;
$accountstatic->fetch($obj->fk_account);
//$accountstatic->label=$obj->label;
print $accountstatic->getNomUrl(1);
}
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Date start
if (! empty($arrayfields['d.date_start']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh),'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Date end
if (! empty($arrayfields['d.date_end']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->datef),'day')."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Price
if (! empty($arrayfields['d.amount']['checked']))
{
print '<td align="right">'.price($obj->subscription).'</td>';
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['pos'][$totalarray['nbfield']]='d.amount';
$totalarray['val']['d.amount'] += $obj->subscription;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['d.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['d.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action column
print '<td align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
// Show total line
if (isset($totalarray['pos']))
{
print '<tr class="liste_total">';
$i=0;
while ($i < $totalarray['nbfield'])
{
$i++;
if (! empty($totalarray['pos'][$i])) print '<td align="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>';
else
{
if ($i == 1)
{
if ($num < $limit) print '<td align="left">'.$langs->trans("Total").'</td>';
else print '<td align="left">'.$langs->trans("Totalforthispage").'</td>';
}
else print '<td></td>';
}
}
print '</tr>';
}
// If no record found
if ($num == 0)
{
$colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
}
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>";
print '</div>';
print '</form>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@ -397,7 +397,7 @@ print '<br><br>';
*/ */
//if (! empty($conf->global->MAIN_FEATURES_LEVEL)) //if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{ //{
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', ''); print load_fiche_titre($langs->trans("Other"), '', '');
print "<table class=\"noborder\" width=\"100%\">\n"; print "<table class=\"noborder\" width=\"100%\">\n";

View File

@ -63,7 +63,7 @@ if ($action == 'setcoder')
$resql=$db->query($sqlp); $resql=$db->query($sqlp);
if (! $resql) dol_print_error($db); if (! $resql) dol_print_error($db);
} }
else if ($action == 'update') elseif ($action == 'update')
{ {
$location = GETPOST('GENBARCODE_LOCATION','alpha'); $location = GETPOST('GENBARCODE_LOCATION','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_LOCATION",$location,'chaine',0,'',$conf->entity);
@ -71,17 +71,8 @@ else if ($action == 'update')
$res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_DEFAULT_BARCODE_TYPE", $coder_id,'chaine',0,'',$conf->entity);
$coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha'); $coder_id = GETPOST('GENBARCODE_BARCODETYPE_THIRDPARTY','alpha');
$res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "GENBARCODE_BARCODETYPE_THIRDPARTY", $coder_id,'chaine',0,'',$conf->entity);
}
else if ($action == 'updateengine')
{
// TODO Update engines.
}
if ($action && $action != 'setcoder' && $action != 'setModuleOptions') if ($res > 0)
{
if (! $res > 0) $error++;
if (! $error)
{ {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} }
@ -90,6 +81,42 @@ if ($action && $action != 'setcoder' && $action != 'setModuleOptions')
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }
elseif ($action == 'updateengine')
{
$sql = "SELECT rowid, coder";
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha'))
{
$coder = GETPOST('coder'.$obj->rowid,'alpha');
$code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id;
$sqlp.= " AND entity = ".$conf->entity;
$upsql=$db->query($sqlp);
if (! $upsql) dol_print_error($db);
}
$i++;
}
}
}
/* /*
* View * View
@ -161,9 +188,12 @@ foreach($dirbarcode as $reldir)
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'',''); print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
//print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">"; if (empty($conf->use_javascript_ajax))
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; {
//print "<input type=\"hidden\" name=\"action\" value=\"updateengine\">"; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="form_engine">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="updateengine">';
}
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -258,10 +288,9 @@ print "</table>\n";
if (empty($conf->use_javascript_ajax)) if (empty($conf->use_javascript_ajax))
{ {
// TODO Implement code behind action updateengine print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>';
//print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'"></div>'; print '</form>';
} }
//print '</form>';
print "<br>"; print "<br>";

View File

@ -250,7 +250,7 @@ print '<tr class="liste_titre">';
// Page // Page
$texthelp=$langs->trans("PageUrlForDefaultValues"); $texthelp=$langs->trans("PageUrlForDefaultValues");
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2'); if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2'); else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/list.php?abc=val1&def=val2');
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp); $texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder); print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
// Field // Field
@ -288,8 +288,9 @@ if ($mode != 'focus' && $mode != 'mandatory')
} }
// Entity // Entity
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder); if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
else print_liste_field_titre("",$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
// Actions // Actions
print '<td align="center"></td>'; print_liste_field_titre("",$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";

View File

@ -141,9 +141,11 @@ if (GETPOST('addoperation','alpha'))
{ {
$emailcollectoroperation = new EmailCollectorAction($db); $emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->type = GETPOST('operationtype','az09'); $emailcollectoroperation->type = GETPOST('operationtype','az09');
$emailcollectoroperation->actionparam = GETPOST('actionparam', 'alpha'); $emailcollectoroperation->actionparam = GETPOST('operationparam', 'none');
$emailcollectoroperation->fk_emailcollector = $object->id; $emailcollectoroperation->fk_emailcollector = $object->id;
$emailcollectoroperation->status = 1; $emailcollectoroperation->status = 1;
$emailcollectoroperation->position = 50;
$result = $emailcollectoroperation->create($user); $result = $emailcollectoroperation->create($user);
if ($result > 0) if ($result > 0)
@ -378,11 +380,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$sourcedir = $object->source_directory; $sourcedir = $object->source_directory;
$targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag'
$connectstringserver = $object->getConnectStringIMAP(); $connection = null;
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir); $connectstringserver = '';
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir); $connectstringsource = '';
$connectstringtarget = '';
if (function_exists('imap_open'))
{
$connectstringserver = $object->getConnectStringIMAP();
$connectstringsource = $connectstringserver.imap_utf7_encode($sourcedir);
$connectstringtarget = $connectstringserver.imap_utf7_encode($targetdir);
$connection = imap_open($connectstringsource, $object->user, $object->password); $connection = imap_open($connectstringsource, $object->user, $object->password);
}
else
{
$morehtml .= 'IMAP functions not available on your PHP';
}
if (! $connection) if (! $connection)
{ {
$morehtml .= 'Failed to open IMAP connection '.$connectstringsource; $morehtml .= 'Failed to open IMAP connection '.$connectstringsource;
@ -393,8 +408,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$morehtml .= imap_num_msg($connection); $morehtml .= imap_num_msg($connection);
} }
imap_close($connection); if ($connection)
{
imap_close($connection);
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, ''); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref.'<div class="refidno">'.$morehtml.'</div>', '', 0, '', '', 0, '');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
@ -457,9 +475,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div><br>';
// Operations // Operations
print '<table class="border centpercent">'; print '<table id="tablelines" class="noborder noshadow">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td>'; print '<td>'.$langs->trans("EmailcollectorOperations").'</td><td></td><td></td><td></td>';
print '</tr>'; print '</tr>';
// Add operation // Add operation
print '<tr class="oddeven">'; print '<tr class="oddeven">';
@ -470,15 +488,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</td><td>'; print '</td><td>';
print '<input type="text" name="operationparam">'; print '<input type="text" name="operationparam">';
print '</td>'; print '</td>';
print '<td></td>';
print '<td align="right"><input type="submit" name="addoperation" id="addoperation" class="flat button" value="'.$langs->trans("Add").'"></td>'; print '<td align="right"><input type="submit" name="addoperation" id="addoperation" class="flat button" value="'.$langs->trans("Add").'"></td>';
print '</tr>'; print '</tr>';
// List operations // List operations
$nboflines = count($object->actions);
$table_element_line = 'emailcollector_emailcollectoraction';
$fk_element='position';
$i=0;
foreach($object->actions as $ruleaction) foreach($object->actions as $ruleaction)
{ {
$ruleactionobj=new EmailcollectorAction($db); $ruleactionobj=new EmailcollectorAction($db);
$ruleactionobj->fetch($ruleaction['id']); $ruleactionobj->fetch($ruleaction['id']);
print '<tr class="oddeven">'; print '<tr class="drag drop oddeven" id="row-'.$ruleaction['id'].'">';
print '<td>'; print '<td>';
print $langs->trans($arrayoftypes[$ruleaction['type']]); print $langs->trans($arrayoftypes[$ruleaction['type']]);
print '</td>'; print '</td>';
@ -487,12 +510,26 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
//print $ruleactionobj->getLibStatut(3); //print $ruleactionobj->getLibStatut(3);
print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>'; print ' <a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=deleteoperation&operationid='.$ruleaction['id'].'">'.img_delete().'</a>';
print '</td>'; print '</td>';
print '<td class="center linecolmove tdlineupdown">';
if ($i > 0)
{
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=up&amp;rowid='.$ruleaction['id'].'">'.img_up('default', 0, 'imgupforline').'</a>';
}
if ($i < count($object->actions)-1) {
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$ruleaction['id'].'">'.img_down('default', 0, 'imgdownforline').'</a>';
}
print '</td>';
print '</tr>'; print '</tr>';
$i++;
} }
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
if (! empty($conf->use_javascript_ajax)) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
print '</form>'; print '</form>';
print '</div>'; print '</div>';

View File

@ -74,7 +74,7 @@ llxHeader('',$langs->trans("Audit"),$wikihelp);
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>'; //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup'); print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
print $langs->trans("LogEventDesc")."<br>\n"; print $langs->trans("LogEventDesc", $langs->transnoentitiesnoconv("AdminTools"), $langs->transnoentitiesnoconv("Audit"))."<br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -24,6 +24,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolgeoip.class.php';
// Security check // Security check
@ -150,6 +151,25 @@ if ($geoip)
if ($result) print $result; if ($result) print $result;
else print $langs->trans("Error"); else print $langs->trans("Error");
*/ */
//var_dump($_SERVER);
$ip = getUserRemoteIP();
//$ip='91.161.249.43';
$isip=is_ip($ip);
if ($isip == 1)
{
print '<br>'.$ip.' -> ';
$result=dol_print_ip($ip,1);
if ($result) print $result;
else print $langs->trans("Error");
}
else
{
print '<br>'.$ip.' -> ';
$result=dol_print_ip($ip,1);
if ($result) print $result;
else print $langs->trans("NotAPublicIp");
}
$geoip->close(); $geoip->close();
} }

View File

@ -11,6 +11,7 @@
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -421,7 +422,7 @@ if ($action == 'delete')
//var_dump($elementList); //var_dump($elementList);
$sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, active"; $sql="SELECT rowid as rowid, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates"; $sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates";
$sql.=" WHERE entity IN (".getEntity('email_template').")"; $sql.=" WHERE entity IN (".getEntity('email_template').")";
if (! $user->admin) if (! $user->admin)
@ -447,8 +448,6 @@ $sql.=$db->plimit($listlimit+1,$offset);
$fieldlist=explode(',',$tabfield[$id]); $fieldlist=explode(',',$tabfield[$id]);
// Form to add a new line // Form to add a new line
$alabelisused=0;
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
@ -460,38 +459,37 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
// Determine le nom du champ par rapport aux noms possibles // Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees // dans les dictionnaires de donnees
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate $valuetoshow=$langs->trans($valuetoshow); // try to translate
$align="left"; $align="left";
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");} if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner");}
if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? '&nbsp;' : $langs->trans("Language")); } if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? '&nbsp;' : $langs->trans("Language")); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); } if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); } if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='private') { $align='center'; } if ($fieldlist[$field]=='private') { $align='center'; }
if ($fieldlist[$field]=='position') { $align='center'; } if ($fieldlist[$field]=='position') { $align='center'; }
if ($fieldlist[$field]=='topic') { $valuetoshow=''; } if ($fieldlist[$field]=='topic') { $valuetoshow=''; }
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; } if ($fieldlist[$field]=='joinfiles') { $valuetoshow=''; }
if ($fieldlist[$field]=='content') { $valuetoshow=''; } if ($fieldlist[$field]=='content') { $valuetoshow=''; }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; } if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
if ($valuetoshow != '') if ($valuetoshow != '')
{ {
print '<td align="'.$align.'">'; print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>'; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
else if (! empty($tabhelp[$id][$value])) else if (! empty($tabhelp[$id][$value]))
{ {
if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover
} }
else print $valuetoshow; else print $valuetoshow;
print '</td>'; print '</td>';
} }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
} }
print '<td>'; print '<td>';
print '<input type="hidden" name="id" value="' . $id . '">'; print '<input type="hidden" name="id" value="' . $id . '">';
@ -534,6 +532,7 @@ print '<td align="right">';
print '</td>'; print '</td>';
print "</tr>"; print "</tr>";
// Show fields for topic, join files and body
$fieldsforcontent = array('topic', 'joinfiles', 'content'); $fieldsforcontent = array('topic', 'joinfiles', 'content');
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); } if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { $fieldsforcontent = array('content','content_lines'); }
foreach ($fieldsforcontent as $tmpfieldlist) foreach ($fieldsforcontent as $tmpfieldlist)
@ -630,11 +629,11 @@ if ($resql)
$filterfound=0; $filterfound=0;
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" value="'.dol_escape_htmltag($search_label).'"></td>'; if ($value == 'label') print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth100" value="'.dol_escape_htmltag($search_label).'"></td>';
elseif ($value == 'lang') elseif ($value == 'lang')
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth100');
print '</td>'; print '</td>';
} }
elseif ($value == 'fk_user') elseif ($value == 'fk_user')
@ -643,13 +642,13 @@ if ($resql)
$restrictid=array(); $restrictid=array();
if (! $user->admin) $restrictid=array($user->id); if (! $user->admin) $restrictid=array($user->id);
//var_dump($restrictid); //var_dump($restrictid);
print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth200'); print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, 'hierarchyme', null, 0, 0, 1, '', 0, '', 'maxwidth100');
print '</td>'; print '</td>';
} }
elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>'; elseif ($value == 'topic') print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
elseif ($value == 'type_template') elseif ($value == 'type_template')
{ {
print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200 maxwidth100onsmartphone').'</td>'; print '<td class="liste_titre">'.$form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100 maxwidth100onsmartphone').'</td>';
} }
elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>'; elseif (! in_array($value, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
} }
@ -671,6 +670,7 @@ if ($resql)
$align="left"; $align="left";
$sortable=1; $sortable=1;
$valuetoshow=''; $valuetoshow='';
$forcenowrap=1;
/* /*
$tmparray=getLabelOfField($fieldlist[$field]); $tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield']; $showfield=$tmp['showfield'];
@ -688,7 +688,7 @@ if ($resql)
if ($fieldlist[$field]=='private') { $align='center'; } if ($fieldlist[$field]=='private') { $align='center'; }
if ($fieldlist[$field]=='position') { $align='center'; } if ($fieldlist[$field]=='position') { $align='center'; }
if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; } if ($fieldlist[$field]=='joinfiles') { $valuetoshow=$langs->trans("FilesAttachedToEmail"); $align='center'; $forcenowrap=0; }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;} if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; } if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
@ -697,8 +697,8 @@ if ($resql)
{ {
if (! empty($tabhelp[$id][$value])) if (! empty($tabhelp[$id][$value]))
{ {
if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value); // Tooltip on click if (in_array($value, array('topic'))) $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', 1); // Tooltip on hover else $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
} }
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder); print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
} }
@ -787,8 +787,12 @@ if ($resql)
$i++; $i++;
continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled) continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
} }
// TODO Test on 'enabled' // Test on 'enabled'
if (! dol_eval($obj->enabled, 1))
{
$i++;
continue; // Email template not qualified
}
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
@ -991,7 +995,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print '<td>'; print '<td>';
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
{ {
$selectedlang = GETPOSTISSET('langcode','aZ09')?GETPOST('langcode','aZ09'):$langs->defaultlang; $selectedlang = GETPOSTISSET('langcode')?GETPOST('langcode', 'aZ09'):$langs->defaultlang;
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
} }
@ -1019,17 +1023,18 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
} }
else else
{ {
print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth200'); print $form->selectarray('type_template', $elementList, (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone');
} }
print '</td>'; print '</td>';
} }
elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue;
else else
{ {
$size=''; $class=''; $classtd=''; $size=''; $class=''; $classtd='';
if ($fieldlist[$field]=='code') $class='maxwidth100'; if ($fieldlist[$field]=='code') $class='maxwidth100';
if ($fieldlist[$field]=='label') $class='maxwidth100';
if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; } if ($fieldlist[$field]=='private') { $class='maxwidth50'; $classtd='center'; }
if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; } if ($fieldlist[$field]=='position') { $class='maxwidth50'; $classtd='center'; }
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent'; if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';

View File

@ -96,6 +96,7 @@ if ($action == 'update')
$menu->perms=GETPOST('perms','alpha'); $menu->perms=GETPOST('perms','alpha');
$menu->target=GETPOST('target','alpha'); $menu->target=GETPOST('target','alpha');
$menu->user=GETPOST('user','alpha'); $menu->user=GETPOST('user','alpha');
$menu->mainmenu=GETPOST('propertymainmenu','alpha');
if (is_numeric(GETPOST('menuIdParent','alpha'))) if (is_numeric(GETPOST('menuIdParent','alpha')))
{ {
$menu->fk_menu=GETPOST('menuIdParent','alpha'); $menu->fk_menu=GETPOST('menuIdParent','alpha');
@ -123,14 +124,11 @@ if ($action == 'update')
setEventMessages($menu->error, $menu->errors, 'errors'); setEventMessages($menu->error, $menu->errors, 'errors');
} }
$action = "edit"; $action = "edit";
}
else
{
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit; exit;
} }
else
if ($_GET['return'])
{ {
header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler);
exit; exit;
@ -215,6 +213,7 @@ if ($action == 'add')
$menu->perms=GETPOST('perms','alpha'); $menu->perms=GETPOST('perms','alpha');
$menu->target=GETPOST('target','alpha'); $menu->target=GETPOST('target','alpha');
$menu->user=GETPOST('user','alpha'); $menu->user=GETPOST('user','alpha');
$menu->mainmenu=GETPOST('propertymainmenu','alpha');
if (is_numeric(GETPOST('menuId','int'))) if (is_numeric(GETPOST('menuId','int')))
{ {
$menu->fk_menu=GETPOST('menuId','int'); $menu->fk_menu=GETPOST('menuId','int');
@ -289,10 +288,13 @@ if ($action == 'create')
{ {
jQuery("#menuId").prop("disabled", true); jQuery("#menuId").prop("disabled", true);
jQuery("#menuId").val(\'\'); jQuery("#menuId").val(\'\');
jQuery("#propertymainmenu").removeAttr("disabled");
jQuery("#propertymainmenu").val(\'\');
} }
else if (jQuery("#topleft").val() == \'left\')
{ {
jQuery("#menuId").removeAttr("disabled"); jQuery("#menuId").removeAttr("disabled");
jQuery("#propertymainmenu").prop("disabled", true);
} }
} }
init_topleft(); init_topleft();
@ -338,7 +340,7 @@ if ($action == 'create')
print '</td>'; print '</td>';
print '<td>'.$langs->trans('DetailMenuHandler').'</td></tr>'; print '<td>'.$langs->trans('DetailMenuHandler').'</td></tr>';
//User // User
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td>'; print '<tr><td class="nowrap fieldrequired">'.$langs->trans('MenuForUsers').'</td>';
print '<td><select class="flat" name="user">'; print '<td><select class="flat" name="user">';
print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>'; print '<option value="2" selected>'.$langs->trans("AllMenus").'</option>';
@ -362,9 +364,15 @@ if ($action == 'create')
print '<option value="left"'.($_POST["type"] && $_POST["type"]=='left'?' selected':'').'>'.$langs->trans('Left').'</option>'; print '<option value="left"'.($_POST["type"] && $_POST["type"]=='left'?' selected':'').'>'.$langs->trans('Left').'</option>';
print '</select>'; print '</select>';
} }
// print '<input type="text" size="50" name="type" value="'.$type.'">';
print '</td><td>'.$langs->trans('DetailType').'</td></tr>'; print '</td><td>'.$langs->trans('DetailType').'</td></tr>';
// Mainmenu code
print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alpha')?GETPOST("propertymainmenu", 'alpha'):'').'"></td>';
print '<td>';
print $langs->trans("Example").': mytopmenukey';
print '</td></tr>';
// MenuId Parent // MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>'; print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
if ($parent_rowid) if ($parent_rowid)
@ -373,23 +381,23 @@ if ($action == 'create')
} }
else else
{ {
print '<td><input type="text" size="48" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>'; print '<td><input type="text" class="minwidth300" id="menuId" name="menuId" value="'.(GETPOST("menuId", 'int')?GETPOST("menuId", 'int'):'').'"></td>';
} }
print '<td>'.$langs->trans('DetailMenuIdParent'); print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>'; print '</td></tr>';
// Title // Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre",'alpha')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// URL // URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" size="60" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="minwidth500" name="url" value="'.GETPOST("url",'alpha').'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs // Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>'; print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" class="minwidth300" name="langs" value="'.$parent_langs.'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position // Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>'; print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" class="width100" name="position" value="'.dol_escape_htmltag(isset($_POST["position"])?$_POST["position"]:100).'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Target // Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">'; print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
@ -398,10 +406,10 @@ if ($action == 'create')
print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>'; print '</select></td></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled // Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.GETPOST("enabled",'alpha').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>'; print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" class="minwidth500" name="enabled" value="'.(GETPOSTISSET('enabled')?GETPOST("enabled",'alpha'):'1').'"></td><td>'.$langs->trans('DetailEnabled').'</td></tr>';
// Perms // Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.GETPOST('perms','alpha').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>'; print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" class="minwidth500" name="perms" value="'.(GETPOSTISSET('perms')?GETPOST('perms','alpha'):'1').'"></td><td>'.$langs->trans('DetailRight').'</td></tr>';
print '</table>'; print '</table>';
@ -455,13 +463,30 @@ elseif ($action == 'edit')
// Type // Type
print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Type').'</td><td>'.$langs->trans(ucfirst($menu->type)).'</td><td>'.$langs->trans('DetailType').'</td></tr>';
// Mainmenu code
if ($menu->type == 'top')
{
print '<tr><td class="fieldrequired">'.$langs->trans('MainMenuCode').'</td>';
/*if ($parent_rowid)
{
print '<td>'.$parent_rowid.'<input type="hidden" name="propertyleftmenu" value="'.$parent_rowid.'"></td>';
}
else
{*/
print '<td><input type="text" class="minwidth300" id="propertymainmenu" name="propertymainmenu" value="'.(GETPOST("propertymainmenu", 'alpha')?GETPOST("propertymainmenu", 'alpha'):$menu->mainmenu).'"></td>';
//}
print '<td>';
print $langs->trans("Example").': mytopmenukey';
print '</td></tr>';
}
// MenuId Parent // MenuId Parent
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent'); print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent');
print '</td>'; print '</td>';
$valtouse=$menu->fk_menu; $valtouse=$menu->fk_menu;
if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu; if ($menu->fk_mainmenu) $valtouse='fk_mainmenu='.$menu->fk_mainmenu;
if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu; if ($menu->fk_leftmenu) $valtouse.='&fk_leftmenu='.$menu->fk_leftmenu;
print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" size="48"></td>'; print '<td><input type="text" name="menuIdParent" value="'.$valtouse.'" class="minwidth300"></td>';
print '<td>'.$langs->trans('DetailMenuIdParent'); print '<td>'.$langs->trans('DetailMenuIdParent');
print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def'; print ', '.$langs->trans("Example").': fk_mainmenu=abc&fk_leftmenu=def';
print '</td></tr>'; print '</td></tr>';
@ -470,16 +495,16 @@ elseif ($action == 'edit')
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>'; //print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
// Title // Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" size="30" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Url // Url
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Langs // Langs
print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" size="30" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>'; print '<tr><td>'.$langs->trans('LangFile').'</td><td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($menu->langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';
// Position // Position
print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" size="5" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>'; print '<tr><td>'.$langs->trans('Position').'</td><td><input type="text" class="minwidth100" name="position" value="'.$menu->position.'"></td><td>'.$langs->trans('DetailPosition').'</td></tr>';
// Target // Target
print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">'; print '<tr><td>'.$langs->trans('Target').'</td><td><select class="flat" name="target">';
@ -488,12 +513,12 @@ elseif ($action == 'edit')
print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>'; print '</select></td><td>'.$langs->trans('DetailTarget').'</td></tr>';
// Enabled // Enabled
print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" size="60" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled'); print '<tr><td>'.$langs->trans('Enabled').'</td><td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
if (! empty($menu->enabled)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->enabled,1)).')'; if (! empty($menu->enabled)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->enabled,1)).')';
print '</td></tr>'; print '</td></tr>';
// Perms // Perms
print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" size="60" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight'); print '<tr><td>'.$langs->trans('Rights').'</td><td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
if (! empty($menu->perms)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->perms,1)).')'; if (! empty($menu->perms)) print ' ('.$langs->trans("ConditionIsCurrently").': '.yn(dol_eval($menu->perms,1)).')';
print '</td></tr>'; print '</td></tr>';

View File

@ -701,7 +701,10 @@ if ($mode == 'common')
else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1))) else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1)))
{ {
if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used");
else print $langs->trans("Required"); else {
print img_picto($langs->trans("Required"),'switch_on');
print $langs->trans("Required");
}
if (! empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; if (! empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
} }
else else

View File

@ -129,4 +129,4 @@ print '</form>';
// End of page // End of page
llxFooter(); llxFooter();
$db->close();; $db->close();

View File

@ -89,7 +89,7 @@ dol_fiche_head($head, 'setup', '', 0, 'user');
print '<br>'; print '<br>';
$arrayofsocialnetworks=array('skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); $arrayofsocialnetworks=array('jabber'=>'Jabber', 'skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook');
foreach($arrayofsocialnetworks as $snkey => $snlabel) foreach($arrayofsocialnetworks as $snkey => $snlabel)
{ {

View File

@ -517,7 +517,6 @@ print '<br>';
<input type="hidden" name="export_type" value="server" /> <input type="hidden" name="export_type" value="server" />
<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend> <fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
<div class="fichehalfleft">
<?php <?php
print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>'; print $langs->trans("BackupDesc2",DOL_DATA_ROOT).'<br>';
@ -525,6 +524,13 @@ print $langs->trans("BackupDescX").'<br><br>';
?> ?>
<div id="backupfilesleft" class="fichehalfleft">
<?php
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
?>
<label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br> <label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
<input type="text" name="zipfilename_template" style="width: 90%" <input type="text" name="zipfilename_template" style="width: 90%"
id="zipfilename_template" id="zipfilename_template"
@ -537,6 +543,7 @@ echo $file;
?>" /> <br> ?>" /> <br>
<br> <br>
<?php <?php
// Show compression choices // Show compression choices
print '<div class="formelementrow">'; print '<div class="formelementrow">';

View File

@ -304,7 +304,7 @@ if (GETPOST('withtab','alpha'))
dol_fiche_head($head, 'fingerprints', '', -1); dol_fiche_head($head, 'fingerprints', '', -1);
} }
print '<span class="opacitymedium">'.$langs->trans("FingerprintsDesc")."</span><br>\n"; print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("FingerprintsDesc")."<br></span>\n";
print '<br>'; print '<br>';
@ -342,7 +342,7 @@ for ($month = 1 ; $month <= 12 ; $month++)
} }
$retstring.="</select>"; $retstring.="</select>";
print $retstring; print $retstring;
print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth75" value="'.GETPOST('yeartoexport','int').'">'; print '<input type="text" name="yeartoexport" class="valignmiddle maxwidth50imp" value="'.GETPOST('yeartoexport','int').'">';
print '<input type="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">'; print '<input type="hidden" name="withtab" value="'.GETPOST('withtab','alpha').'">';
print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">'; print '<input type="submit" name="downloadcsv" class="button" value="'.$langs->trans('DownloadLogCSV').'">';
if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadBlockChain').'</a>'; if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) print ' | <a href="?action=downloadblockchain'.(GETPOST('withtab','alpha')?'&withtab='.GETPOST('withtab','alpha'):'').'">'.$langs->trans('DownloadBlockChain').'</a>';

View File

@ -413,7 +413,7 @@ class BlockedLog
{ {
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array( if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines' 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
))) continue; // Discard if not into a dedicated list ))) continue; // Discard if not into a dedicated list
if ($key == 'lines') if ($key == 'lines')
{ {
@ -444,7 +444,7 @@ class BlockedLog
{ {
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array( if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public' 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list ))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->{$key} = $value; if (!is_object($value)) $this->object_data->{$key} = $value;
} }
@ -557,7 +557,7 @@ class BlockedLog
{ {
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array( if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public' 'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list ))) continue; // Discard if not into a dedicated list
if (!is_object($value)) if (!is_object($value))
{ {

View File

@ -38,6 +38,7 @@ function blockedlogadmin_prepare_head()
$head[$h][2] = 'blockedlog'; $head[$h][2] = 'blockedlog';
$h++; $h++;
$langs->load("blockedlog");
$head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/blockedlog_list.php?withtab=1"; $head[$h][0] = DOL_URL_ROOT."/blockedlog/admin/blockedlog_list.php?withtab=1";
$head[$h][1] = $langs->trans("BrowseBlockedLog"); $head[$h][1] = $langs->trans("BrowseBlockedLog");

View File

@ -65,7 +65,7 @@ class Categorie extends CommonObject
* *
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated * @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
*/ */
private $MAP_ID = array( protected $MAP_ID = array(
'product' => 0, 'product' => 0,
'supplier' => 1, 'supplier' => 1,
'customer' => 2, 'customer' => 2,
@ -97,7 +97,7 @@ class Categorie extends CommonObject
* *
* @note Move to const array when PHP 5.6 will be our minimum target * @note Move to const array when PHP 5.6 will be our minimum target
*/ */
private $MAP_CAT_FK = array( protected $MAP_CAT_FK = array(
'product' => 'product', 'product' => 'product',
'customer' => 'soc', 'customer' => 'soc',
'supplier' => 'soc', 'supplier' => 'soc',
@ -114,7 +114,7 @@ class Categorie extends CommonObject
* *
* @note Move to const array when PHP 5.6 will be our minimum target * @note Move to const array when PHP 5.6 will be our minimum target
*/ */
private $MAP_CAT_TABLE = array( protected $MAP_CAT_TABLE = array(
'product' => 'product', 'product' => 'product',
'customer' => 'societe', 'customer' => 'societe',
'supplier' => 'fournisseur', 'supplier' => 'fournisseur',
@ -131,7 +131,7 @@ class Categorie extends CommonObject
* *
* @note Move to const array when PHP 5.6 will be our minimum target * @note Move to const array when PHP 5.6 will be our minimum target
*/ */
private $MAP_OBJ_CLASS = array( protected $MAP_OBJ_CLASS = array(
'product' => 'Product', 'product' => 'Product',
'customer' => 'Societe', 'customer' => 'Societe',
'supplier' => 'Fournisseur', 'supplier' => 'Fournisseur',
@ -148,7 +148,7 @@ class Categorie extends CommonObject
* *
* @note Move to const array when PHP 5.6 will be our minimum target * @note Move to const array when PHP 5.6 will be our minimum target
*/ */
private $MAP_OBJ_TABLE = array( protected $MAP_OBJ_TABLE = array(
'product' => 'product', 'product' => 'product',
'customer' => 'societe', 'customer' => 'societe',
'supplier' => 'societe', 'supplier' => 'societe',
@ -944,7 +944,7 @@ class Categorie extends CommonObject
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
private function load_motherof() protected function load_motherof()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1536,7 +1536,7 @@ class Categorie extends CommonObject
if (colorIsLight($this->color)) $forced_color='categtextblack'; if (colorIsLight($this->color)) $forced_color='categtextblack';
} }
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">'; $link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.'&backtopage='.urlencode($_SERVER['PHP_SELF']).'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color .'">';
$linkend='</a>'; $linkend='</a>';
$picto='category'; $picto='category';

View File

@ -69,7 +69,23 @@ if ($id > 0)
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
if ($object->id) { if ($object->id) {
$object->add_photo($upload_dir, $_FILES['userfile']);
$file = $_FILES['userfile'];
if (is_array($file['name']) && count($file['name']) > 0)
{
foreach ($file['name'] as $i => $name)
{
if(empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]) )
{
setEventMessage($file['name'][$i] .' : '. $langs->trans(empty($file['tmp_name'][$i])? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles' ) );
unset($file['name'][$i],$file['type'][$i],$file['tmp_name'][$i],$file['error'][$i],$file['size'][$i]);
}
}
}
if(!empty($file['tmp_name'])) {
$object->add_photo($upload_dir, $file);
}
} }
} }

View File

@ -1302,7 +1302,6 @@ if ($id > 0)
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td>'; print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td>';
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">'; print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
print '</td></tr>'; print '</td></tr>';
// Object linked // Object linked
if (! empty($object->fk_element) && ! empty($object->elementtype)) if (! empty($object->fk_element) && ! empty($object->elementtype))
{ {
@ -1610,8 +1609,9 @@ if ($id > 0)
print ($object->priority?$object->priority:''); print ($object->priority?$object->priority:'');
print '</td></tr>'; print '</td></tr>';
// Object linked // Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
if (! empty($object->fk_element) && ! empty($object->elementtype)) // for such objects because there is already a dedicated field into table llx_actioncomm.
if (! empty($object->fk_element) && ! empty($object->elementtype) && ! in_array($object->elementtype, array('societe','contact','project')))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr><td>'.$langs->trans("LinkedObject").'</td>'; print '<tr><td>'.$langs->trans("LinkedObject").'</td>';

View File

@ -334,7 +334,16 @@ class ActionComm extends CommonObject
$sql.= "fk_element,"; $sql.= "fk_element,";
$sql.= "elementtype,"; $sql.= "elementtype,";
$sql.= "entity,"; $sql.= "entity,";
$sql.= "extraparams"; $sql.= "extraparams,";
// Fields emails
$sql.= "email_msgid,";
$sql.= "email_from,";
$sql.= "email_sender,";
$sql.= "email_to,";
$sql.= "email_tocc,";
$sql.= "email_tobcc,";
$sql.= "email_subject,";
$sql.= "errors_to";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."', "; $sql.= "'".$this->db->idate($now)."', ";
$sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").", "; $sql.= (strval($this->datep)!=''?"'".$this->db->idate($this->datep)."'":"null").", ";
@ -354,7 +363,16 @@ class ActionComm extends CommonObject
$sql.= (! empty($this->fk_element)?$this->fk_element:"null").", "; $sql.= (! empty($this->fk_element)?$this->fk_element:"null").", ";
$sql.= (! empty($this->elementtype)?"'".$this->db->escape($this->elementtype)."'":"null").", "; $sql.= (! empty($this->elementtype)?"'".$this->db->escape($this->elementtype)."'":"null").", ";
$sql.= $conf->entity.","; $sql.= $conf->entity.",";
$sql.= (! empty($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null"); $sql.= (! empty($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null").", ";
// Fields emails
$sql.= (! empty($this->email_msgid)?"'".$this->db->escape($this->email_msgid)."'":"null").", ";
$sql.= (! empty($this->email_from)?"'".$this->db->escape($this->email_from)."'":"null").", ";
$sql.= (! empty($this->email_sender)?"'".$this->db->escape($this->email_sender)."'":"null").", ";
$sql.= (! empty($this->email_to)?"'".$this->db->escape($this->email_to)."'":"null").", ";
$sql.= (! empty($this->email_tocc)?"'".$this->db->escape($this->email_tocc)."'":"null").", ";
$sql.= (! empty($this->email_tobcc)?"'".$this->db->escape($this->email_tobcc)."'":"null").", ";
$sql.= (! empty($this->email_subject)?"'".$this->db->escape($this->email_subject)."'":"null").", ";
$sql.= (! empty($this->errors_to)?"'".$this->db->escape($this->errors_to)."'":"null");
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::add", LOG_DEBUG); dol_syslog(get_class($this)."::add", LOG_DEBUG);
@ -1274,7 +1292,8 @@ class ActionComm extends CommonObject
$tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype; $tooltip .= '<br><b>' . $langs->trans('Type') . ':</b> ' . $labeltype;
if (! empty($this->location)) if (! empty($this->location))
$tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location; $tooltip .= '<br><b>' . $langs->trans('Location') . ':</b> ' . $this->location;
if (! empty($this->note))
$tooltip .= '<br><b>' . $langs->trans('Note') . ':</b> ' . $this->note;
$linkclose=''; $linkclose='';
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color)
$linkclose = ' style="background-color:#'.$this->type_color.'"'; $linkclose = ' style="background-color:#'.$this->type_color.'"';
@ -1315,10 +1334,10 @@ class ActionComm extends CommonObject
$linkstart.=$linkclose.'>'; $linkstart.=$linkclose.'>';
$linkend='</a>'; $linkend='</a>';
if ($option == 'nolink') { if ($option == 'nolink') {
$linkstart = ''; $linkstart = '';
$linkend = ''; $linkend = '';
} }
//print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto; //print 'rrr'.$this->libelle.'rrr'.$this->label.'rrr'.$withpicto;
if ($withpicto == 2) if ($withpicto == 2)
@ -1691,7 +1710,7 @@ class ActionComm extends CommonObject
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda")); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
return 0; return 0;
} }
$now = dol_now(); $now = dol_now();
dol_syslog(__METHOD__, LOG_DEBUG); dol_syslog(__METHOD__, LOG_DEBUG);

View File

@ -7,6 +7,7 @@
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2017 Open-DSI <support@open-dsi.fr> * Copyright (C) 2017 Open-DSI <support@open-dsi.fr>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -44,9 +45,9 @@ if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MA
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5; if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB; $MAXAGENDA=$conf->global->AGENDA_EXT_NB;
$filter = GETPOST("filter",'alpha',3); $filter = GETPOST("search_filter",'alpha',3)?GETPOST("search_filter",'alpha',3):GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3); $filtert = GETPOST("search_filtert","int",3)?GETPOST("search_filtert","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("search_usergroup","int",3)?GETPOST("search_usergroup","int",3):GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
// If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. // If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user.
@ -65,7 +66,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec"; if (! $sortfield) $sortfield="a.datec";
// Security check // Security check
$socid = GETPOST("socid","int"); $socid = GETPOST("search_socid","int")?GETPOST("search_socid","int"):GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid=''; if ($socid < 0) $socid='';
@ -79,32 +80,32 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
} }
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); $day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3); $pid=GETPOST("search_projectid","int",3)?GETPOST("search_projectid","int",3):GETPOST("projectid","int",3);
$status=GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo' $status=GETPOST("search_status",'aZ09')?GETPOST("search_status",'aZ09'):GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo'
$type=GETPOST("type",'az09'); $type=GETPOST("search_type",'az09')?GETPOST("search_type",'az09'):GETPOST("type",'az09');
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array')) if (GETPOST('search_actioncode','array'))
{ {
$actioncode=GETPOST('actioncode','array',3); $actioncode=GETPOST('search_actioncode','array',3);
if (! count($actioncode)) $actioncode='0'; if (! count($actioncode)) $actioncode='0';
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("search_actioncode","alpha",3)?GETPOST("search_actioncode","alpha",3):(GETPOST("search_actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($status == '' && ! GETPOSTISSET('search_status')) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); $defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW);
$defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW); $defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=$defaultview; if (empty($action) && ! GETPOSTISSET('action')) $action=$defaultview;
if ($action == 'default') // When action is default, we want a calendar view and not the list if ($action == 'default') // When action is default, we want a calendar view and not the list
{ {
$action = (($defaultview != 'show_list') ? $defaultview : 'show_month'); $action = (($defaultview != 'show_list') ? $defaultview : 'show_month');
@ -301,21 +302,22 @@ if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions");
$param=''; $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".$str_action; foreach($actioncode as $str_action) $param.="&search_actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".$actioncode; } else $param.="&search_actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".$resourceid; if ($resourceid > 0) $param.="&search_resourceid=".urlencode($resourceid);
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&search_status=".urlencode($status);
if ($filter) $param.="&filter=".$filter; if ($filter) $param.="&search_filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".$filtert; if ($filtert) $param.="&search_filtert=".urlencode($filtert);
if ($socid) $param.="&socid=".$socid; if ($usergroup) $param.="&search_usergroup=".urlencode($usergroup);
if ($showbirthday) $param.="&showbirthday=1"; if ($socid) $param.="&search_socid=".urlencode($socid);
if ($pid) $param.="&projectid=".$pid; if ($showbirthday) $param.="&search_showbirthday=1";
if ($type) $param.="&type=".$type; if ($pid) $param.="&search_projectid=".urlencode($pid);
if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') $param.='&action='.$action; if ($type) $param.="&search_type=".urlencode($type);
$param.="&maxprint=".$maxprint; if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month') $param.='&action='.urlencode($action);
$param.="&maxprint=".urlencode($maxprint);
// Show navigation bar // Show navigation bar
if (empty($action) || $action=='show_month') if (empty($action) || $action=='show_month')
@ -1278,7 +1280,7 @@ $db->close();
function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0) function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0)
{ {
global $user, $conf, $langs; global $user, $conf, $langs;
global $action, $filter, $filtert, $status, $actioncode; // Filters used into search form global $action, $filter, $filtert, $status, $actioncode, $usergroup; // Filters used into search form
global $theme_datacolor; global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
@ -1637,6 +1639,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year; print '<a href="'.DOL_URL_ROOT.'/comm/action/index.php?action='.$action.'&maxprint=0&month='.$monthshown.'&year='.$year;
print ($status?'&status='.$status:'').($filter?'&filter='.$filter:''); print ($status?'&status='.$status:'').($filter?'&filter='.$filter:'');
print ($filtert?'&filtert='.$filtert:''); print ($filtert?'&filtert='.$filtert:'');
print ($usergroup?'&usergroup='.$usergroup:'');
print ($actioncode!=''?'&actioncode='.$actioncode:''); print ($actioncode!=''?'&actioncode='.$actioncode:'');
print '">'.img_picto("all","1downarrow_selected.png").' ...'; print '">'.img_picto("all","1downarrow_selected.png").' ...';
print ' +'.(count($eventarray[$daykey])-$maxprint); print ' +'.(count($eventarray[$daykey])-$maxprint);

View File

@ -41,23 +41,23 @@ $langs->loadLangs(array("users","companies","agenda","commercial"));
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
$pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3);
$status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
$type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml');
$optioncss = GETPOST('optioncss','alpha');
$year=GETPOST("year",'int'); $year=GETPOST("year",'int');
$month=GETPOST("month",'int'); $month=GETPOST("month",'int');
$day=GETPOST("day",'int'); $day=GETPOST("day",'int');
$pid=GETPOST("projectid",'int',3);
$status=GETPOST("status",'alpha');
$type=GETPOST('type','alphanohtml');
$optioncss = GETPOST('optioncss','alpha');
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array')) if (GETPOST('search_actioncode','array'))
{ {
$actioncode=GETPOST('actioncode','array',3); $actioncode=GETPOST('search_actioncode','array',3);
if (! count($actioncode)) $actioncode='0'; if (! count($actioncode)) $actioncode='0';
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("search_actioncode","alpha",3)?GETPOST("search_actioncode","alpha",3):(GETPOST("search_actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$search_id=GETPOST('search_id','alpha'); $search_id=GETPOST('search_id','alpha');
@ -69,10 +69,10 @@ $dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth','int'), GETPOST('dateendday'
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW); if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
$filter = GETPOST("filter",'alpha',3); $filter = GETPOST("search_filter",'alpha',3)?GETPOST("search_filter",'alpha',3):GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3); $filtert = GETPOST("search_filtert","int",3)?GETPOST("search_filtert","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("search_usergroup","int",3)?GETPOST("search_usergroup","int",3):GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; $showbirthday = empty($conf->use_javascript_ajax)?(GETPOST("search_showbirthday","int")?GETPOST("search_showbirthday","int"):GETPOST("showbirthday","int")):1;
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$object = new ActionComm($db); $object = new ActionComm($db);
@ -108,7 +108,7 @@ if (! $sortfield)
} }
// Security check // Security check
$socid = GETPOST("socid",'int'); $socid = GETPOST("search_socid",'int')?GETPOST("search_socid",'int'):GETPOST("socid",'int');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid=''; if ($socid < 0) $socid='';
@ -132,14 +132,15 @@ $arrayfields=array(
'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1), 'a.fk_contact'=>array('label'=>"Contact", 'checked'=>1),
'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>0, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))), 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>0, 'enabled'=>(! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))),
'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
'a.datec'=>array('label'=>'DateCreation', 'checked'=>0),
'a.tms'=>array('label'=>'DateModification', 'checked'=>0)
); );
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {
foreach($extrafields->attribute_label as $key => $val) foreach($extrafields->attribute_label as $key => $val)
{ {
$arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]); if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>$extrafields->attribute_list[$key], 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>$extrafields->attribute_perms[$key]);
} }
} }
@ -207,19 +208,18 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
if ($actioncode != '') { if ($actioncode != '') {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".urlencode($str_action); foreach($actioncode as $str_action) $param.="&search_actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".urlencode($actioncode); } else $param.="&search_actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".urlencode($resourceid); if ($resourceid > 0) $param.="&search_resourceid=".urlencode($resourceid);
if ($status != '' && $status > -1) $param.="&status=".urlencode($status); if ($status != '' && $status > -1) $param.="&search_status=".urlencode($status);
if ($filter) $param.="&filter=".urlencode($filter); if ($filter) $param.="&search_filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".urlencode($filtert); if ($filtert) $param.="&search_filtert=".urlencode($filtert);
if ($socid) $param.="&socid=".urlencode($socid); if ($socid) $param.="&search_socid=".urlencode($socid);
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&search_showbirthday=1";
if ($pid) $param.="&projectid=".urlencode($pid); if ($pid) $param.="&search_projectid=".urlencode($pid);
if ($type) $param.="&type=".urlencode($type); if ($type) $param.="&search_type=".urlencode($type);
if ($usergroup) $param.="&usergroup=".urlencode($usergroup); if ($usergroup) $param.="&search_usergroup=".urlencode($usergroup);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
if ($search_id != '') $param.='&search_title='.urlencode($search_id); if ($search_id != '') $param.='&search_title='.urlencode($search_id);
if ($search_title != '') $param.='&search_title='.urlencode($search_title); if ($search_title != '') $param.='&search_title='.urlencode($search_title);
if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int'); if (GETPOST('datestartday','int')) $param.='&datestartday='.GETPOST('datestartday','int');
@ -228,16 +228,17 @@ if (GETPOST('datestartyear','int')) $param.='&datestartyear='.GETPOST('datestart
if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int'); if (GETPOST('dateendday','int')) $param.='&dateendday='.GETPOST('dateendday','int');
if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int'); if (GETPOST('dateendmonth','int')) $param.='&dateendmonth='.GETPOST('dateendmonth','int');
if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int'); if (GETPOST('dateendyear','int')) $param.='&dateendyear='.GETPOST('dateendyear','int');
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
$sql = "SELECT"; $sql = "SELECT";
if ($usergroup > 0) $sql.=" DISTINCT"; if ($usergroup > 0) $sql.=" DISTINCT";
$sql.= " s.nom as societe, s.rowid as socid, s.client,"; $sql.= " s.nom as societe, s.rowid as socid, s.client, s.email as socemail,";
$sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,"; $sql.= " a.id, a.label, a.datep as dp, a.datep2 as dp2,";
$sql.= ' a.fk_user_author,a.fk_user_action,'; $sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_contact, a.note, a.percent as percent,";
$sql.= " a.fk_element, a.elementtype,"; $sql.= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
$sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " c.code as type_code, c.libelle as type_label,";
$sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; $sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id";
// Add fields from extrafields // Add fields from extrafields
@ -364,10 +365,10 @@ if ($resql)
//if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; //if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
//if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">'; //if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; if ($filter) $nav.='<input type="hidden" name="search_filter" value="'.$filter.'">';
//if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; //if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
//if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; //if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">'; if ($showbirthday) $nav.='<input type="hidden" name="search_showbirthday" value="1">';
//if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; //if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
//if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; //if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
print $nav; print $nav;
@ -461,8 +462,9 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['a.datec']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.percent']['checked'])) { if (! empty($arrayfields['a.tms']['checked'])) print '<td class="liste_titre"></td>';
if (! empty($arrayfields['a.percent']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $formactions->form_select_status_action('formaction',$status,1,'status',1,2); print $formactions->form_select_status_action('formaction',$status,1,'status',1,2);
print ajax_combobox('selectstatus'); print ajax_combobox('selectstatus');
@ -494,6 +496,10 @@ if ($resql)
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (! empty($arrayfields['a.datec']['checked'])) print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"],"a.datec,a.id",$param,"",'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['a.tms']['checked'])) print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"],"a.tms,a.id",$param,"",'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['a.percent']['checked']))print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['a.percent']['checked']))print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n"; print "</tr>\n";
@ -599,11 +605,13 @@ if ($resql)
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) { if (! empty($arrayfields['s.nom']['checked'])) {
print '<td class="tdoverflowmax100">'; print '<td class="tdoverflowmax100">';
if ($obj->socid) if ($obj->socid > 0)
{ {
$societestatic->id=$obj->socid; $societestatic->id=$obj->socid;
$societestatic->client=$obj->client; $societestatic->client=$obj->client;
$societestatic->name=$obj->societe; $societestatic->name=$obj->societe;
$societestatic->email=$obj->socemail;
print $societestatic->getNomUrl(1,'',28); print $societestatic->getNomUrl(1,'',28);
} }
else print '&nbsp;'; else print '&nbsp;';
@ -652,6 +660,15 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint; print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['a.datec']['checked'])) {
// Status/Percent
print '<td align="center" class="nowrap">'.dol_print_date($obj->datec, 'dayhour').'</td>';
}
// Date update
if (! empty($arrayfields['a.tms']['checked'])) {
print '<td align="center" class="nowrap">'.dol_print_date($obj->datem, 'dayhour').'</td>';
}
if (! empty($arrayfields['a.percent']['checked'])) { if (! empty($arrayfields['a.percent']['checked'])) {
// Status/Percent // Status/Percent
$datep=$db->jdate($obj->datep); $datep=$db->jdate($obj->datep);

View File

@ -41,9 +41,9 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3; if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter = GETPOST("filter",'alpha',3); $filter = GETPOST("search_filter",'alpha',3)?GETPOST("search_filter",'alpha',3):GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3); $filtert = GETPOST("search_filtert","int",3)?GETPOST("search_filtert","int",3):GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3); $usergroup = GETPOST("search_usergroup","int",3)?GETPOST("search_usergroup","int",3):GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; //$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
$showbirthday = 0; $showbirthday = 0;
@ -64,7 +64,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec"; if (! $sortfield) $sortfield="a.datec";
// Security check // Security check
$socid = GETPOST("socid","int"); $socid = GETPOST("search_socid","int")?GETPOST("search_socid","int"):GETPOST("socid","int");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'agenda', 0, '', 'myactions'); $result = restrictedArea($user, 'agenda', 0, '', 'myactions');
if ($socid < 0) $socid=''; if ($socid < 0) $socid='';
@ -79,24 +79,24 @@ if (! $user->rights->agenda->allactions->read || $filter =='mine') // If no per
//$action=GETPOST('action','alpha'); //$action=GETPOST('action','alpha');
$action='show_peruser'; //We use 'show_week' mode $action='show_peruser'; //We use 'show_week' mode
$resourceid=GETPOST("resourceid","int"); $resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
$year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y");
$month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); $day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3); $pid=GETPOST("search_projectid","int",3)?GETPOST("search_projectid","int",3):GETPOST("projectid","int",3);
$status=GETPOST("status",'alpha'); $status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
$type=GETPOST("type",'alpha'); $type=GETPOST("search_type",'alpha')?GETPOST("search_type",'alpha'):GETPOST("type",'alpha');
$maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $maxprint=((GETPOST("maxprint",'int')!='')?GETPOST("maxprint",'int'):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
if (GETPOST('actioncode','array')) if (GETPOST('search_actioncode','array'))
{ {
$actioncode=GETPOST('actioncode','array',3); $actioncode=GETPOST('search_actioncode','array',3);
if (! count($actioncode)) $actioncode='0'; if (! count($actioncode)) $actioncode='0';
} }
else else
{ {
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE)); $actioncode=GETPOST("search_actioncode","alpha",3)?GETPOST("search_actioncode","alpha",3):(GETPOST("search_actioncode","alpha")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE));
} }
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
@ -201,25 +201,25 @@ if ($status == 'done') $title=$langs->trans("DoneActions");
if ($status == 'todo') $title=$langs->trans("ToDoActions"); if ($status == 'todo') $title=$langs->trans("ToDoActions");
$param=''; $param='';
if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) { if ($actioncode || isset($_GET['search_actioncode']) || isset($_POST['search_actioncode'])) {
if(is_array($actioncode)) { if(is_array($actioncode)) {
foreach($actioncode as $str_action) $param.="&actioncode[]=".urlencode($str_action); foreach($actioncode as $str_action) $param.="&search_actioncode[]=".urlencode($str_action);
} else $param.="&actioncode=".urlencode($actioncode); } else $param.="&search_actioncode=".urlencode($actioncode);
} }
if ($resourceid > 0) $param.="&resourceid=".urlencode($resourceid); if ($resourceid > 0) $param.="&search_resourceid=".urlencode($resourceid);
if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".urlencode($status); if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&search_status=".urlencode($status);
if ($filter) $param.="&filter=".urlencode($filter); if ($filter) $param.="&search_filter=".urlencode($filter);
if ($filtert) $param.="&filtert=".urlencode($filtert); if ($filtert) $param.="&search_filtert=".urlencode($filtert);
if ($usergroup) $param.="&usergroup=".urlencode($usergroup); if ($usergroup) $param.="&search_usergroup=".urlencode($usergroup);
if ($socid) $param.="&socid=".urlencode($socid); if ($socid) $param.="&search_socid=".urlencode($socid);
if ($showbirthday) $param.="&showbirthday=1"; if ($showbirthday) $param.="&search_showbirthday=1";
if ($pid) $param.="&projectid=".urlencode($pid); if ($pid) $param.="&search_projectid=".urlencode($pid);
if ($type) $param.="&type=".urlencode($type); if ($type) $param.="&search_type=".urlencode($type);
if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser') $param.='&action='.urlencode($action); if ($action == 'show_day' || $action == 'show_week' || $action == 'show_month' || $action != 'show_peruser') $param.='&action='.urlencode($action);
if ($begin_h != '') $param.='&begin_h='.urlencode($begin_h); if ($begin_h != '') $param.='&begin_h='.urlencode($begin_h);
if ($end_h != '') $param.='&end_h='.urlencode($end_h); if ($end_h != '') $param.='&end_h='.urlencode($end_h);
if ($begin_d != '') $param.='&begin_d='.urlencode($begin_d); if ($begin_d != '') $param.='&begin_d='.urlencode($begin_d);
if ($end_d != '') $param.='&end_d='.urlencode($end_d); if ($end_d != '') $param.='&end_d='.urlencode($end_d);
$param.="&maxprint=".urlencode($maxprint); $param.="&maxprint=".urlencode($maxprint);
@ -358,9 +358,23 @@ if ($conf->use_javascript_ajax)
} }
$newcardbutton='';
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
$tmpforcreatebutton=dol_getdate(dol_now(), true);
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$tmpforcreatebutton['year'];
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$newcardbutton = '<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$tmpforcreatebutton['year'],$tmpforcreatebutton['mon'],$tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'"><span class="valignmiddle">'.$langs->trans("AddAction").'</span>';
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
$newcardbutton.= '</a>';
}
$link=''; $link='';
print load_fiche_titre($s, $link.' &nbsp; &nbsp; '.$nav, ''); print load_fiche_titre($s, $link.' &nbsp; &nbsp; '.$nav.' '.$newcardbutton, '');
// Get event in an array // Get event in an array

View File

@ -346,7 +346,7 @@ if ($object->id > 0)
print '</td><td>'; print '</td><td>';
if ($action == 'editmode') if ($action == 'editmode')
{ {
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->mode_reglement_id,'mode_reglement_id', 'CRDT');
} }
else else
{ {
@ -1136,7 +1136,7 @@ if ($object->id > 0)
*/ */
if (! empty($conf->facture->enabled) && $user->rights->facture->lire) if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount'; $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
$sql.= ', f.total as total_ht'; $sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva'; $sql.= ', f.tva as total_tva';
$sql.= ', f.total_ttc'; $sql.= ', f.total_ttc';
@ -1147,7 +1147,7 @@ if ($object->id > 0)
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id; $sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.datec, f.paye, f.fk_statut,'; $sql.= ' f.datef, f.datec, f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid'; $sql.= ' s.nom, s.rowid';
$sql.= " ORDER BY f.datef DESC, f.datec DESC"; $sql.= " ORDER BY f.datef DESC, f.datec DESC";
@ -1176,7 +1176,7 @@ if ($object->id > 0)
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$facturestatic->id = $objp->facid; $facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber; $facturestatic->ref = $objp->ref;
$facturestatic->type = $objp->type; $facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total_ht; $facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva; $facturestatic->total_tva = $objp->total_tva;

View File

@ -72,7 +72,7 @@ $object = new Mailing($db);
if ($action == 'add') if ($action == 'add')
{ {
$module=GETPOST("module"); $module=GETPOST("module",'alpha');
$result=-1; $result=-1;
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
@ -89,14 +89,10 @@ if ($action == 'add')
{ {
require_once $file; require_once $file;
// We fill $filtersarray. Using this variable is now deprecated. Kept for backward compatibility.
$filtersarray=array();
if (isset($_POST["filter"])) $filtersarray[0]=$_POST["filter"];
// Add targets into database // Add targets into database
$obj = new $classname($db); $obj = new $classname($db);
dol_syslog("Call add_to_target on class ".$classname); dol_syslog("Call add_to_target on class ".$classname);
$result=$obj->add_to_target($id,$filtersarray); $result=$obj->add_to_target($id);
} }
} }
if ($result > 0) if ($result > 0)
@ -329,14 +325,16 @@ if ($object->fetch($id) >= 0)
// Si le module mailing est qualifie // Si le module mailing est qualifie
if ($qualified) if ($qualified)
{ {
$var = ! $var;
if ($allowaddtarget) if ($allowaddtarget)
{ {
print '<form class="oddeven tagtr" name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">'; print '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
} }
else else
{ {
print '<div class="oddeven tagtr">'; print '<div '.$bctag[$var].'>';
} }
print '<div class="tagtd">'; print '<div class="tagtd">';

View File

@ -745,7 +745,16 @@ class AdvanceTargetingMailing extends CommonObject
$sqlwhere[]= " (t.civility IN ('".$this->db->escape(implode("','",$arrayquery['contact_civility']))."'))"; $sqlwhere[]= " (t.civility IN ('".$this->db->escape(implode("','",$arrayquery['contact_civility']))."'))";
} }
if ($arrayquery['contact_no_email']!='') { if ($arrayquery['contact_no_email']!='') {
$sqlwhere[]= " (t.no_email='".$this->db->escape($arrayquery['contact_no_email'])."')"; $tmpwhere = '';
if (! empty($arrayquery['contact_no_email']))
{
$tmpwhere.= "(t.email IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))";
}
else
{
$tmpwhere.= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))";
}
$sqlwhere[]= $tmpwhere;
} }
if ($arrayquery['contact_update_st_dt']!='') { if ($arrayquery['contact_update_st_dt']!='') {
$sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')"; $sqlwhere[]= " (t.tms >= '".$this->db->idate($arrayquery['contact_update_st_dt'])."' AND t.tms <= '".$this->db->idate($arrayquery['contact_update_end_dt'])."')";

View File

@ -10,8 +10,8 @@
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -696,6 +696,88 @@ if (empty($reshook))
} }
} }
} }
// add lines from objectlinked
elseif($action == 'import_lines_from_object'
&& $user->rights->propal->creer
&& $object->statut == Propal::STATUS_DRAFT
)
{
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'OrderLine';
}
elseif($fromElement == 'propal')
{
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'PropaleLigne';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
foreach($importLines as $lineId)
{
$lineId = intval($lineId);
$originLine = new $lineClassName($db);
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
{
$originLine->fetch_optionals($lineId);
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
$txtva = $originLine->tva_tx;
$txlocaltax1 = $originLine->localtax1_tx;
$txlocaltax2 = $originLine->localtax2_tx;
$fk_product = $originLine->fk_product;
$remise_percent = $originLine->remise_percent;
$date_start = $originLine->date_start;
$date_end = $originLine->date_end;
$ventil = 0;
$info_bits = $originLine->info_bits;
$fk_remise_except = $originLine->fk_remise_except;
$price_base_type='HT';
$pu_ttc=0;
$type = $originLine->product_type;
$rang=$nextRang++;
$special_code = $originLine->special_code;
$origin = $originLine->element;
$origin_id = $originLine->id;
$fk_parent_line=0;
$fk_fournprice=$originLine->fk_fournprice;
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
$situation_percent = 100;
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$date_start, $date_end,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise, $fk_remise_except);
if($res > 0){
$importCount++;
}else{
$error++;
}
}
else{
$error++;
}
}
if($error)
{
setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors');
}
}
}
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
@ -1627,7 +1709,7 @@ if ($action == 'create')
if (! empty($conf->multicurrency->enabled)) if (! empty($conf->multicurrency->enabled))
{ {
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
print '</td></tr>'; print '</td></tr>';
@ -2105,7 +2187,7 @@ if ($action == 'create')
print '</tr></table>'; print '</tr></table>';
print '</td><td>'; print '</td><td>';
if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) { if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
} else { } else {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
} }
@ -2118,7 +2200,7 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print fieldLabel('Currency','multicurrency_code'); print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>'; print '</td>';
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate) if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate)
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
@ -2135,7 +2217,7 @@ if ($action == 'create')
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print fieldLabel('CurrencyRate','multicurrency_tx'); print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>'; print '</td>';
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate)
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
@ -2243,17 +2325,17 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{ {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>'; print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
} }
@ -2488,7 +2570,13 @@ if ($action == 'create')
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('propal')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('propal'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
$compatibleImportElementsList = false;
if($user->rights->propal->creer && $object->statut == Propal::STATUS_DRAFT)
{
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
// Show online signature link // Show online signature link
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok

View File

@ -14,6 +14,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -438,38 +439,40 @@ class Propal extends CommonObject
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except); dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$txtva=price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$pa_ht=price2num($pa_ht);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
$this->db->begin(); $this->db->begin();
$product_type=$type; $product_type=$type;
@ -2432,7 +2435,7 @@ class Propal extends CommonObject
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function cloture($user, $statut, $note, $notrigger=0) function cloture($user, $statut, $note="", $notrigger=0)
{ {
global $langs,$conf; global $langs,$conf;
@ -2775,7 +2778,7 @@ class Propal extends CommonObject
if (count($linkedInvoices) > 0) if (count($linkedInvoices) > 0)
{ {
$sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye"; $sql= "SELECT rowid as facid, ref, total, datef as df, fk_user_author, fk_statut, paye";
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")"; $sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";

View File

@ -11,7 +11,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2017-2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -175,9 +175,6 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
} }
} }
$object = new Propal($db); // To be passed as parameter of executeHooks that need
/* /*
* Actions * Actions
*/ */
@ -258,7 +255,7 @@ $projectstatic=new Project($db);
$formcompany=new FormCompany($db); $formcompany=new FormCompany($db);
$help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; $help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('',$langs->trans('Proposal'),$help_url); //llxHeader('',$langs->trans('Proposal'),$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
@ -404,6 +401,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->plimit($limit+1, $offset); $sql.= $db->plimit($limit+1, $offset);
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$objectstatic=new Propal($db); $objectstatic=new Propal($db);
@ -425,6 +423,18 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/comm/propal/card.php?id='.$id);
exit;
}
llxHeader('',$langs->trans('Proposal'),$help_url);
$param='&viewstatut='.urlencode($viewstatut); $param='&viewstatut='.urlencode($viewstatut);
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
@ -452,11 +462,12 @@ if ($resql)
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
'generate_doc'=>$langs->trans("Generate"),
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); if ($user->rights->propal->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Closed"); if ($user->rights->propal->cloturer) $arrayofmassactions['closed']=$langs->trans("Close");
if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array(); if (in_array($massaction, array('presend','predelete','closed'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);

View File

@ -415,7 +415,7 @@ if ($socid > 0)
$sql.= " rc.datec as dc, rc.description,"; $sql.= " rc.datec as dc, rc.description,";
$sql.= " rc.fk_facture_source,"; $sql.= " rc.fk_facture_source,";
$sql.= " u.login, u.rowid as user_id,"; $sql.= " u.login, u.rowid as user_id,";
$sql.= " fa.facnumber as ref, fa.type as type"; $sql.= " fa.ref as ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc"; $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql.= " WHERE rc.fk_soc = " . $object->id; $sql.= " WHERE rc.fk_soc = " . $object->id;
@ -704,8 +704,8 @@ if ($socid > 0)
$sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql.= " rc.fk_facture_source,"; $sql.= " rc.fk_facture_source,";
$sql.= " u.login, u.rowid as user_id,"; $sql.= " u.login, u.rowid as user_id,";
$sql.= " f.rowid, f.facnumber,"; $sql.= " f.rowid, f.ref,";
$sql.= " fa.facnumber as ref, fa.type as type"; $sql.= " fa.ref as ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " , ".MAIN_DB_PREFIX."user as u"; $sql.= " , ".MAIN_DB_PREFIX."user as u";
$sql.= " , ".MAIN_DB_PREFIX."facturedet as fc"; $sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
@ -723,8 +723,8 @@ if ($socid > 0)
$sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; $sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql2.= " rc.fk_facture_source,"; $sql2.= " rc.fk_facture_source,";
$sql2.= " u.login, u.rowid as user_id,"; $sql2.= " u.login, u.rowid as user_id,";
$sql2.= " f.rowid, f.facnumber,"; $sql2.= " f.rowid, f.ref,";
$sql2.= " fa.facnumber as ref, fa.type as type"; $sql2.= " fa.ref as ref, fa.type as type";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql2.= " , ".MAIN_DB_PREFIX."user as u"; $sql2.= " , ".MAIN_DB_PREFIX."user as u";
$sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc"; $sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
@ -819,7 +819,7 @@ if ($socid > 0)
print $obj->description; print $obj->description;
print '</td>'; print '</td>';
} }
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>'; print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
print '<td align="right">'.price($obj->amount_ht).'</td>'; print '<td align="right">'.price($obj->amount_ht).'</td>';
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>'; print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
print '<td align="right">'.price($obj->amount_ttc).'</td>'; print '<td align="right">'.price($obj->amount_ttc).'</td>';
@ -858,7 +858,7 @@ if ($socid > 0)
$sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql.= " rc.fk_invoice_supplier_source,"; $sql.= " rc.fk_invoice_supplier_source,";
$sql.= " u.login, u.rowid as user_id,"; $sql.= " u.login, u.rowid as user_id,";
$sql.= " f.rowid, f.ref as facnumber,"; $sql.= " f.rowid, f.ref as ref,";
$sql.= " fa.ref, fa.type as type"; $sql.= " fa.ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " , ".MAIN_DB_PREFIX."user as u"; $sql.= " , ".MAIN_DB_PREFIX."user as u";
@ -877,7 +877,7 @@ if ($socid > 0)
$sql2.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; $sql2.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql2.= " rc.fk_invoice_supplier_source,"; $sql2.= " rc.fk_invoice_supplier_source,";
$sql2.= " u.login, u.rowid as user_id,"; $sql2.= " u.login, u.rowid as user_id,";
$sql2.= " f.rowid, f.ref as facnumber,"; $sql2.= " f.rowid, f.ref as ref,";
$sql2.= " fa.ref, fa.type as type"; $sql2.= " fa.ref, fa.type as type";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql2.= " , ".MAIN_DB_PREFIX."user as u"; $sql2.= " , ".MAIN_DB_PREFIX."user as u";
@ -973,7 +973,7 @@ if ($socid > 0)
print $obj->description; print $obj->description;
print '</td>'; print '</td>';
} }
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>'; print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
print '<td align="right">'.price($obj->amount_ht).'</td>'; print '<td align="right">'.price($obj->amount_ht).'</td>';
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>'; print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
print '<td align="right">'.price($obj->amount_ttc).'</td>'; print '<td align="right">'.price($obj->amount_ttc).'</td>';

View File

@ -106,7 +106,8 @@ $permissionedit = $user->rights->commande->creer; // Used by the include of ac
*/ */
$parameters = array('socid' => $socid); $parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks // Note that $action and $object may be modified by some hooks
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook))
@ -419,10 +420,11 @@ if (empty($reshook))
// Hooks // Hooks
$parameters = array('objFrom' => $srcobject); $parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been // Note that $action and $object may be modified by hook
// modified by hook $reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action);
if ($reshook < 0) if ($reshook < 0) {
$error++; $error++;
}
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$error++; $error++;
@ -1318,6 +1320,88 @@ if (empty($reshook))
exit(); exit();
} }
// add lines from objectlinked
if($action == 'import_lines_from_object'
&& $user->rights->commande->creer
&& $object->statut == Commande::STATUS_DRAFT
)
{
$fromElement = GETPOST('fromelement');
$fromElementid = GETPOST('fromelementid');
$importLines = GETPOST('line_checkbox');
if(!empty($importLines) && is_array($importLines) && !empty($fromElement) && ctype_alpha($fromElement) && !empty($fromElementid))
{
if($fromElement == 'commande')
{
dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'OrderLine';
}
elseif($fromElement == 'propal')
{
dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php');
$lineClassName = 'PropaleLigne';
}
$nextRang = count($object->lines) + 1;
$importCount = 0;
$error = 0;
foreach($importLines as $lineId)
{
$lineId = intval($lineId);
$originLine = new $lineClassName($db);
if(intval($fromElementid) > 0 && $originLine->fetch( $lineId ) > 0)
{
$originLine->fetch_optionals($lineId);
$desc = $originLine->desc;
$pu_ht = $originLine->subprice;
$qty = $originLine->qty;
$txtva = $originLine->tva_tx;
$txlocaltax1 = $originLine->localtax1_tx;
$txlocaltax2 = $originLine->localtax2_tx;
$fk_product = $originLine->fk_product;
$remise_percent = $originLine->remise_percent;
$date_start = $originLine->date_start;
$date_end = $originLine->date_end;
$ventil = 0;
$info_bits = $originLine->info_bits;
$fk_remise_except = $originLine->fk_remise_except;
$price_base_type='HT';
$pu_ttc=0;
$type = $originLine->product_type;
$rang=$nextRang++;
$special_code = $originLine->special_code;
$origin = $originLine->element;
$origin_id = $originLine->id;
$fk_parent_line=0;
$fk_fournprice=$originLine->fk_fournprice;
$pa_ht = $originLine->pa_ht;
$label = $originLine->label;
$array_options = $originLine->array_options;
$situation_percent = 100;
$fk_prev_id = '';
$fk_unit = $originLine->fk_unit;
$pu_ht_devise = $originLine->multicurrency_subprice;
$res = $object->addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $info_bits, $fk_remise_except, $price_base_type, $pu_ttc, $date_start, $date_end, $type, $rang, $special_code, $fk_parent_line, $fk_fournprice, $pa_ht, $label,$array_options, $fk_unit, $origin, $origin_id, $pu_ht_devise);
if($res > 0){
$importCount++;
}else{
$error++;
}
}
else{
$error++;
}
}
if($error)
{
setEventMessages($langs->trans('ErrorsOnXLines',$error), null, 'errors');
}
}
}
// Actions when printing a doc from card // Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
@ -1669,7 +1753,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Other attributes // Other attributes
$parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid); $parameters = array('objectsrc' => $objectsrc, 'socid'=>$socid);
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by // Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
print $hookmanager->resPrint; print $hookmanager->resPrint;
if (empty($reshook)) { if (empty($reshook)) {
print $object->showOptionals($extrafields, 'edit'); print $object->showOptionals($extrafields, 'edit');
@ -1687,7 +1772,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (! empty($conf->multicurrency->enabled)) if (! empty($conf->multicurrency->enabled))
{ {
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td>'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).'</td>';
print '<td class="maxwidthonsmartphone">'; print '<td class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>'; print '</td></tr>';
@ -1969,7 +2054,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Call Hook formConfirm // Call Hook formConfirm
$parameters = array('lineid' => $lineid); $parameters = array('lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook // Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action);
if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; if (empty($reshook)) $formconfirm.=$hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint;
@ -2074,13 +2160,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Date // Date
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
print $langs->trans('Date'); print $form->editfieldkey("Date", 'date', '', $object, $editenable);
print '</td>';
if ($action != 'editdate' && $object->brouillon)
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editdate') { if ($action == 'editdate') {
print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">'; print '<form name="setdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
@ -2100,12 +2181,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Delivery date planed // Delivery date planed
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('DateDeliveryPlanned'); print $form->editfieldkey("DateDeliveryPlanned", 'date_livraison', '', $object, $editenable);
print '</td>';
if ($action != 'editdate_livraison')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate_livraison&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDeliveryDate'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editdate_livraison') { if ($action == 'editdate_livraison') {
print '<form name="setdate_livraison" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">'; print '<form name="setdate_livraison" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
@ -2125,13 +2202,9 @@ if ($action == 'create' && $user->rights->commande->creer)
// Shipping Method // Shipping Method
if (! empty($conf->expedition->enabled)) { if (! empty($conf->expedition->enabled)) {
print '<tr><td height="10">'; print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('SendingMethod'); print $form->editfieldkey("SendingMethod", 'shippingmethod', '', $object, $editenable);
print '</td>';
if ($action != 'editshippingmethod' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&amp;id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editshippingmethod') { if ($action == 'editshippingmethod') {
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
@ -2144,15 +2217,12 @@ if ($action == 'create' && $user->rights->commande->creer)
// Warehouse // Warehouse
if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { if (! empty($conf->expedition->enabled) && ! empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
$langs->load('stocks');
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
$formproduct=new FormProduct($db); $formproduct=new FormProduct($db);
print '<tr><td>'; print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('Warehouse'); print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable);
print '</td>';
if ($action != 'editwarehouse' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&amp;id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'),1).'</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editwarehouse') { if ($action == 'editwarehouse') {
$formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
@ -2165,12 +2235,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Terms of payment // Terms of payment
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('PaymentConditionsShort'); print $form->editfieldkey("PaymentConditionsShort", 'conditions', '', $object, $editenable);
print '</td>';
if ($action != 'editconditions')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editconditions') { if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id', 1);
@ -2183,15 +2249,11 @@ if ($action == 'create' && $user->rights->commande->creer)
// Mode of payment // Mode of payment
print '<tr><td>'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('PaymentMode'); print $form->editfieldkey("PaymentMode", 'mode', '', $object, $editenable);
print '</td>';
if ($action != 'editmode')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editmode') { if ($action == 'editmode') {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT');
} else { } else {
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
} }
@ -2203,12 +2265,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Multicurrency code // Multicurrency code
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer && $object->statut == Commande::STATUS_DRAFT;
print fieldLabel('Currency','multicurrency_code'); print $form->editfieldkey("Currency", 'multicurrencycode', '', $object, $editenable);
print '</td>';
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editmulticurrencycode') { if ($action == 'editmulticurrencycode') {
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code'); $form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
@ -2220,12 +2278,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// Multicurrency rate // Multicurrency rate
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $object->statut == Commande::STATUS_DRAFT;
print fieldLabel('CurrencyRate','multicurrency_tx'); print $form->editfieldkey("CurrencyRate", 'multicurrencyrate', '', $object, $editenable);
print '</td>';
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') { if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
if($action == 'actualizemulticurrencyrate') { if($action == 'actualizemulticurrencyrate') {
@ -2244,13 +2298,9 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
// Delivery delay // Delivery delay
print '<tr class="fielddeliverydelay"><td height="10">'; print '<tr class="fielddeliverydelay"><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('AvailabilityPeriod'); print $form->editfieldkey("AvailabilityPeriod", 'availability', '', $object, $editenable);
print '</td>';
if ($action != 'editavailability')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetAvailability'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editavailability') { if ($action == 'editavailability') {
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1);
@ -2260,13 +2310,9 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td></tr>'; print '</td></tr>';
// Source reason (why we have an ordrer) // Source reason (why we have an ordrer)
print '<tr><td height="10">'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('Channel'); print $form->editfieldkey("Channel", 'demandreason', '', $object, $editenable);
print '</td>';
if ($action != 'editdemandreason')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editdemandreason') { if ($action == 'editdemandreason') {
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
@ -2277,13 +2323,9 @@ if ($action == 'create' && $user->rights->commande->creer)
// TODO Order mode (how we receive order). Not yet implemented // TODO Order mode (how we receive order). Not yet implemented
/* /*
print '<tr><td height="10">'; print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('SourceMode'); print $form->editfieldkey("SourceMode", 'inputmode', '', $object, $editenable);
print '</td>';
if ($action != 'editinputmode')
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editinputmode&amp;id=' . $object->id . '">' . img_edit($langs->trans('SetInputMode'), 1) . '</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editinputmode') { if ($action == 'editinputmode') {
$form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1); $form->formInputMode($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->source, 'input_mode_id', 1);
@ -2296,15 +2338,13 @@ if ($action == 'create' && $user->rights->commande->creer)
$tmparray=$object->getTotalWeightVolume(); $tmparray=$object->getTotalWeightVolume();
$totalWeight=$tmparray['weight']; $totalWeight=$tmparray['weight'];
$totalVolume=$tmparray['volume']; $totalVolume=$tmparray['volume'];
if ($totalWeight) if ($totalWeight) {
{
print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>'; print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
print '<td>'; print '<td>';
print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no');
print '</td></tr>'; print '</td></tr>';
} }
if ($totalVolume) if ($totalVolume) {
{
print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>'; print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
print '<td>'; print '<td>';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
@ -2314,15 +2354,10 @@ if ($action == 'create' && $user->rights->commande->creer)
// TODO How record was recorded OrderMode (llx_c_input_method) // TODO How record was recorded OrderMode (llx_c_input_method)
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled)) {
{
print '<tr><td>'; print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>'; $editenable = $user->rights->commande->creer;
print $langs->trans('IncotermLabel'); print $form->editfieldkey("IncotermLabel", 'incoterm', '', $object, $editenable);
print '<td><td align="right">';
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
else print '&nbsp;';
print '</td></tr></table>';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($action != 'editincoterm') if ($action != 'editincoterm')
@ -2337,15 +2372,10 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
// Bank Account // Bank Account
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) {
{ print '<tr><td>';
print '<tr><td class="nowrap">'; $editenable = $user->rights->commande->creer;
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; print $form->editfieldkey("BankAccount", 'bankaccount', '', $object, $editenable);
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td>'; print '</td><td>';
if ($action == 'editbankaccount') { if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
@ -2371,17 +2401,17 @@ if ($action == 'create' && $user->rights->commande->creer)
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{ {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>'; print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
} }
@ -2446,12 +2476,11 @@ if ($action == 'create' && $user->rights->commande->creer)
*/ */
$result = $object->getLinesArray(); $result = $object->getLinesArray();
print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST"> print '<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#addline' : '#line_' . GETPOST('lineid')) . '" method="POST">
<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '"> <input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">
<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
<input type="hidden" name="mode" value=""> <input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id . '"> <input type="hidden" name="id" value="' . $object->id . '">';
';
if (! empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) { if (! empty($conf->use_javascript_ajax) && $object->statut == Commande::STATUS_DRAFT) {
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
@ -2477,7 +2506,8 @@ if ($action == 'create' && $user->rights->commande->creer)
$object->formAddObjectLine(1, $mysoc, $soc); $object->formAddObjectLine(1, $mysoc, $soc);
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook // Note that $action and $object may be modified by hook
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action);
} }
} }
print '</table>'; print '</table>';
@ -2494,8 +2524,8 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="tabsAction">'; print '<div class="tabsAction">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been // Note that $action and $object may be modified by hook
// modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action);
if (empty($reshook)) { if (empty($reshook)) {
// Send // Send
if ($object->statut > Commande::STATUS_DRAFT) { if ($object->statut > Commande::STATUS_DRAFT) {
@ -2518,10 +2548,11 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id=' . $object->id . '&amp;action=modif">' . $langs->trans('Modify') . '</a></div>';
} }
// Create event // Create event
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD))
// "workflow" action so should appears somewhere else on
// page.
{ {
// Add hidden condition because this is not a
// "workflow" action so should appears somewhere else on
// page.
print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>'; print '<a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a>';
}*/ }*/
@ -2638,7 +2669,14 @@ if ($action == 'create' && $user->rights->commande->creer)
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
$compatibleImportElementsList = false;
if($user->rights->commande->creer
&& $object->statut == Commande::STATUS_DRAFT)
{
$compatibleImportElementsList = array('commande','propal'); // import from linked elements
}
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem,$compatibleImportElementsList);
// Show online payment link // Show online payment link
$useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled));

View File

@ -9,8 +9,8 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2016-2018 Ferran Marcet <fmarcet@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1312,45 +1312,47 @@ class Commande extends CommonOrder
$logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise"; $logtext.= ", date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit, origin=$origin, origin_id=$origin_id, pu_ht_devise=$pu_ht_devise";
dol_syslog(get_class($this).$logtext, LOG_DEBUG); dol_syslog(get_class($this).$logtext, LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
$txtva = price2num($txtva);
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$label=trim($label);
$desc=trim($desc);
// Check parameters
if ($type < 0) return -1;
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
{ {
$this->db->begin(); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($this->fk_multicurrency)) $this->fk_multicurrency=0;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1'
}
$txlocaltax1 = price2num($txlocaltax1);
$txlocaltax2 = price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
$label=trim($label);
$desc=trim($desc);
// Check parameters
if ($type < 0) return -1;
$this->db->begin();
$product_type=$type; $product_type=$type;
if (!empty($fk_product)) if (!empty($fk_product))

View File

@ -74,6 +74,7 @@ $socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int'); $search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int'); $search_sale=GETPOST('search_sale','int');
$search_total_ht=GETPOST('search_total_ht','alpha'); $search_total_ht=GETPOST('search_total_ht','alpha');
$search_total_ttc=GETPOST('search_total_ttc','alpha');
$search_categ_cus=trim(GETPOST("search_categ_cus",'int')); $search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$optioncss = GETPOST('optioncss','alpha'); $optioncss = GETPOST('optioncss','alpha');
$billed = GETPOST('billed','int'); $billed = GETPOST('billed','int');
@ -232,7 +233,7 @@ $projectstatic=new Project($db);
$title=$langs->trans("Orders"); $title=$langs->trans("Orders");
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; $help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
llxHeader('',$title,$help_url); // llxHeader('',$title,$help_url);
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
@ -335,6 +336,7 @@ if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; 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_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); if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1);
if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref); if ($search_project_ref != '') $sql.= natural_search("p.ref",$search_project_ref);
if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus);
if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL";
@ -399,6 +401,16 @@ if ($resql)
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/commande/card.php?id='.$id);
exit;
}
llxHeader('',$title,$help_url);
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
@ -437,6 +449,7 @@ if ($resql)
// List of mass actions available // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
'generate_doc'=>$langs->trans("Generate"),
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
'cancelorders'=>$langs->trans("Cancel"), 'cancelorders'=>$langs->trans("Cancel"),
@ -467,8 +480,8 @@ if ($resql)
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print '<input type="hidden" name="socid" value="'.$socid.'">'; print '<input type="hidden" name="socid" value="'.$socid.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_commercial.png', 0, $newcardbutton, '', $limit);
$topicmail="SendOrderRef"; $topicmail="SendOrderRef";

View File

@ -136,7 +136,7 @@ if (($action == 'create' || $action == 'add') && !$error)
$closeOrders = GETPOST('autocloseorders') ? true : false; $closeOrders = GETPOST('autocloseorders') ? true : false;
// Security check // Security check
$fieldid = GETPOST('ref','alpha')?'facnumber':'rowid'; $fieldid = GETPOST('ref','alpha')?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid); $result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
@ -163,7 +163,7 @@ if (($action == 'create' || $action == 'add') && !$error)
// Si facture standard // Si facture standard
$object->socid = $_POST['socid']; $object->socid = $_POST['socid'];
$object->type = $_POST['type']; $object->type = $_POST['type'];
$object->number = $_POST['facnumber']; $object->number = $_POST['ref'];
$object->date = $datefacture; $object->date = $datefacture;
$object->note_public = trim($_POST['note_public']); $object->note_public = trim($_POST['note_public']);
$object->note = trim($_POST['note']); $object->note = trim($_POST['note']);
@ -405,7 +405,7 @@ if ($action == 'create' && !$error)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n"; print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
print '<input name="facnumber" type="hidden" value="provisoire">'; print '<input name="ref" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">'; print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">'; print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">'; print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';

View File

@ -634,7 +634,7 @@ if ($resql)
} }
// Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not) // Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not)
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) if (! empty($conf->global->BANK_REPORT_LAST_NUM_RELEVE))
{ {
print ' print '
<script type="text/javascript"> <script type="text/javascript">

View File

@ -1471,7 +1471,7 @@ class Account extends CommonObject
{ {
$country_code=$this->getCountryCode(); $country_code=$this->getCountryCode();
if (in_array($country_code,array('CH','FR','ES','GA','IT','NC'))) return 1; // France, Spain, Gabon, ... if (in_array($country_code,array('FR','ES','GA','IT','NC'))) return 1; // France, Spain, Gabon, ... - Not valid for CH
if (in_array($country_code,array('AU','BE','CA','DE','DK','GR','GB','ID','IE','IR','KR','NL','NZ','UK','US'))) return 2; // Australia, England... if (in_array($country_code,array('AU','BE','CA','DE','DK','GR','GB','ID','IE','IR','KR','NL','NZ','UK','US'))) return 2; // Australia, England...
return 0; return 0;
} }

View File

@ -596,7 +596,7 @@ if ($result)
$langs->load('categories'); $langs->load('categories');
// Bank line // Bank line
print '<tr><td class="toptd">' . fieldLabel('RubriquesTransactions', 'custcats') . '</td><td>'; print '<tr><td class="toptd">' . $form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0) . '</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%"); print $form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
print "</td></tr>"; print "</td></tr>";

View File

@ -550,7 +550,7 @@ foreach ($accounts as $key=>$type)
// Balance // Balance
if (! empty($arrayfields['balance']['checked'])) if (! empty($arrayfields['balance']['checked']))
{ {
print '<td align="right">'; print '<td align="right" class="nowraponall">';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$obj->id.'">'.price($solde, 0, $langs, 0, -1, -1, $obj->currency_code).'</a>';
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;

View File

@ -136,7 +136,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sqls = array(); $sqls = array();
// Customer invoices // Customer invoices
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,"; $sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
$sql.= " s.rowid as socid, s.nom as name, s.fournisseur"; $sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";

View File

@ -256,32 +256,32 @@ if ($action == 'create')
// Date payment // Date payment
print '<tr><td>'; print '<tr><td>';
print fieldLabel('DatePayment','datep',1).'</td><td>'; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
print $form->selectDate((empty($datep)?-1:$datep),"datep",'','','','add',1,1); print $form->selectDate((empty($datep)?-1:$datep),"datep",'','','','add',1,1);
print '</td></tr>'; print '</td></tr>';
// Date value for bank // Date value for bank
print '<tr><td>'; print '<tr><td>';
print fieldLabel('DateValue','datev',0).'</td><td>'; print $form->editfieldkey('DateValue', 'datev', '', $object, 0).'</td><td>';
print $form->selectDate((empty($datev)?-1:$datev),"datev",'','','','add',1,1); print $form->selectDate((empty($datev)?-1:$datev),"datev",'','','','add',1,1);
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Label','label',1).'</td><td>'; print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="label" id="label" class="minwidth300" value="'.($label?$label:$langs->trans("VariousPayment")).'">'; print '<input name="label" id="label" class="minwidth300" value="'.($label?$label:$langs->trans("VariousPayment")).'">';
print '</td></tr>'; print '</td></tr>';
// Sens // Sens
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Sens','sens',1).'</td><td>'; print $form->editfieldkey('Sens', 'sens', '', $object, 0, 'string', '', 1).'</td><td>';
$sensarray=array( '0' => $langs->trans("Debit"), '1' => $langs->trans("Credit")); $sensarray=array( '0' => $langs->trans("Debit"), '1' => $langs->trans("Credit"));
print $form->selectarray('sens',$sensarray,$sens); print $form->selectarray('sens',$sensarray,$sens);
print '</td></tr>'; print '</td></tr>';
// Amount // Amount
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Amount','amount',1).'</td><td>'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="amount" id="amount" class="minwidth100" value="'.$amount.'">'; print '<input name="amount" id="amount" class="minwidth100" value="'.$amount.'">';
print '</td></tr>'; print '</td></tr>';
@ -289,14 +289,14 @@ if ($action == 'create')
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
print '<tr><td>'; print '<tr><td>';
print fieldLabel('BankAccount','selectaccountid',1).'</td><td>'; print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_comptes($accountid,"accountid",0,'',1); // Affiche liste des comptes courant $form->select_comptes($accountid,"accountid",0,'',1); // Affiche liste des comptes courant
print '</td></tr>'; print '</td></tr>';
} }
// Type payment // Type payment
print '<tr><td>'; print '<tr><td>';
print fieldLabel('PaymentMode','selectpaymenttype',1).'</td><td>'; print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_types_paiements($paymenttype, "paymenttype"); $form->select_types_paiements($paymenttype, "paymenttype");
print '</td></tr>'; print '</td></tr>';

View File

@ -88,7 +88,7 @@ $filesarray=array();
$result=false; $result=false;
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
$sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; $sql="SELECT rowid as id, ref as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql.=" WHERE datef between ".$wheretail; $sql.=" WHERE datef between ".$wheretail;
$sql.=" UNION ALL"; $sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; $sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn";

View File

@ -128,7 +128,7 @@ $permissiondellink = $usercancreate; // Used by the include of actions_dellink.i
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdonw.inc.php $permissiontoedit = $usercancreate; // Used by the include of actions_lineupdonw.inc.php
// Security check // Security check
$fieldid = (! empty($ref) ? 'facnumber' : 'rowid'); $fieldid = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid = $user->societe_id; if ($user->societe_id) $socid = $user->societe_id;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
@ -912,7 +912,7 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
$object->socid = GETPOST('socid','int'); $object->socid = GETPOST('socid','int');
$object->number = $_POST['facnumber']; $object->number = $_POST['ref'];
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public','none')); $object->note_public = trim(GETPOST('note_public','none'));
@ -1093,7 +1093,7 @@ if (empty($reshook))
{ {
$object->socid = GETPOST('socid','int'); $object->socid = GETPOST('socid','int');
$object->type = $_POST['type']; $object->type = $_POST['type'];
$object->number = $_POST['facnumber']; $object->number = $_POST['ref'];
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public','none')); $object->note_public = trim(GETPOST('note_public','none'));
@ -1144,7 +1144,7 @@ if (empty($reshook))
// Si facture standard // Si facture standard
$object->socid = GETPOST('socid','int'); $object->socid = GETPOST('socid','int');
$object->type = GETPOST('type'); $object->type = GETPOST('type');
$object->number = $_POST['facnumber']; $object->number = $_POST['ref'];
$object->date = $dateinvoice; $object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax; $object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public','none')); $object->note_public = trim(GETPOST('note_public','none'));
@ -2718,7 +2718,7 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
if ($soc->id > 0) print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n"; if ($soc->id > 0) print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
print '<input name="facnumber" type="hidden" value="provisoire">'; print '<input name="ref" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="' . $ref_client . '">'; print '<input name="ref_client" type="hidden" value="' . $ref_client . '">';
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">'; print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
print '<input type="hidden" name="origin" value="' . $origin . '">'; print '<input type="hidden" name="origin" value="' . $origin . '">';
@ -3213,7 +3213,7 @@ if ($action == 'create')
if (! empty($conf->multicurrency->enabled)) if (! empty($conf->multicurrency->enabled))
{ {
print '<tr>'; print '<tr>';
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>'; print '<td>'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'</td>';
print '<td colspan="2" class="maxwidthonsmartphone">'; print '<td colspan="2" class="maxwidthonsmartphone">';
print $form->selectMultiCurrency($currency_code, 'multicurrency_code'); print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
print '</td></tr>'; print '</td></tr>';
@ -3740,7 +3740,7 @@ else if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', ''); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
@ -3915,7 +3915,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print fieldLabel('Currency','multicurrency_code'); print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>'; print '</td>';
if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon)) if ($usercancreate && $action != 'editmulticurrencycode' && ! empty($object->brouillon))
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
@ -3928,7 +3928,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr>'; print '<tr>';
print '<td>'; print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>'; print '<table class="nobordernopadding" width="100%"><tr><td>';
print fieldLabel('CurrencyRate','multicurrency_tx'); print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
print '</td>'; print '</td>';
if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) if ($usercancreate && $action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>'; print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
@ -4014,17 +4014,17 @@ else if ($id > 0 || ! empty($ref))
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{ {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>'; print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
print '<td class="nowrap amountcard">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap amountcard">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
print '<td class="nowrap amountcard">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap amountcard">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
print '<td class="nowrap amountcard">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap amountcard">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -93,7 +93,7 @@ class Facture extends CommonInvoice
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected $table_ref_field = 'facnumber'; protected $table_ref_field = 'ref';
public $socid; public $socid;
@ -450,7 +450,7 @@ class Facture extends CommonInvoice
$socid = $this->socid; $socid = $this->socid;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture (";
$sql.= " facnumber"; $sql.= " ref";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ", ref_ext"; $sql.= ", ref_ext";
$sql.= ", type"; $sql.= ", type";
@ -514,7 +514,7 @@ class Facture extends CommonInvoice
// Update ref with new one // Update ref with new one
$this->ref='(PROV'.$this->id.')'; $this->ref='(PROV'.$this->id.')';
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if (! $resql) $error++; if (! $resql) $error++;
@ -1310,7 +1310,7 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT f.rowid,f.entity,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount'; $sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
$sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp'; $sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df, f.date_pointoftax'; $sql.= ', f.datef as df, f.date_pointoftax';
@ -1336,7 +1336,7 @@ class Facture extends CommonInvoice
if ($rowid) $sql.= " WHERE f.rowid=".$rowid; if ($rowid) $sql.= " WHERE f.rowid=".$rowid;
else $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; // Dont't use entity if you use rowid else $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; // Dont't use entity if you use rowid
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND f.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'"; if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'"; if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
@ -1351,7 +1351,7 @@ class Facture extends CommonInvoice
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->entity = $obj->entity; $this->entity = $obj->entity;
$this->ref = $obj->facnumber; $this->ref = $obj->ref;
$this->ref_client = $obj->ref_client; $this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int; $this->ref_int = $obj->ref_int;
@ -1615,7 +1615,7 @@ class Facture extends CommonInvoice
// Clean parameters // Clean parameters
if (empty($this->type)) $this->type= self::TYPE_STANDARD; if (empty($this->type)) $this->type= self::TYPE_STANDARD;
if (isset($this->facnumber)) $this->facnumber=trim($this->ref); if (isset($this->ref)) $this->ref=trim($this->ref);
if (isset($this->ref_client)) $this->ref_client=trim($this->ref_client); if (isset($this->ref_client)) $this->ref_client=trim($this->ref_client);
if (isset($this->increment)) $this->increment=trim($this->increment); if (isset($this->increment)) $this->increment=trim($this->increment);
if (isset($this->close_code)) $this->close_code=trim($this->close_code); if (isset($this->close_code)) $this->close_code=trim($this->close_code);
@ -1631,7 +1631,7 @@ class Facture extends CommonInvoice
// Update request // Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
$sql.= " facnumber=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
$sql.= " type=".(isset($this->type)?$this->db->escape($this->type):"null").","; $sql.= " type=".(isset($this->type)?$this->db->escape($this->type):"null").",";
$sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").","; $sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").",";
$sql.= " increment=".(isset($this->increment)?"'".$this->db->escape($this->increment)."'":"null").","; $sql.= " increment=".(isset($this->increment)?"'".$this->db->escape($this->increment)."'":"null").",";
@ -2337,7 +2337,7 @@ class Facture extends CommonInvoice
// Validate // Validate
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'"; $sql.= " SET ref='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
{ {
$sql.= ", datef='".$this->db->idate($this->date)."'"; $sql.= ", datef='".$this->db->idate($this->date)."'";
@ -2446,7 +2446,7 @@ class Facture extends CommonInvoice
if (! $error) if (! $error)
{ {
$this->ref = $num; $this->ref = $num;
$this->facnumber=$num; $this->ref=$num;
$this->statut= self::STATUS_VALIDATED; $this->statut= self::STATUS_VALIDATED;
$this->brouillon=0; $this->brouillon=0;
$this->date_validation=$now; $this->date_validation=$now;
@ -2663,55 +2663,47 @@ class Facture extends CommonInvoice
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG); dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($ventil)) $ventil=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
if (! empty($this->brouillon)) if (! empty($this->brouillon))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
if (empty($remise_percent)) $remise_percent=0;
if (empty($qty)) $qty=0;
if (empty($info_bits)) $info_bits=0;
if (empty($rang)) $rang=0;
if (empty($ventil)) $ventil=0;
if (empty($txtva)) $txtva=0;
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if (empty($fk_parent_line) || $fk_parent_line < 0) $fk_parent_line=0;
if (empty($fk_prev_id)) $fk_prev_id = 'null';
if (! isset($situation_percent) || $situation_percent > 100 || (string) $situation_percent == '') $situation_percent = 100;
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu_ht=price2num($pu_ht);
$pu_ht_devise=price2num($pu_ht_devise);
$pu_ttc=price2num($pu_ttc);
$pa_ht=price2num($pa_ht);
if (!preg_match('/\((.*)\)/', $txtva)) {
$txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5'
}
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
if ($price_base_type=='HT')
{
$pu=$pu_ht;
}
else
{
$pu=$pu_ttc;
}
// Check parameters
if ($type < 0) return -1;
$this->db->begin(); $this->db->begin();
$product_type=$type; $product_type=$type;
@ -2729,6 +2721,16 @@ class Facture extends CommonInvoice
} }
} }
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
{
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
// Calcul du total TTC et de la TVA pour la ligne a partir de // Calcul du total TTC et de la TVA pour la ligne a partir de
// qty, pu, remise_percent et txtva // qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
@ -3479,7 +3481,7 @@ class Facture extends CommonInvoice
$ga = array(); $ga = array();
$sql = "SELECT s.rowid, s.nom as name, s.client,"; $sql = "SELECT s.rowid, s.nom as name, s.client,";
$sql.= " f.rowid as fid, f.facnumber as ref, f.datef as df"; $sql.= " f.rowid as fid, f.ref as ref, f.datef as df";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -3549,7 +3551,7 @@ class Facture extends CommonInvoice
$return = array(); $return = array();
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut,"; $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut,";
$sql.= " ff.rowid as rowidnext"; $sql.= " ff.rowid as rowidnext";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
@ -3560,7 +3562,7 @@ class Facture extends CommonInvoice
$sql.= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait $sql.= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait
$sql.= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement $sql.= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber"; $sql.= " ORDER BY f.ref";
dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG); dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -3569,7 +3571,7 @@ class Facture extends CommonInvoice
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))
{ {
$return[$obj->rowid]=array( 'id' => $obj->rowid, $return[$obj->rowid]=array( 'id' => $obj->rowid,
'ref' => $obj->facnumber, 'ref' => $obj->ref,
'status' => $obj->fk_statut); 'status' => $obj->fk_statut);
} }
//print_r($return); //print_r($return);
@ -3600,7 +3602,7 @@ class Facture extends CommonInvoice
$return = array(); $return = array();
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, f.type, f.paye, pf.fk_paiement"; $sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut, f.type, f.paye, pf.fk_paiement";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")";
@ -3629,7 +3631,7 @@ class Facture extends CommonInvoice
} }
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid; if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber"; $sql.= " ORDER BY f.ref";
dol_syslog(get_class($this)."::list_qualified_avoir_invoices", LOG_DEBUG); dol_syslog(get_class($this)."::list_qualified_avoir_invoices", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
@ -3642,9 +3644,9 @@ class Facture extends CommonInvoice
if ($obj->fk_statut == self::STATUS_CLOSED) $qualified=1; if ($obj->fk_statut == self::STATUS_CLOSED) $qualified=1;
if ($qualified) if ($qualified)
{ {
//$ref=$obj->facnumber; //$ref=$obj->ref;
$paymentornot=($obj->fk_paiement?1:0); $paymentornot=($obj->fk_paiement?1:0);
$return[$obj->rowid]=array('ref'=>$obj->facnumber,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot); $return[$obj->rowid]=array('ref'=>$obj->ref,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot);
} }
} }

View File

@ -193,7 +193,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '', 1); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end(); dol_fiche_end();

View File

@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';

View File

@ -107,7 +107,7 @@ $morehtmlref.='</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';

View File

@ -117,7 +117,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
// Security check // Security check
$fieldid = (! empty($ref)?'facnumber':'rowid'); $fieldid = (! empty($ref)?'ref':'rowid');
if (! empty($user->societe_id)) $socid=$user->societe_id; if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid); $result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
@ -138,7 +138,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
// List of fields to search into when doing a "search in all" // List of fields to search into when doing a "search in all"
$fieldstosearchall = array( $fieldstosearchall = array(
'f.facnumber'=>'Ref', 'f.ref'=>'Ref',
'f.ref_client'=>'RefCustomer', 'f.ref_client'=>'RefCustomer',
'pd.description'=>'Description', 'pd.description'=>'Description',
's.nom'=>"ThirdParty", 's.nom'=>"ThirdParty",
@ -148,7 +148,7 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
$checkedtypetiers=0; $checkedtypetiers=0;
$arrayfields=array( $arrayfields=array(
'f.facnumber'=>array('label'=>"Ref", 'checked'=>1), 'f.ref'=>array('label'=>"Ref", 'checked'=>1),
'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1), 'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
'f.type'=>array('label'=>"Type", 'checked'=>0), 'f.type'=>array('label'=>"Type", 'checked'=>0),
'f.date'=>array('label'=>"DateInvoice", 'checked'=>1), 'f.date'=>array('label'=>"DateInvoice", 'checked'=>1),
@ -354,11 +354,11 @@ $facturestatic=new Facture($db);
$formcompany=new FormCompany($db); $formcompany=new FormCompany($db);
$thirdpartystatic=new Societe($db); $thirdpartystatic=new Societe($db);
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes'); // llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
$sql = 'SELECT'; $sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as id, f.facnumber as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,'; $sql.= ' f.rowid as id, f.ref as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,'; $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,'; $sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,'; $sql.= ' f.paye as paye, f.fk_statut,';
@ -417,7 +417,7 @@ if ($filtre)
$sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1])); $sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1]));
} }
} }
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")"; if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")";
if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_project) $sql .= natural_search('p.ref', $search_project);
@ -491,7 +491,7 @@ $sql.=$hookmanager->resPrint;
if (! $sall) if (! $sall)
{ {
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,'; $sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' f.localtax1, f.localtax2,'; $sql.= ' f.localtax1, f.localtax2,';
$sql.= ' f.datef, f.date_lim_reglement,'; $sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,'; $sql.= ' f.paye, f.fk_statut,';
@ -532,15 +532,26 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
} }
$sql.= $db->plimit($limit+1,$offset); $sql.= $db->plimit($limit+1,$offset);
//print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->id;
header("Location: ".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$id);
exit;
}
llxHeader('',$langs->trans('CustomersInvoices'),'EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes');
if ($socid) if ($socid)
{ {
$soc = new Societe($db); $soc = new Societe($db);
@ -584,6 +595,7 @@ if ($resql)
$arrayofmassactions=array( $arrayofmassactions=array(
'validate'=>$langs->trans("Validate"), 'validate'=>$langs->trans("Validate"),
'generate_doc'=>$langs->trans("Generate"),
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"), 'builddoc'=>$langs->trans("PDFMerge"),
); );
@ -695,7 +707,7 @@ if ($resql)
// Filters lines // Filters lines
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
// Ref // Ref
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.ref']['checked']))
{ {
print '<td class="liste_titre" align="left">'; print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">'; print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
@ -867,7 +879,7 @@ if ($resql)
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'],$_SERVER['PHP_SELF'],'f.ref','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
@ -949,7 +961,7 @@ if ($resql)
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.ref']['checked']))
{ {
print '<td class="nowrap">'; print '<td class="nowrap">';

View File

@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -45,7 +46,7 @@ $ref=GETPOST('ref','alpha');
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$fieldid = (! empty($ref)?'facnumber':'rowid'); $fieldid = (! empty($ref)?'ref':'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
@ -208,7 +209,7 @@ if ($object->id > 0)
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', ''); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
@ -402,17 +403,17 @@ if ($object->id > 0)
if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
{ {
// Multicurrency Amount HT // Multicurrency Amount HT
print '<tr><td class="titlefieldmiddle">' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '</td>'; print '<tr><td class="titlefieldmiddle">' . $form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount VAT // Multicurrency Amount VAT
print '<tr><td>' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
// Multicurrency Amount TTC // Multicurrency Amount TTC
print '<tr><td>' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '</td>'; print '<tr><td>' . $form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0) . '</td>';
print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>'; print '<td class="nowrap">' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '</td>';
print '</tr>'; print '</tr>';
} }

View File

@ -136,7 +136,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
*/ */
if (! empty($conf->facture->enabled) && $user->rights->facture->lire) if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$sql = "SELECT f.facnumber"; $sql = "SELECT f.ref";
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client"; $sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
$sql.= ", f.type"; $sql.= ", f.type";
$sql.= ", s.nom as name"; $sql.= ", s.nom as name";
@ -177,7 +177,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber; $facturestatic->ref=$obj->ref;
$facturestatic->id=$obj->rowid; $facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht; $facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva; $facturestatic->total_tva=$obj->total_tva;
@ -320,7 +320,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$langs->load("boxes"); $langs->load("boxes");
$facstatic=new Facture($db); $facstatic=new Facture($db);
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms"; $sql = "SELECT f.rowid, f.ref, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql.= ", f.date_lim_reglement as datelimite"; $sql.= ", f.date_lim_reglement as datelimite";
$sql.= ", s.nom as name"; $sql.= ", s.nom as name";
$sql.= ", s.rowid as socid"; $sql.= ", s.rowid as socid";
@ -339,7 +339,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters); $reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters);
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; $sql.= " GROUP BY f.rowid, f.ref, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,"; $sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,";
$sql.= " cc.rowid, cc.code"; $sql.= " cc.rowid, cc.code";
$sql.= " ORDER BY f.tms DESC "; $sql.= " ORDER BY f.tms DESC ";
@ -365,7 +365,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber; $facturestatic->ref=$obj->ref;
$facturestatic->id=$obj->rowid; $facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht; $facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva; $facturestatic->total_tva=$obj->total_tva;
@ -399,8 +399,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
} }
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->facnumber); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';
@ -812,7 +812,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$facstatic=new Facture($db); $facstatic=new Facture($db);
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms"; $sql = "SELECT f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql.= ", f.date_lim_reglement as datelimite"; $sql.= ", f.date_lim_reglement as datelimite";
$sql.= ", s.nom as name"; $sql.= ", s.nom as name";
$sql.= ", s.rowid as socid, s.email"; $sql.= ", s.rowid as socid, s.email";
@ -831,9 +831,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters); $reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
$sql.=$hookmanager->resPrint; $sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; $sql.= " GROUP BY f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code"; $sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC"; $sql.= " ORDER BY f.datef ASC, f.ref ASC";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -858,7 +858,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber; $facturestatic->ref=$obj->ref;
$facturestatic->id=$obj->rowid; $facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht; $facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva; $facturestatic->total_tva=$obj->total_tva;
@ -891,8 +891,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
} }
print '</td>'; print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->facnumber); $filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid; $urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir); print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@ -100,7 +100,7 @@ report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY); $p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0]; $idpays = $p[0];
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,"; $sql = "SELECT f.rowid, f.ref, f.type, f.datef, f.ref_client,";
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2, fd.rowid as id, fd.situation_percent,"; $sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2, fd.rowid as id, fd.situation_percent,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,"; $sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
@ -180,7 +180,7 @@ if ($result)
//la ligne facture //la ligne facture
$tabfac[$obj->rowid]["date"] = $obj->datef; $tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber; $tabfac[$obj->rowid]["ref"] = $obj->ref;
$tabfac[$obj->rowid]["type"] = $obj->type; $tabfac[$obj->rowid]["type"] = $obj->type;
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc]=0; if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc]=0;
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod]=0; if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod]=0;

View File

@ -589,7 +589,7 @@ else
// Localtax // Localtax
print '<td class="nowrap" align="right">'; print '<td class="nowrap" align="right">';
$temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;; $temp_vat=($local==1?$fields['localtax1']:$fields['localtax2'])*$ratiopaymentinvoice;
print price(price2num($temp_vat,'MT'),1); print price(price2num($temp_vat,'MT'),1);
//print price($fields['vat']); //print price($fields['vat']);
print '</td>'; print '</td>';

View File

@ -525,7 +525,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
* List of unpaid invoices * List of unpaid invoices
*/ */
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,'; $sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
$sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr'; $sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')'; $sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')';
@ -550,7 +550,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
} }
// Sort invoices by date and serial number: the older one comes first // Sort invoices by date and serial number: the older one comes first
$sql.=' ORDER BY f.datef ASC, f.facnumber ASC'; $sql.=' ORDER BY f.datef ASC, f.ref ASC';
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -579,11 +579,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td>'.$arraytitle.'</td>'; print '<td>'.$arraytitle.'</td>';
print '<td align="center">'.$langs->trans('Date').'</td>'; print '<td align="center">'.$langs->trans('Date').'</td>';
print '<td align="center">'.$langs->trans('DateMaxPayment').'</td>'; print '<td align="center">'.$langs->trans('DateMaxPayment').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td>'.$langs->trans('Currency').'</td>'; if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>'; print '<td>'.$langs->trans('Currency').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>'; print '<td align="right">'.$langs->trans('MulticurrencyAmountTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$multicurrencyremaindertopay.'</td>'; print '<td align="right">'.$multicurrencyalreadypayedlabel.'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>'; print '<td align="right">'.$multicurrencyremaindertopay.'</td>';
print '<td align="right">'.$langs->trans('MulticurrencyPaymentAmount').'</td>';
}
print '<td align="right">'.$langs->trans('AmountTTC').'</td>'; print '<td align="right">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right">'.$alreadypayedlabel.'</td>'; print '<td align="right">'.$alreadypayedlabel.'</td>';
print '<td align="right">'.$remaindertopay.'</td>'; print '<td align="right">'.$remaindertopay.'</td>';
@ -612,8 +614,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
// Multicurrency Price // Multicurrency Price
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled)) {
{
$multicurrency_payment = $invoice->getSommePaiement(1); $multicurrency_payment = $invoice->getSommePaiement(1);
$multicurrency_creditnotes=$invoice->getSumCreditNotesUsed(1); $multicurrency_creditnotes=$invoice->getSumCreditNotesUsed(1);
$multicurrency_deposits=$invoice->getSumDepositsUsed(1); $multicurrency_deposits=$invoice->getSumDepositsUsed(1);
@ -630,25 +631,25 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Date // Date
print '<td align="center">'.dol_print_date($db->jdate($objp->df),'day')."</td>\n"; print '<td align="center">'.dol_print_date($db->jdate($objp->df),'day')."</td>\n";
// Date Max Payment // Date Max Payment
if ($objp->dlr > 0 ) if ($objp->dlr > 0 )
{ {
print '<td align="center">'; print '<td align="center">';
print dol_print_date($db->jdate($objp->dlr), 'day'); print dol_print_date($db->jdate($objp->dlr), 'day');
if ($invoice->hasDelay()) if ($invoice->hasDelay())
{ {
print img_warning($langs->trans('Late')); print img_warning($langs->trans('Late'));
} }
print '</td>'; print '</td>';
} }
else else
{ {
print '<td align="center"><b>--</b></td>'; print '<td align="center"><b>--</b></td>';
} }
// Currency // Currency
if (!empty($conf->multicurrency->enabled)) print '<td align="center">'.$objp->multicurrency_code."</td>\n"; if (!empty($conf->multicurrency->enabled)) print '<td align="center">'.$objp->multicurrency_code."</td>\n";
@ -760,11 +761,13 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Print total // Print total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>'; print '<td colspan="2" align="left">'.$langs->trans('TotalTTC').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; if (!empty($conf->multicurrency->enabled)) {
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td></td>'; print '<td></td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>'; print '<td></td>';
print '<td align="right" id="multicurrency_result" style="font-weight: bold;"></td>';
}
print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>'; print '<td align="right"><b>'.price($sign * $total_ttc).'</b></td>';
print '<td align="right"><b>'.price($sign * $totalrecu); print '<td align="right"><b>'.price($sign * $totalrecu);
if ($totalrecucreditnote) print '+'.price($totalrecucreditnote); if ($totalrecucreditnote) print '+'.price($totalrecucreditnote);
@ -841,7 +844,7 @@ if (! GETPOST('action','aZ09'))
if (! $sortorder) $sortorder='DESC'; if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='p.datep'; if (! $sortfield) $sortfield='p.datep';
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber'; $sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement'; $sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
$sql.= ', '.MAIN_DB_PREFIX.'facture as f'; $sql.= ', '.MAIN_DB_PREFIX.'facture as f';
@ -864,7 +867,7 @@ if (! GETPOST('action','aZ09'))
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder); print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'ref','','','',$sortfield,$sortorder);
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder); print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder); print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder); print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
@ -876,7 +879,7 @@ if (! GETPOST('action','aZ09'))
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->facnumber."</a></td>\n"; print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n"; print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n"; print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount).'</td><td>&nbsp;</td>'; print '<td align="right">'.price($objp->amount).'</td><td>&nbsp;</td>';

View File

@ -107,7 +107,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->
$db->begin(); $db->begin();
$object->fetch($id); $object->fetch($id);
if ($object->valide() > 0) if ($object->valide($user) > 0)
{ {
$db->commit(); $db->commit();
@ -157,7 +157,7 @@ if ($action == 'setnum_paiement' && ! empty($_POST['num_paiement']))
if ($action == 'setdatep' && ! empty($_POST['datepday'])) if ($action == 'setdatep' && ! empty($_POST['datepday']))
{ {
$object->fetch($id); $object->fetch($id);
$datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']); $datepaye = dol_mktime(GETPOST('datephour','int'), GETPOST('datepmin','int'), GETPOST('datepsec','int'), GETPOST('datepmonth','int'), GETPOST('datepday','int'), GETPOST('datepyear','int'));
$res = $object->update_date($datepaye); $res = $object->update_date($datepaye);
if ($res === 0) if ($res === 0)
{ {
@ -191,17 +191,13 @@ $head = payment_prepare_head($object);
dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment'); dol_fiche_head($head, 'payment', $langs->trans("PaymentCustomerInvoice"), -1, 'payment');
/* // Confirmation de la suppression du paiement
* Confirmation de la suppression du paiement
*/
if ($action == 'delete') if ($action == 'delete')
{ {
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2); print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
} }
/* // Confirmation de la validation du paiement
* Confirmation de la validation du paiement
*/
if ($action == 'valide') if ($action == 'valide')
{ {
$facid = $_GET['facid']; $facid = $_GET['facid'];
@ -220,7 +216,7 @@ print '<table class="border centpercent">'."\n";
// Date payment // Date payment
print '<tr><td class="titlefield">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td>'; print '<tr><td class="titlefield">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td>';
print $form->editfieldval("Date",'datep',$object->date,$object,$user->rights->facture->paiement,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded')); print $form->editfieldval("Date", 'datep', $object->date, $object,$user->rights->facture->paiement, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print '</td></tr>'; print '</td></tr>';
// Payment type (VIR, LIQ, ...) // Payment type (VIR, LIQ, ...)
@ -320,7 +316,7 @@ dol_fiche_end();
* List of invoices * List of invoices
*/ */
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid'; $sql = 'SELECT f.rowid as facid, f.ref, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' WHERE pf.fk_facture = f.rowid'; $sql.= ' WHERE pf.fk_facture = f.rowid';
$sql.= ' AND f.fk_soc = s.rowid'; $sql.= ' AND f.fk_soc = s.rowid';

View File

@ -862,9 +862,10 @@ class Paiement extends CommonObject
/** /**
* Validate payment * Validate payment
* *
* @return int <0 if KO, >0 if OK * @param User $user User making validation
* @return int <0 if KO, >0 if OK
*/ */
function valide() function valide(User $user=null)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id;
@ -885,9 +886,10 @@ class Paiement extends CommonObject
/** /**
* Reject payment * Reject payment
* *
* @return int <0 if KO, >0 if OK * @param User $user User making reject
* @return int <0 if KO, >0 if OK
*/ */
function reject() function reject(User $user=null)
{ {
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id;

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('bills', 'compta')); $langs->loadLangs(array('bills', 'compta', 'companies'));
// Security check // Security check
$facid = GETPOST('facid','int'); $facid = GETPOST('facid','int');
@ -75,6 +75,8 @@ if (! $sortfield) $sortfield="p.rowid";
$hookmanager->initHooks(array('paymentlist')); $hookmanager->initHooks(array('paymentlist'));
$extrafields = new ExtraFields($db); $extrafields = new ExtraFields($db);
$arrayfields=array();
/* /*
* Actions * Actions
@ -131,7 +133,7 @@ else
$sql.= " p.statut, p.num_paiement,"; $sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code,"; $sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.fk_accountancy_journal as accountancy_journal,";
$sql.= " s.rowid as socid, s.nom as name"; $sql.= " s.rowid as socid, s.nom as name, s.email";
// Add fields for extrafields // Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks // Add fields from hooks
@ -209,8 +211,8 @@ if ($resql)
$i = 0; $i = 0;
$param=''; $param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
$param.=(GETPOST("orphelins")?"&orphelins=1":""); $param.=(GETPOST("orphelins")?"&orphelins=1":"");
$param.=($search_ref?"&search_ref=".urlencode($search_ref):""); $param.=($search_ref?"&search_ref=".urlencode($search_ref):"");
$param.=($search_company?"&search_company=".urlencode($search_company):""); $param.=($search_company?"&search_company=".urlencode($search_company):"");
@ -296,23 +298,28 @@ if ($resql)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
$paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->ref;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
$paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->ref;
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
print '</td>'; print '</td>';
// Date // Date
print '<td align="center">'.dol_print_date($db->jdate($objp->dp),'day').'</td>'; $dateformatforpayment = 'day';
if (! empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment='dayhour';
print '<td align="center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment).'</td>';
// Thirdparty // Thirdparty
print '<td>'; print '<td>';
if ($objp->socid) if ($objp->socid > 0)
{ {
$companystatic->id=$objp->socid; $companystatic->id=$objp->socid;
$companystatic->name=$objp->name; $companystatic->name=$objp->name;
$companystatic->email=$objp->email;
print $companystatic->getNomUrl(1,'',24); print $companystatic->getNomUrl(1,'',24);
} }
else print '&nbsp;'; else print '&nbsp;';

View File

@ -1349,7 +1349,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum"; $sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " FROM"; $sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1488,12 +1488,12 @@ class BonPrelevement extends CommonObject
* @param string $rib_guichet code of bank office * @param string $rib_guichet code of bank office
* @param string $rib_number bank account * @param string $rib_number bank account
* @param float $amount amount * @param float $amount amount
* @param string $facnumber ref of invoice * @param string $ref ref of invoice
* @param int $facid id of invoice * @param int $facid id of invoice
* @param string $rib_dom rib domiciliation * @param string $rib_dom rib domiciliation
* @return void * @return void
*/ */
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='') function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom='')
{ {
// phpcs:enable // phpcs:enable
fputs($this->file, "06"); fputs($this->file, "06");
@ -1537,7 +1537,7 @@ class BonPrelevement extends CommonObject
// Libelle F // Libelle F
fputs($this->file, substr("*_".$facnumber."_RDVnet".$rowid." ", 0, 31)); fputs($this->file, substr("*_".$ref."_RDVnet".$rowid." ", 0, 31));
// Code etablissement G1 // Code etablissement G1
@ -1580,7 +1580,7 @@ class BonPrelevement extends CommonObject
* @param string $row_cg pl.code_guichet AS cg, Not used for SEPA * @param string $row_cg pl.code_guichet AS cg, Not used for SEPA
* @param string $row_cc pl.number AS cc, Not used for SEPA * @param string $row_cc pl.number AS cc, Not used for SEPA
* @param string $row_somme pl.amount AS somme, * @param string $row_somme pl.amount AS somme,
* @param string $row_facnumber f.facnumber * @param string $row_ref f.ref
* @param string $row_idfac pf.fk_facture AS idfac, * @param string $row_idfac pf.fk_facture AS idfac,
* @param string $row_iban rib.iban_prefix AS iban, * @param string $row_iban rib.iban_prefix AS iban,
* @param string $row_bic rib.bic AS bic, * @param string $row_bic rib.bic AS bic,
@ -1588,7 +1588,7 @@ class BonPrelevement extends CommonObject
* @param string $row_drum rib.rowid used to generate rum * @param string $row_drum rib.rowid used to generate rum
* @return string Return string with SEPA part DrctDbtTxInf * @return string Return string with SEPA part DrctDbtTxInf
*/ */
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
{ {
// phpcs:enable // phpcs:enable
$CrLf = "\n"; $CrLf = "\n";
@ -1604,8 +1604,8 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR =''; $XML_DEBITOR ='';
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
$XML_DEBITOR .=' <PmtId>'.$CrLf; $XML_DEBITOR .=' <PmtId>'.$CrLf;
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters // $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters $XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_ref,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' </PmtId>'.$CrLf; $XML_DEBITOR .=' </PmtId>'.$CrLf;
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; $XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf; $XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
@ -1636,9 +1636,9 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' </Id>'.$CrLf; $XML_DEBITOR .=' </Id>'.$CrLf;
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf; $XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
$XML_DEBITOR .=' <RmtInf>'.$CrLf; $XML_DEBITOR .=' <RmtInf>'.$CrLf;
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf; // $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max // $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).'</Ustrd>'.$CrLf; // 140 max $XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_ref, 135) ).'</Ustrd>'.$CrLf; // 140 max
$XML_DEBITOR .=' </RmtInf>'.$CrLf; $XML_DEBITOR .=' </RmtInf>'.$CrLf;
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf; $XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
return $XML_DEBITOR; return $XML_DEBITOR;

View File

@ -188,7 +188,7 @@ print '<br>';
* Invoices waiting for withdraw * Invoices waiting for withdraw
*/ */
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,"; $sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande, pfd.amount"; $sql.= " pfd.date_demande, pfd.amount";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."societe as s,";
@ -249,7 +249,7 @@ if ($resql)
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'; print '<td>';
$invoicestatic->id=$obj->rowid; $invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber; $invoicestatic->ref=$obj->ref;
print $invoicestatic->getNomUrl(1,'withdraw'); print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>'; print '</td>';
// Thirdparty // Thirdparty

View File

@ -52,7 +52,7 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.facnumber"; if (! $sortfield) $sortfield="f.ref";
/* /*
@ -66,7 +66,7 @@ $invoicestatic=new Facture($db);
// List of requests // List of requests
$sql= "SELECT f.facnumber, f.rowid, f.total_ttc,"; $sql= "SELECT f.ref, f.rowid, f.total_ttc,";
$sql.= " s.nom as name, s.rowid as socid,"; $sql.= " s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande as date_demande,"; $sql.= " pfd.date_demande as date_demande,";
$sql.= " pfd.fk_user_demande"; $sql.= " pfd.fk_user_demande";
@ -138,7 +138,7 @@ if ($resql)
// Ref facture // Ref facture
print '<td>'; print '<td>';
$invoicestatic->id=$obj->rowid; $invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber; $invoicestatic->ref=$obj->ref;
print $invoicestatic->getNomUrl(1,'withdraw'); print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>'; print '</td>';

View File

@ -144,7 +144,7 @@ if ($prev_id > 0 || $ref)
// List of invoices // List of invoices
$sql = "SELECT pf.rowid,"; $sql = "SELECT pf.rowid,";
$sql.= " f.rowid as facid, f.facnumber as ref, f.total_ttc,"; $sql.= " f.rowid as facid, f.ref as ref, f.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested"; $sql.= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";

View File

@ -91,7 +91,7 @@ print '</td></tr></table><br>';
/* /*
* Invoices waiting for withdraw * Invoices waiting for withdraw
*/ */
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql.= " pfd.date_demande, pfd.amount,"; $sql.= " pfd.date_demande, pfd.amount,";
$sql.= " s.nom as name, s.rowid as socid"; $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
@ -120,7 +120,7 @@ if ($resql)
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$invoicestatic->id=$obj->rowid; $invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber; $invoicestatic->ref=$obj->ref;
$invoicestatic->statut=$obj->fk_statut; $invoicestatic->statut=$obj->fk_statut;
$invoicestatic->paye=$obj->paye; $invoicestatic->paye=$obj->paye;
$invoicestatic->type=$obj->type; $invoicestatic->type=$obj->type;

View File

@ -261,7 +261,7 @@ if ($id)
* List of invoices * List of invoices
*/ */
$sql = "SELECT pf.rowid"; $sql = "SELECT pf.rowid";
$sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut"; $sql.= " ,f.rowid as facid, f.ref as ref, f.total_ttc, f.paye, f.fk_statut";
$sql.= " , s.rowid as socid, s.nom as name"; $sql.= " , s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";

View File

@ -82,7 +82,7 @@ $form=new Form($db);
llxHeader('',$langs->trans("WithdrawalsLines")); llxHeader('',$langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut, p.datec"; $sql = "SELECT p.rowid, p.ref, p.statut, p.datec";
$sql.= " ,f.rowid as facid, f.facnumber, f.total_ttc"; $sql.= " ,f.rowid as facid, f.ref, f.total_ttc";
$sql.= " , s.rowid as socid, s.nom as name, s.code_client"; $sql.= " , s.rowid as socid, s.nom as name, s.code_client";
$sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
@ -155,7 +155,7 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre("Line",$_SERVER["PHP_SELF"]); print_liste_field_titre("Line",$_SERVER["PHP_SELF"]);
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref"); print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd); print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"f.ref",'',$urladd);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom"); print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom");
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"'); print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"');
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'align="center"'); print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'align="center"');
@ -185,7 +185,7 @@ if ($result)
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'; print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"),"bill"); print img_object($langs->trans("ShowBill"),"bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->facnumber."</a></td>\n"; print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
print '</a></td>'; print '</a></td>';
print '<td><a href="card.php?id='.$obj->rowid.'">'.$obj->name."</a></td>\n"; print '<td><a href="card.php?id='.$obj->rowid.'">'.$obj->name."</a></td>\n";

View File

@ -117,7 +117,7 @@ if ($id > 0)
$TData = array(); $TData = array();
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,"; $sql = "SELECT s.nom, s.rowid as socid, f.ref, f.amount, f.datef as df,";
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,"; $sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " u.login, u.rowid as userid"; $sql.= " u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";

View File

@ -303,7 +303,7 @@ if ($modecompta == 'BOOKKEEPING')
foreach($cpts as $i => $cpt) foreach($cpts as $i => $cpt)
{ {
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']); $return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']);
if ($return < 0) { if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors'); setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0; $resultN=0;

View File

@ -78,7 +78,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
{ {
// We define date_start and date_end // We define date_start and date_end
$year_end=$year_start + ($nbofyear - 1); $year_end=$year_start + ($nbofyear - 1);
$month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1); $month_start=GETPOST("month",'int')?GETPOST("month",'int'):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
$date_startmonth = $month_start; $date_startmonth = $month_start;
if (! GETPOST('month')) if (! GETPOST('month'))
{ {
@ -108,8 +108,10 @@ if (($date_start < dol_time_plus_duree($date_end, -1, 'y')) || ($date_start > $d
// $date_start and $date_end are defined. We force $start_year and $nbofyear // $date_start and $date_end are defined. We force $start_year and $nbofyear
$tmps=dol_getdate($date_start); $tmps=dol_getdate($date_start);
$start_year = $tmps['year']; $start_year = $tmps['year'];
$start_month = $tmps['mon'];
$tmpe=dol_getdate($date_end); $tmpe=dol_getdate($date_end);
$year_end = $tmpe['year']; $year_end = $tmpe['year'];
$month_end = $tmpe['mon'];
$nbofyear = ($year_end - $start_year) + 1; $nbofyear = ($year_end - $start_year) + 1;
$date_start_previous = dol_time_plus_duree($date_start, -1, 'y'); $date_start_previous = dol_time_plus_duree($date_start, -1, 'y');
@ -231,13 +233,13 @@ print '<th class="liste_titre" align="right">'.$langs->trans("SelectedPeriod").'
foreach($months as $k => $v){ foreach($months as $k => $v){
if (($k+1) >= $date_startmonth) if (($k+1) >= $date_startmonth)
{ {
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>'; print '<th class="liste_titre width50" align="right" >'.$langs->trans('MonthShort'.sprintf("%02s",($k+1))).'</th>';
} }
} }
foreach($months as $k => $v){ foreach($months as $k => $v){
if (($k+1) < $date_startmonth) if (($k+1) < $date_startmonth)
{ {
print '<th class="liste_titre width50" align="right" >'.$langs->trans($v).'</th>'; print '<th class="liste_titre width50" align="right" >'.$langs->trans('MonthShort'.sprintf("%02s",($k+1))).'</th>';
} }
} }
print '</tr>'; print '</tr>';
@ -374,13 +376,14 @@ elseif ($modecompta=="BOOKKEEPING")
} }
} }
print "</tr>\n"; print "</tr>\n";
//var_dump($sommes); //var_dump($sommes);
} }
else // normal category else // normal category
{ {
$code = $cat['code']; // Category code we process
$totCat = array(); $totCat = array();
$totCat['NP'] = 0; $totCat['NP'] = 0;
$totCat['N'] = 0; $totCat['N'] = 0;
@ -390,9 +393,73 @@ elseif ($modecompta=="BOOKKEEPING")
$totCat['M'][$k] = 0; $totCat['M'][$k] = 0;
} }
// Set $cpts of with array of accounts in the category/group // Set $cpts with array of accounts in the category/group
$cpts = $AccCat->getCptsCat($cat['rowid']); $cpts = $AccCat->getCptsCat($cat['rowid']);
$arrayofaccountforfilter=array();
foreach($cpts as $i => $cpt) // Loop on each account.
{
$arrayofaccountforfilter[]=$cpt['account_number'];
}
// N-1
if (! empty($arrayofaccountforfilter))
{
$return = $AccCat->getSumDebitCredit($arrayofaccountforfilter, $date_start_previous, $date_end_previous, $cpt['dc']?$cpt['dc']:0);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
foreach($cpts as $i => $cpt) // Loop on each account.
{
$resultNP = empty($AccCat->sdcperaccount[$cpt['account_number']])?0:$AccCat->sdcperaccount[$cpt['account_number']];
$totCat['NP'] += $resultNP;
$sommes[$code]['NP'] += $resultNP;
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
}
}
}
// Set value into column N and month M ($totCat)
// This make 12 calls for each accountancy account (12 monthes M)
foreach($cpts as $i => $cpt) // Loop on each account.
{
// We make 1 loop for each account because we may want detail per account.
// @TODO Optimize to ask a 'group by' account and a filter with account in (..., ...) in request
// Each month
$resultN = 0;
foreach($months as $k => $v)
{
$monthtoprocess = $k+1; // ($k+1) is month 1, 2, ..., 12
$yeartoprocess = $start_year;
if (($k+1) < $start_month) $yeartoprocess++;
//var_dump($monthtoprocess.'_'.$yeartoprocess);
$return = $AccCat->getSumDebitCredit($cpt['account_number'], $date_start, $date_end, $cpt['dc']?$cpt['dc']:0, 'nofilter', $monthtoprocess, $yeartoprocess);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
$resultN += $resultM;
}
$totCat['N'] += $resultN;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
}
// Now output columns for row $code ('VTE', 'MAR', ...)
print "<tr>"; print "<tr>";
// Column group // Column group
@ -426,54 +493,6 @@ elseif ($modecompta=="BOOKKEEPING")
} }
print '</td>'; print '</td>';
$code = $cat['code'];
// Set value into column NPrevious, N and each month M ($totCat)
// This make 14 calls for each detail of account (NP, N and month m)
foreach($cpts as $i => $cpt)
{
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start_previous, $date_end_previous, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
$sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN;
$totPerAccount[$cpt['account_number']]['NP'] = $resultNP;
$totPerAccount[$cpt['account_number']]['N'] = $resultN;
foreach($months as $k => $v)
{
$return = $AccCat->getResult($cpt['account_number'], $k+1, $date_start, $date_end, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
$sommes[$code]['M'][$k] += $resultM;
$totPerAccount[$cpt['account_number']]['M'][$k] = $resultM;
}
}
// Now output columns for row $code ('VTE', 'MAR', ...)
print '<td align="right">' . price($totCat['NP']) . '</td>'; print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>'; print '<td align="right">' . price($totCat['N']) . '</td>';
@ -487,8 +506,7 @@ elseif ($modecompta=="BOOKKEEPING")
print "</tr>\n"; print "</tr>\n";
// Loop on detail of all accounts // Loop on detail of all accounts to output the detail
// This make 14 calls for each detail of account (NP, N and month m)
if ($showaccountdetail != 'no') if ($showaccountdetail != 'no')
{ {
foreach($cpts as $i => $cpt) foreach($cpts as $i => $cpt)
@ -525,7 +543,6 @@ elseif ($modecompta=="BOOKKEEPING")
print '<td align="right">' . price($resultM) . '</td>'; print '<td align="right">' . price($resultM) . '</td>';
} }
} }
print "</tr>\n"; print "</tr>\n";
} }
} }

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2011-2018 Alexandre Spangaro <aspangaro@zendsi.com> /* Copyright (C) 2011-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com> * Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -63,7 +63,7 @@ $hookmanager->initHooks(array('salarycard','globalcard'));
if ($cancel) if ($cancel)
{ {
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
@ -139,7 +139,7 @@ if ($action == 'add' && empty($cancel))
if ($ret > 0) if ($ret > 0)
{ {
$db->commit(); $db->commit();
header("Location: index.php"); header("Location: list.php");
exit; exit;
} }
else else
@ -255,44 +255,44 @@ if ($action == 'create')
// Date payment // Date payment
print '<tr><td>'; print '<tr><td>';
print fieldLabel('DatePayment','datep',1).'</td><td>'; print $form->editfieldkey('DatePayment', 'datep', '', $object, 0, 'string', '', 1).'</td><td>';
print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1); print $form->selectDate((empty($datep)?-1:$datep), "datep", '', '', '', 'add', 1, 1);
print '</td></tr>'; print '</td></tr>';
// Date value for bank // Date value for bank
print '<tr><td>'; print '<tr><td>';
print fieldLabel('DateValue','datev',0).'</td><td>'; print $form->editfieldkey('DateValue', 'datev', '', $object, 0).'</td><td>';
print $form->selectDate((empty($datev)?-1:$datev), "datev", '', '', '', 'add', 1, 1); print $form->selectDate((empty($datev)?-1:$datev), "datev", '', '', '', 'add', 1, 1);
print '</td></tr>'; print '</td></tr>';
// Employee // Employee
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Employee','fk_user',1).'</td><td>'; print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).'</td><td>';
$noactive=0; // We keep active and unactive users $noactive=0; // We keep active and unactive users
print $form->select_dolusers(GETPOST('fk_user','int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); print $form->select_dolusers(GETPOST('fk_user','int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive);
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Label','label',1).'</td><td>'; print $form->editfieldkey('Label', 'label', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="label" id="label" class="minwidth300" value="'.(GETPOST("label")?GETPOST("label"):$langs->trans("SalaryPayment")).'">'; print '<input name="label" id="label" class="minwidth300" value="'.(GETPOST("label")?GETPOST("label"):$langs->trans("SalaryPayment")).'">';
print '</td></tr>'; print '</td></tr>';
// Date start period // Date start period
print '<tr><td>'; print '<tr><td>';
print fieldLabel('DateStartPeriod','datesp',1).'</td><td>'; print $form->editfieldkey('DateStartPeriod', 'datesp', '', $object, 0, 'string', '', 1).'</td><td>';
print $form->selectDate($datesp, "datesp", '', '', '', 'add'); print $form->selectDate($datesp, "datesp", '', '', '', 'add');
print '</td></tr>'; print '</td></tr>';
// Date end period // Date end period
print '<tr><td>'; print '<tr><td>';
print fieldLabel('DateEndPeriod','dateep',1).'</td><td>'; print $form->editfieldkey('DateEndPeriod', 'dateep', '', $object, 0, 'string', '', 1).'</td><td>';
print $form->selectDate($dateep, "dateep", '', '', '', 'add'); print $form->selectDate($dateep, "dateep", '', '', '', 'add');
print '</td></tr>'; print '</td></tr>';
// Amount // Amount
print '<tr><td>'; print '<tr><td>';
print fieldLabel('Amount','amount',1).'</td><td>'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
print '<input name="amount" id="amount" class="minwidth100" value="'.GETPOST("amount").'">'; print '<input name="amount" id="amount" class="minwidth100" value="'.GETPOST("amount").'">';
print '</td></tr>'; print '</td></tr>';
@ -312,14 +312,14 @@ if ($action == 'create')
if (! empty($conf->banque->enabled)) if (! empty($conf->banque->enabled))
{ {
print '<tr><td>'; print '<tr><td>';
print fieldLabel('BankAccount','selectaccountid',1).'</td><td>'; print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant $form->select_comptes($_POST["accountid"],"accountid",0,'',1); // Affiche liste des comptes courant
print '</td></tr>'; print '</td></tr>';
} }
// Type payment // Type payment
print '<tr><td>'; print '<tr><td>';
print fieldLabel('PaymentMode','selectpaymenttype',1).'</td><td>'; print $form->editfieldkey('PaymentMode', 'selectpaymenttype', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2); $form->select_types_paiements(GETPOST("paymenttype"), "paymenttype", '', 2);
print '</td></tr>'; print '</td></tr>';

View File

@ -187,7 +187,7 @@ $head[$h][1] = $langs->trans("ByMonthYear");
$head[$h][2] = 'byyear'; $head[$h][2] = 'byyear';
$h++; $h++;
complete_head_from_modules($conf,$langs,null,$head,$h,'trip_stats'); complete_head_from_modules($conf,$langs,null,$head,$h,'salaries_stats');
dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1); dol_fiche_head($head, 'byyear', $langs->trans("Statistics"), -1);
@ -197,7 +197,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Show filter box // Show filter box
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<table class="border" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>'; print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// User // User
print '<tr><td>'.$langs->trans("User").'</td><td>'; print '<tr><td>'.$langs->trans("User").'</td><td>';
@ -215,8 +215,8 @@ print '</form>';
print '<br><br>'; print '<br><br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="border" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr>'; print '<tr class="liste_titre" height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>'; print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="right">'.$langs->trans("Number").'</td>'; print '<td align="right">'.$langs->trans("Number").'</td>';
print '<td align="right">'.$langs->trans("AmountTotal").'</td>'; print '<td align="right">'.$langs->trans("AmountTotal").'</td>';
@ -231,14 +231,16 @@ foreach ($data as $val)
{ {
// If we have empty year // If we have empty year
$oldyear--; $oldyear--;
print '<tr height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'">'.$oldyear.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$oldyear.'">'.$oldyear.'</a></td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '<td align="right">0</td>'; print '<td align="right">0</td>';
print '</tr>'; print '</tr>';
} }
print '<tr height="24">';
print '<tr class="oddeven" height="24">';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a></td>'; print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.'">'.$year.'</a></td>';
print '<td align="right">'.$val['nb'].'</td>'; print '<td align="right">'.$val['nb'].'</td>';
print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>'; print '<td align="right">'.price(price2num($val['total'],'MT'),1).'</td>';

View File

@ -541,14 +541,14 @@ print '</div>';
// Factures non reglees // Factures non reglees
// Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees ! // Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees !
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am"; $sql = "SELECT f.ref, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
$sql .= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1"; $sql .= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
if ($socid) if ($socid)
{ {
$sql .= " AND f.fk_soc = $socid"; $sql .= " AND f.fk_soc = $socid";
} }
$sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.rowid, f.total_ttc"; $sql .= " GROUP BY f.ref,f.rowid,s.nom, s.rowid, f.total_ttc";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

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