Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop

This commit is contained in:
fappels
2017-08-21 11:05:49 +02:00
1282 changed files with 20336 additions and 10220 deletions

View File

@@ -1,16 +0,0 @@
build
build.xml
ChangeLog
composer.json
CONTRIBUTING.md
COPYING
COPYRIGHT
dev
doc
Dockerfile
INSTALL
README-FR.md
README.md
robots.txt
scripts
test

128
ChangeLog
View File

@@ -2,12 +2,134 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 7.0.0 compared to 6.0.* *****
***** ChangeLog for 6.0.0 compared to 5.0.* *****
NEW: Add experimental BlockeLog module (to log business events in a non reversible log file).
NEW: Add a payment module for Stripe.
NEW: Add module "Product variant" (like red, blue for the product shoes)
NEW: Accountancy - Activate multi-journal & Add journal_label to database (FEC)
NEW: Add a tracking id into mass emailing.
NEW: Tax system more compatible with the new tax roollout in India (IGST / CGST / SGST).
NEW: Add calculation function for Loan schedule
NEW: Add "depends on" and "required by" into module informations
NEW: Add hidden option THIRDPARTY_INCLUDE_PARENT_IN_LINKTO
NEW: Add key __USERID__ and __ENTITYID__ as key for dynamic filters.
NEW: Add last activation author and ip of modules
NEW: Add mass actions (pdf merge and delete) for interventions
NEW: Add module resources import/export
NEW: Add option PROJECT_THIRDPARTY_REQUIRED
NEW: Add page statistics for project tasks
NEW: add property to show warnings when activating modules
NEW: add rapport file for supplier paiement
NEW: Add statistics on supplier tab.
NEW: Add tooltip help on shipment weight and volume calculation
NEW: An external module can hook and add mass actions.
NEW: Better reponsive design
NEW: Bookmarks are into a combo list.
NEW: Bulk actions available on supplier orders
NEW: Can add a background image on login page
NEW: Can change customer from POS
NEW: Can clone expense report on another user
NEW: Can control constants values into file integrity checker
NEW: Can define default values for create forms.
NEW: Can define default filters for list pages.
NEW: Can define default sort order for list pages.
NEW: Can deploy an external module from the module setup area.
NEW: Can disable all overwrote translations in one click.
NEW: Can edit background color for odd and even lines in tables
NEW: Can filter on code in dictionnaries
NEW: Can filter on year and product tags on the product statistic page
NEW: Can import users
NEW: Can read time spent of others (hierarchy only or all if granted)
NEW: Can send an email to a user from its card.
NEW: Can send email to multiple destinaries from the mailform combo list.
NEW: Can set margins of PDFs
NEW: Can set number of dump to keep with job "local database backup"
NEW: Can sort customer balance summary on date.
NEW: Can sort thumbs visible on product card.
NEW: Can use a credit note into a "down payment/deposit".
NEW: Can use dol_fiche_end without showing bottom border.
NEW: Can use translations into all substitutions (watermark, freetext...)
NEW: Change to allow a specific numbering rule for invoice with POS module.
NEW: convert exceiss received to reduc
NEW: custom dir is enabled dy default on first install.
NEW: Description of feature of a module visible into a dedicated popup.
NEW: Direct open of card after a search if one record only found.
NEW: download button
NEW: Enable bulk actions delete on supplier invoices.
NEW: Extrafields support formulas to be computed using PHP expressions.
NEW: Feature to crop/resize images available on user and expense reports.
NEW: Filechecker can include custom dir and report added files.
NEW: fix listview class and add a demo for product list
NEW: [FP17] Accountancy - Add select field in list of accounts
NEW: get amount base on hourly rate for ficheinter
NEW: hidden Easter egg to display commitstrip strip on login page
NEW: Include an hourglass icon when we click on online payment button
NEW: Index upload files into database.
NEW: Introduce mass action on product list ('delete' for the moment)
NEW: Introduce mass actions on contacts
NEW: Introduce option MAIN_HTTP_CONTENT_SECURITY_POLICY
NEW: It's easier to switch between sandbox and live for paypal
NEW: Mass action delete available on project and tasks
NEW: Move login information on home page into a widget
NEW: new demo entry page
NEW: No external check of version without explicit click in about page.
NEW: ODT docs for USER USERGROUP CONTRACT and PRODUCT class
NEW: odt usergroup
NEW: On invoices generated by template, we save if invoice come from a source template.
NEW: option to copy into attachement files of events, files send by mail (with auto event creation)
NEW: PDF with numbertoword
NEW: Permit multiple file upload in linked documents
NEW: PHP 7.1 compatibility
NEW: Reduce memory usage by removing deprecated constant loading.
NEW: Report page and menu for suppliers paiements
NEW: Show by default README.md file found into root dir of ext module.
NEW: Show company into combo list of projects
NEW: show files in the bank statement + download
NEW: Show local taxes in facture list
NEW: Show local taxes in supplier facture list
NEW: Small PDF template for products
NEW: Option SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT
NEW: The substitution keys available for emailing edition are now visible into a popup.
NEW: Uniformize behaviour: Action to make order is an action button.
NEW: Use autocompletion on the "Add widget list".
NEW: Use html5 type "number" on select field for year and duration.
NEW: Can use pdktk to concat mass pdf because tcpdf generate avoid to split large file into multiple smaller file (all have same size) encounter issue with mailer provider virtual delivery service
NEW: Default theme of v6 is cleaner.
NEW: When down payment is entered, discount to reuse into final invoice is automatically created. This save one click into invoice workflow.
NEW: Add UI to configure MEMBER_NEWFORM_FORCETYPE
NEW: #2763 Go to document block after clicking in Generate document button
NEW: #6280: Generate PDF after creating an invoice from a customer order
NEW: #6915 Simplest change.
NEW: Uniformize the look and feel with v6 new look.
For developers:
NEW: Add a lot of API REST: dictionaryevents, memberstypes, ...
NEW: Big refactorization of multicompany transverse mode.
NEW: getEntity function use true $shared value by default.
NEW: Add font-awesome css.
NEW: Add function ajax_autoselect
NEW: Add function dolMd2Html
NEW: Add hook doUpgrade2
NEW: Add hook "formatNotificationMessage"
NEW: Add index and constraints keys on supplier proposal detail table
NEW: Add phpunit to check the engine is defined into sql create files.
NEW: Add project and Hook to Loan
NEW: Add REST API to push a file.
NEW: Allow extrafields list select to be dependands on other standard list and not only other extrafields list
NEW: Architecture to manage search criteria persistance (using save_lastsearch_values=1 on exit links and restore_lastsearch_values=1 in entry links)
NEW: data files are now also parsed by phpunit for sql syntax
NEW: Hook to allow inserting custom product head #6001
NEW: Introduce fields that can be computed during export in export profiles.
NEW: Introduce function dol_compress_dir
NEW: Removed commande_pdf_create, contract_pdf_create,expedition_pdf_create, facture_pdf_create, delivery_order_pdf_create, task_pdf_create, project_pdf_create, propale_pdf_create, supplier_invoice_pdf_create, supplier_order_pdf_create, supplier_proposal_pdf_create deprecated functions
NEW: tooltip can be on hover or on click with textwithpicto function.
NEW: Upgrade jquery to 3.3.1 and jquery-ui to 1.12
WARNING:
@@ -25,8 +147,12 @@ Following changes may create regression for some external modules, but were nece
* Removed Societe::set_commnucation_level (was deprecated in 4.0). Was not used.
* Removed the trigger file of PAYPAL module that stored data that was not used by Dolibarr. The trigger event still
exists, but if an external module need action on it, it must provides itself its trigger file.
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode
* Use $conf->global->MULTICOMPANY_TRANSVERSE_MODE instead $conf->multicompany->transverse_mode. So, if you set var
$multicompany_transverse_mode to 1 into your conf file, you must remove this line and a new key into
the Home - setup - other admin page.
* Use getEntity('xxx') instead getEntity('xxx', 1) and use getEntity('xxx', 0) instead getEntity('xxx')
* Some other change were done in the way we read permission of a user when module multicompany is enabled. You can
retreive the old behavior by adding constant MULTICOMPANY_BACKWARD_COMPATIBILITY to 1.
* The hook formObjectOptions was not implemented correctly in previous version. Sometimes, you had to return output
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint".

View File

@@ -0,0 +1,3 @@
Dockerfile
README.md
docker-compose.yml

View File

@@ -1,4 +1,7 @@
FROM php:5.6-apache
FROM php:7.0-apache
ENV HOST_USER_ID 33
ENV PHP_INI_DATE_TIMEZONE 'UTC'
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
&& rm -rf /var/lib/apt/lists/* \
@@ -9,11 +12,9 @@ RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libldap2-dev \
&& docker-php-ext-install mysqli \
&& apt-get purge -y libpng12-dev libjpeg-dev libldap2-dev
COPY htdocs/ /var/www/html/
RUN chown -hR www-data:www-data /var/www/html
VOLUME /var/www/html/conf
VOLUME /var/www/html/documents
COPY docker-run.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-run.sh
EXPOSE 80
ENTRYPOINT ["docker-run.sh"]

25
build/docker/README.md Normal file
View File

@@ -0,0 +1,25 @@
# How to use it ?
The docker-compose.yml file is used to build and run Dolibarr in the current workspace.
Before build/run, define the variable HOST_USER_ID as following:
export HOST_USER_ID=$(id -u)
Go in repository build/docker :
cd build/docker
And then, you can run :
docker-compose up
This will run 3 container Docker : Dolibarr, MariaDB and PhpMyAdmin.
The URL to go to the Dolibarr is :
http://0.0.0.0
The URL to go to PhpMyAdmin is (login/password is root/root) :
http://0.0.0.0:8080

View File

@@ -0,0 +1,25 @@
mariadb:
image: mariadb:latest
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: dolibarr
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
PMA_HOST: mariadb
links:
- mariadb
ports:
- "8080:80"
web:
build: .
environment:
HOST_USER_ID: $HOST_USER_ID
volumes:
- ../../htdocs:/var/www/html
links:
- mariadb
ports:
- "80:80"

View File

@@ -0,0 +1,15 @@
#!/bin/bash
usermod -u $HOST_USER_ID www-data
groupmod -g $HOST_USER_ID www-data
chown -hR www-data:www-data /var/www
if [ ! -f /usr/local/etc/php/php.ini ]; then
cat <<EOF > /usr/local/etc/php/php.ini
date.timezone = $PHP_INI_DATE_TIMEZONE
display_errors = On
EOF
fi
exec apache2-foreground

View File

@@ -353,10 +353,12 @@ begin
begin
// TODO Copy file or ask to install package ?
//CustomMessage('YouWillInstallDoliWamp')+#13#13
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://ccc">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
MsgBox('The package vcredist_x86.exe must have been installed first. It seems it is not. Please install it first from <a href="http://www.microsoft.com/en-us/download/details.aspx?id=30679">http://www.microsoft.com/en-us/download/details.aspx?id=30679</a> then restart DoliWamp installation/upgrade.',mbInformation,MB_OK);
end;
// Pb seems similar with msvcp110.dll
//vcredist_x64.exe
// If we have a new database version, we should only copy old my.ini file into new directory
// and change only all basedir= strings to use new version. Like this, data dir is still correct.
// Install of service and stop/start scripts are already rebuild by installer.

View File

@@ -592,6 +592,8 @@ if ($nboftargetok) {
print "Remove subdir of custom dir\n";
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\;\n";
$ret=`find $BUILDROOT/$PROJECT/htdocs/custom/* -type d -exec rm -fr {} \\; >/dev/null 2>&1`; # For custom we want to remove all subdirs but not files
print "find $BUILDROOT/$PROJECT/htdocs/custom/* -type l -exec rm -fr {} \\;\n";
$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
}
# Build package for each target
@@ -972,9 +974,11 @@ if ($nboftargetok) {
$ret=`$cmd`;
$ret=`chmod 755 $BUILDROOT/$PROJECT.tmp/debian/rules`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/dev/translation/autotranslator.class.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/actions_mymodule.class.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/api_myobject.class.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject.class.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/class/myobject_api_class.class.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/core/modules/modMyModule.class.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/mymoduleindex.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_card.php`;
$ret=`chmod -R 644 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/myobject_list.php`;
$ret=`chmod -R 755 $BUILDROOT/$PROJECT.tmp/htdocs/modulebuilder/template/scripts/myobject.php`;

View File

@@ -162,6 +162,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories

View File

@@ -242,6 +242,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories

View File

@@ -159,6 +159,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories

View File

@@ -170,6 +170,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/blockedlog
%_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories

View File

@@ -1 +1,4 @@
http://www.taxrates.cc/index.html
http://www.taxrates.cc/index.html
For India: VAT=IGST/CGST=Localtax1/SGST=Localtax2: https://cleartax.in/s/what-is-sgst-cgst-igst

View File

@@ -25,7 +25,7 @@ $path=dirname(__FILE__).'/';
$web=0;
// Test if batch mode
if (substr($sapi_type, 0, 3) == 'cgi')
if (substr($sapi_type, 0, 3) == 'cgi')
{
$web=1;
}
@@ -35,9 +35,9 @@ if ($web)
{
echo "<html>";
echo "<head>";
echo "<STYLE type=\"text/css\">
table {
background: #f5f5f5;
border-collapse: separate;
@@ -48,7 +48,7 @@ if ($web)
text-align: left;
width: 800px;
}
th {
background-color: #777;
border-left: 1px solid #555;
@@ -61,7 +61,7 @@ if ($web)
position: relative;
text-shadow: 0 1px 0 #000;
}
td {
border-right: 1px solid #fff;
border-left: 1px solid #e8e8e8;
@@ -70,19 +70,19 @@ if ($web)
padding: 10px 15px;
position: relative;
}
tr {
background-color: #f1f1f1;
}
tr:nth-child(odd) td {
background-color: #f1f1f1;
}
</STYLE>";
echo "<body>";
}
@@ -142,9 +142,9 @@ foreach ($files AS $file) {
}
}
foreach ($langstrings_3d AS $filename => $file)
foreach ($langstrings_3d AS $filename => $file)
{
foreach ($file AS $linenum => $value)
foreach ($file AS $linenum => $value)
{
$keys = array_keys($langstrings_full, $value);
if (count($keys)>1)
@@ -173,11 +173,11 @@ $sininstallandadmin='';
$sother='';
$count = 0;
foreach ($dups as $string => $pages)
foreach ($dups as $string => $pages)
{
$count++;
$s='';
// Keyword $string
if ($web) $s.="<tr>";
if ($web) $s.="<td align=\"center\">";
@@ -188,32 +188,32 @@ foreach ($dups as $string => $pages)
if ($web) $s.="</td>";
if ($web) $s.="<td>";
if (! $web) $s.= ' : ';
// Loop on each files keyword was found
$duplicateinsamefile=0;
$inmain=0;
$inadmin=0;
foreach ($pages AS $file => $lines)
foreach ($pages AS $file => $lines)
{
if ($file == 'main.lang') { $inmain=1; $inadmin=0; }
if ($file == 'admin.lang' && ! $inmain) { $inadmin=1; }
$s.=$file." ";
// Loop on each line keword was found into file.
$listoffilesforthisentry=array();
foreach ($lines as $line => $translatedvalue)
foreach ($lines as $line => $translatedvalue)
{
if (! empty($listoffilesforthisentry[$file])) $duplicateinsamefile=1;
$listoffilesforthisentry[$file]=1;
$s.= "(".$line." - ".htmlentities($translatedvalue).") ";
}
if ($web) $s.="<br>";
}
if ($web) $s.="</td></tr>";
$s.="\n";
if ($duplicateinsamefile) $sduplicateinsamefile .= $s;
else if ($inmain) $sinmainandother .= $s;
else if ($inadmin) $sininstallandadmin .= $s;
@@ -252,7 +252,7 @@ if ($web)
if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($argv[1]) && $argv[1]=='unused=true'))
{
print "***** Strings in en_US that are never used:\n";
$unused=array();
foreach ($langstrings_dist AS $value => $line)
{
@@ -288,7 +288,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
if (preg_match('/^JuridicalStatus/', $value)) $qualifiedforclean=0;
if (preg_match('/^CalcMode/', $value)) $qualifiedforclean=0;
if (preg_match('/^newLT/', $value)) $qualifiedforclean=0;
if (preg_match('/^LT\d/', $value)) $qualifiedforclean=0;
if (preg_match('/^LT[0-9]/', $value)) $qualifiedforclean=0;
if (preg_match('/^TypeContact_contrat_/', $value)) $qualifiedforclean=0;
if (preg_match('/^ErrorPriceExpression/', $value)) $qualifiedforclean=0;
if (preg_match('/^Language_/', $value)) $qualifiedforclean=0;
@@ -315,7 +315,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
// orders
if (preg_match('/^OrderSource/', $value)) $qualifiedforclean=0;
if (preg_match('/^TypeContact_/', $value)) $qualifiedforclean=0;
// other.lang
// other.lang
if (preg_match('/^Notify_/', $value)) $qualifiedforclean=0;
if (preg_match('/^PredefinedMail/', $value)) $qualifiedforclean=0;
if (preg_match('/^DemoCompany/', $value)) $qualifiedforclean=0;
@@ -336,17 +336,17 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
if (preg_match('/OppStatus/', $value)) $qualifiedforclean=0;
if (preg_match('/AvailabilityType/', $value)) $qualifiedforclean=0;
if (preg_match('/CardProduct/', $value)) $qualifiedforclean=0;
if (preg_match('/sms/i', $value)) $qualifiedforclean=0;
if (preg_match('/TF_/i', $value)) $qualifiedforclean=0;
if (preg_match('/WithBankUsing/i', $value)) $qualifiedforclean=0;
if (preg_match('/descWORKFLOW_/i', $value)) $qualifiedforclean=0;
if (! $qualifiedforclean)
{
continue;
continue;
}
//$search = '\'trans("'.$value.'")\'';
$search = '-e "\''.$value.'\'" -e \'"'.$value.'"\' -e "('.$value.')" -e "('.$value.',"';
$string = 'grep -R -m 1 -F --exclude=includes/* --include=*.php '.$search.' '.$htdocs.'* '.$scripts.'*';
@@ -356,7 +356,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
$unused[$value] = $line;
echo $line; // $trad contains the \n
}
else
else
{
unset($output);
//print 'X'.$output.'Y';
@@ -364,7 +364,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a
}
if (empty($unused)) print "No string not used found.\n";
else
else
{
$filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang';
print "Strings in en_US that are never used are saved into file ".$filetosave.":\n";

View File

@@ -336,17 +336,17 @@ if ($result)
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("OnSell"), $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("OnBuy"), $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
if (! empty($conf->global->ACCOUNTANCY_SHOW_PROD_DESC)) print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "p.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("OnSell", $_SERVER["PHP_SELF"], "p.tosell", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, 'align="center"', $sortfield, $sortorder);
if ($accounting_product_mode == 'ACCOUNTANCY_BUY') {
$fieldtosortaccount="p.accountancy_code_buy";
}
else $fieldtosortaccount="p.accountancy_code_sell";
print_liste_field_titre($langs->trans("CurrentDedicatedAccountingAccount"), $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AssignDedicatedAccountingAccount"));
print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], $fieldtosortaccount, "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("AssignDedicatedAccountingAccount");
$clickpitco=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($clickpitco, '', '', '', '', 'align="center"');
print '</tr>';

View File

@@ -195,11 +195,11 @@ else {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Solde", $_SERVER["PHP_SELF"], "", $options, "", 'align="right"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";

View File

@@ -567,13 +567,13 @@ if ($action == 'create') {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccountingShort"));
print_liste_field_titre($langs->trans("SubledgerAccount"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Label"));
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="right"');
print_liste_field_titre($langs->trans("Credit"), "", "", "", "", 'align="right"');
print_liste_field_titre($langs->trans("Action"), "", "", "", "", 'width="60" align="center"');
print_liste_field_titre("AccountAccountingShort");
print_liste_field_titre("SubledgerAccount");
print_liste_field_titre("Labelcompte");
print_liste_field_titre("Label");
print_liste_field_titre("Debit", "", "", "", "", 'align="right"');
print_liste_field_titre("Credit", "", "", "", "", 'align="right"');
print_liste_field_titre("Action", "", "", "", "", 'width="60" align="center"');
print "</tr>\n";

View File

@@ -436,15 +436,15 @@ print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("SubledgerAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("SubledgerAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder);

View File

@@ -244,14 +244,14 @@ print $searchpicto;
print '</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF']);
print_liste_field_titre($langs->trans("TransactionNumShort"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"));
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingShort", $_SERVER['PHP_SELF']);
print_liste_field_titre("TransactionNumShort", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Docdate", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Label");
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";

View File

@@ -201,19 +201,19 @@ print '</div>';
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Doctype"), $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccounting"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ThirdPartyAccount"), $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print_liste_field_titre("NumPiece", $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Doctype", $_SERVER['PHP_SELF'], "t.doc_type", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Docref", $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("ThirdPartyAccount", $_SERVER['PHP_SELF'], "t.subledger_account", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $options, "", $sortfield, $sortorder);
print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Sens", $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Codejournal", $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';

View File

@@ -191,17 +191,17 @@ llxHeader ( '', 'Compta - Grand Livre' );
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td></td>';
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
// print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
// print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
// print_liste_field_titre("Amount", "liste.php", "bk.montant" );
// print_liste_field_titre("Sens", "liste.php", "bk.sens" );
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
print '<td></td>';
print '<td></td>';
print "</tr>\n";

View File

@@ -200,17 +200,17 @@ llxHeader ( '', 'Compta - Grand Livre' );
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td></td>';
print_liste_field_titre ( $langs->trans ( "Doctype" ), "liste.php", "bk.doc_type" );
print_liste_field_titre ( $langs->trans ( "Docdate" ), "liste.php", "bk.doc_date" );
print_liste_field_titre ( $langs->trans ( "Docref" ), "liste.php", "bk.doc_ref" );
// print_liste_field_titre ( $langs->trans ( "Numerocompte" ), "liste.php", "bk.numero_compte" );
// print_liste_field_titre ( $langs->trans ( "Code_tiers" ), "liste.php", "bk.code_tiers" );
print_liste_field_titre ( $langs->trans ( "Labelcompte" ), "liste.php", "bk_label_compte" );
print_liste_field_titre ( $langs->trans ( "Debit" ), "liste.php", "bk.debit" );
print_liste_field_titre ( $langs->trans ( "Credit" ), "liste.php", "bk.credit" );
print_liste_field_titre ( $langs->trans ( "Amount" ), "liste.php", "bk.montant" );
print_liste_field_titre ( $langs->trans ( "Sens" ), "liste.php", "bk.sens" );
print_liste_field_titre ( $langs->trans ( "Codejournal" ), "liste.php", "bk.code_journal" );
print_liste_field_titre("Doctype", "liste.php", "bk.doc_type" );
print_liste_field_titre("Docdate", "liste.php", "bk.doc_date" );
print_liste_field_titre("Docref", "liste.php", "bk.doc_ref" );
// print_liste_field_titre("Numerocompte", "liste.php", "bk.numero_compte" );
// print_liste_field_titre("Code_tiers", "liste.php", "bk.code_tiers" );
print_liste_field_titre("Labelcompte", "liste.php", "bk_label_compte" );
print_liste_field_titre("Debit", "liste.php", "bk.debit" );
print_liste_field_titre("Credit", "liste.php", "bk.credit" );
print_liste_field_titre("Amount", "liste.php", "bk.montant" );
print_liste_field_titre("Sens", "liste.php", "bk.sens" );
print_liste_field_titre("Codejournal", "liste.php", "bk.code_journal" );
print '<td></td>';
print '<td></td>';
print "</tr>\n";

View File

@@ -37,7 +37,7 @@ class AccountancySystem
var $label;
var $account_number;
var $account_parent;
/**
* Constructor
*
@@ -46,8 +46,8 @@ class AccountancySystem
function __construct($db) {
$this->db = $db;
}
/**
* Load record in memory
*
@@ -55,11 +55,11 @@ class AccountancySystem
* @param string $ref ref
* @return int <0 if KO, Id of record if OK and found
*/
function fetch($rowid = 0, $ref = '')
function fetch($rowid = 0, $ref = '')
{
global $conf;
if ($rowid > 0 || $ref)
if ($rowid > 0 || $ref)
{
$sql = "SELECT a.pcg_version, a.label, a.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_system as a";
@@ -69,12 +69,12 @@ class AccountancySystem
} elseif ($ref) {
$sql .= " a.pcg_version = '" . $ref . "'";
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
@@ -82,7 +82,7 @@ class AccountancySystem
$this->ref = $obj->pcg_version;
$this->label = $obj->label;
$this->active = $obj->active;
return $this->id;
} else {
return 0;
@@ -94,8 +94,8 @@ class AccountancySystem
}
return - 1;
}
/**
* Insert accountancy system name into database
*
@@ -104,16 +104,16 @@ class AccountancySystem
*/
function create($user) {
$now = dol_now();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system";
$sql .= " (date_creation, fk_user_author, numero, label)";
$sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
$sql .= " VALUES ('" . $this->db->idate($now) . "'," . $user->id . ",'" . $this->numero . "','" . $this->label . "')";
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_system");
if ($id > 0) {
$this->rowid = $id;
$result = $this->rowid;
@@ -127,7 +127,7 @@ class AccountancySystem
$this->error = "AccountancySystem::Create Erreur $result";
dol_syslog($this->error, LOG_ERR);
}
return $result;
}
}

View File

@@ -71,6 +71,7 @@ class BookKeeping extends CommonObject
/**
*/
public $doc_date;
public $date_lim_reglement;
public $doc_type;
public $doc_ref;
public $fk_doc;
@@ -255,6 +256,7 @@ class BookKeeping extends CommonObject
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
$sql .= "doc_date";
$sql .= ", date_lim_reglement";
$sql .= ", doc_type";
$sql .= ", doc_ref";
$sql .= ", fk_doc";
@@ -277,6 +279,7 @@ class BookKeeping extends CommonObject
$sql .= ', entity';
$sql .= ") VALUES (";
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
$sql .= ",'" . $this->db->idate($this->date_lim_reglement) . "'";
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
$sql .= "," . $this->fk_doc;
@@ -444,6 +447,7 @@ class BookKeeping extends CommonObject
// Insert request
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
$sql .= 'doc_date,';
$sql .= 'date_lim_reglement,';
$sql .= 'doc_type,';
$sql .= 'doc_ref,';
$sql .= 'fk_doc,';
@@ -466,6 +470,7 @@ class BookKeeping extends CommonObject
$sql .= 'entity';
$sql .= ') VALUES (';
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
$sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ',';
@@ -540,6 +545,7 @@ class BookKeeping extends CommonObject
$sql = 'SELECT';
$sql .= ' t.rowid,';
$sql .= " t.doc_date,";
$sql .= " t.date_lim_reglement,";
$sql .= " t.doc_type,";
$sql .= " t.doc_ref,";
$sql .= " t.fk_doc,";
@@ -577,6 +583,7 @@ class BookKeeping extends CommonObject
$this->id = $obj->rowid;
$this->doc_date = $this->db->jdate($obj->doc_date);
$this->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
$this->doc_type = $obj->doc_type;
$this->doc_ref = $obj->doc_ref;
$this->fk_doc = $obj->fk_doc;
@@ -1260,7 +1267,7 @@ class BookKeeping extends CommonObject
global $user;
$error = 0;
$object = new Accountingbookkeeping($this->db);
$object = new BookKeeping($this->db);
$this->db->begin();

View File

@@ -280,17 +280,17 @@ if ($result) {
print "</td></tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
$clickpicto=$form->showCheckAddButtons();
print_liste_field_titre($clickpicto, '', '', '', '', 'align="center"');
print "</tr>\n";

View File

@@ -295,16 +295,16 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@@ -251,14 +251,14 @@ if ($result) {
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre('');
$checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@@ -277,15 +277,15 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ExpenseReport"), $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("TypeFees"), $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "erd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("ExpenseReport", $_SERVER["PHP_SELF"], "er.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "erd.date, erd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("TypeFees", $_SERVER["PHP_SELF"], "f.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "erd.comments", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "erd.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "erd.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"', $sortfield, $sortorder);
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@@ -401,7 +401,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->numero_compte = $k;
$bookkeeping->label_operation = $val["label"];
$bookkeeping->label_compte = $langs->trans("Bank");
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0);
$bookkeeping->credit = ($mt < 0 ? - $mt : 0);
@@ -462,7 +462,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->label_operation = $tabcompany[$key]['name'];
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0 ? - $mt : 0);
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;

View File

@@ -203,7 +203,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->label_operation = $tabuser[$key]['name'];
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? $mt : 0;
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;

View File

@@ -85,7 +85,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier,";
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, ";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
@@ -155,6 +155,7 @@ if ($result) {
}
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
$tabfac[$obj->rowid]["refsologest"] = $obj->ref;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier;
@@ -222,6 +223,7 @@ if ($action == 'writebookkeeping') {
if ($mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->doc_type = 'supplier_invoice';
@@ -269,6 +271,7 @@ if ($action == 'writebookkeeping') {
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->doc_type = 'supplier_invoice';
@@ -322,6 +325,7 @@ if ($action == 'writebookkeeping') {
if ($mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->doc_type = 'supplier_invoice';

View File

@@ -89,7 +89,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
$idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr,";
$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 .= " 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";
@@ -178,6 +178,7 @@ if ($result) {
// Invoice lines
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
@@ -240,6 +241,7 @@ if ($action == 'writebookkeeping') {
if ($mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->doc_type = 'customer_invoice';
@@ -287,6 +289,7 @@ if ($action == 'writebookkeeping') {
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->doc_type = 'customer_invoice';
@@ -340,6 +343,7 @@ if ($action == 'writebookkeeping') {
if ($mt) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_create = $now;
$bookkeeping->doc_type = 'customer_invoice';

View File

@@ -278,18 +278,18 @@ if ($result) {
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("VATIntra", $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder);
$checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print "</tr>\n";

View File

@@ -294,17 +294,17 @@ if ($result) {
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("LineId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("InvoiceLabel"), $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("ProductRef"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre($langs->trans("ProductLabel"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"');
print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"');
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("InvoiceLabel", $_SERVER["PHP_SELF"], "f.libelle", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre("AccountAccountingSuggest", '', '', '', '', 'align="center"');
print_liste_field_titre("IntoAccount", '', '', '', '', 'align="center"');
$checkpicto='';
if ($massactionbutton) $checkpicto=$form->showCheckAddButtons('checkforselect', 1);
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');

View File

@@ -134,7 +134,7 @@ class AdherentType extends CommonObject
$sql.= "note = '".$this->db->escape($this->note)."',";
$sql.= "vote = '".$this->db->escape($this->vote)."',";
$sql.= "mail_valid = '".$this->db->escape($this->mail_valid)."'";
$sql .= " WHERE rowid =".$this->id;
$sql.= " WHERE rowid =".$this->id;
$result = $this->db->query($sql);
if ($result)
@@ -252,7 +252,7 @@ class AdherentType extends CommonObject
$sql = "SELECT rowid, libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " WHERE entity IN (".getEntity('adherent').")";
$resql=$this->db->query($sql);
if ($resql)

View File

@@ -594,8 +594,8 @@ if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titr
if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.town']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['d.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['d.phone_mobile']['label'],$_SERVER["PHP_SELF"],'d.phone_mobile','',$param,'',$sortfield,$sortorder);
@@ -611,7 +611,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@@ -155,7 +155,7 @@ if ($result)
$num = $db->num_rows($result);
$arrayofselected=is_array($toselect)?$toselect:array();
$i = 0;
$title=$langs->trans("ListOfSubscriptions");
@@ -171,7 +171,7 @@ if ($result)
if ($search_acount) $param.="&search_account=".$search_account;
if ($search_amount) $param.="&search_amount=".$search_amount;
if ($optioncss != '') $param.='&optioncss='.$optioncss;
// List of mass actions available
$arrayofmassactions = array(
//'presend'=>$langs->trans("SendByMail"),
@@ -181,7 +181,7 @@ if ($result)
if ($user->rights->adherent->supprimer) $arrayofmassactions['delete']=$langs->trans("Delete");
//if ($massaction == 'presend' || $massaction == 'createbills') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -191,7 +191,7 @@ if ($result)
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
if ($sall)
@@ -200,11 +200,11 @@ if ($result)
}
$moreforfilter = '';
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@@ -237,33 +237,33 @@ if ($result)
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 '</td>';
// Action column
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"c.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.note",$param,"",'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled))
{
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"b.fk_account",$pram,"","",$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Amount",$_SERVER["PHP_SELF"],"c.subscription",$param,"",'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Static objects
$subscription=new Subscription($db);
$adherent=new Adherent($db);
@@ -286,7 +286,7 @@ if ($result)
$adherent->login=$obj->login;
$adherent->photo=$obj->photo;
print '<tr class="oddeven">';
@@ -329,7 +329,7 @@ if ($result)
// Price
print '<td align="right">'.price($obj->subscription).'</td>';
print '<td></td>';
print "</tr>";
@@ -338,7 +338,7 @@ if ($result)
}
// Total
print '<tr class="liste_total">';
print "<td>".$langs->trans("Total")."</td>\n";
print "<td align=\"right\">&nbsp;</td>\n";

View File

@@ -508,13 +508,13 @@ if ($rowid > 0)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Nature",$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("EndSubscription",$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Action",$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print "</tr>\n";
while ($i < $num && $i < $conf->liste_limit)

View File

@@ -389,37 +389,6 @@ $tmplist=array('show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->tra
print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW);
print '</td></tr>'."\n";
// AGENDA NOTIFICATION
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
{
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_NOTIFICATION').'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
if (empty($conf->global->AGENDA_NOTIFICATION)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
print '</td></tr>'."\n";
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
print '</td></tr>'."\n";
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_NOTIFICATION_SOUND').'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
if (empty($conf->global->AGENDA_NOTIFICATION_SOUND)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_NOTIFICATION_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
}
print '</td></tr>'."\n";
}
}
print '</table>';
dol_fiche_end();

View File

@@ -0,0 +1,255 @@
<?php
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/agenda_reminder.php
* \ingroup agenda
* \brief Page to setup agenda reminder options
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$langs->load("agenda");
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$param = GETPOST('param','alpha');
$cancel = GETPOST('cancel','alpha');
$scandir = GETPOST('scandir','alpha');
$type = 'action';
/*
* Actions
*/
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
if (preg_match('/set_(.*)/',$action,$reg))
{
$code=$reg[1];
$value=(GETPOST($code) ? GETPOST($code) : 1);
if (dolibarr_set_const($db, $code, $value, 'chaine', 0, '', $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if ($action == 'set')
{
dolibarr_set_const($db, 'AGENDA_USE_EVENT_TYPE_DEFAULT', GETPOST('AGENDA_USE_EVENT_TYPE_DEFAULT'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', GETPOST('AGENDA_DEFAULT_FILTER_TYPE'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity);
dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity);
}
else if ($action == 'specimen') // For orders
{
$modele=GETPOST('module','alpha');
$commande = new CommandeFournisseur($db);
$commande->initAsSpecimen();
$commande->thirdparty=$specimenthirdparty;
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/action/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
break;
}
}
if ($filefound)
{
require_once $file;
$module = new $classname($db,$commande);
if ($module->write_file($commande,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf");
return;
}
else
{
setEventMessages($module->error, $module->errors, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
else if ($action == 'setmodel')
{
//print "sssd".$value;
$ret = addDocumentModel($value, $type, $label, $scandir);
}
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->ACTION_EVENT_ADDON_PDF == "$value") dolibarr_del_const($db, 'ACTION_EVENT_ADDON_PDF',$conf->entity);
}
}
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf->global->ACTION_EVENT_ADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
/**
* View
*/
$formactions=new FormActions($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";
$head=agenda_prepare_head();
dol_fiche_head($head, 'reminders', $langs->trans("Agenda"), -1, 'action');
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="action" value="set">';
print '<table class="noborder allwidth">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'.$langs->trans("Value").'</td>'."\n";
print '</tr>'."\n";
// AGENDA REMINDER EMAIL
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
{
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
if (empty($conf->global->AGENDA_REMINDER_EMAIL)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
print '</td></tr>'."\n";
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_EMAIL">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
print '</td></tr>'."\n";
}
}
// AGENDA REMINDER BROWSER
if ($conf->global->MAIN_FEATURES_LEVEL > 0)
{
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER').'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
if (empty($conf->global->AGENDA_REMINDER_BROWSER)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
print '</td></tr>'."\n";
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
print '</td></tr>'."\n";
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
print '<td align="right">'."\n";
if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Disabled'),'switch_off').'</a>';
} else {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_AGENDA_REMINDER_BROWSER_SOUND">'.img_picto($langs->trans('Enabled'),'switch_on').'</a>';
}
print '</td></tr>'."\n";
}
}
print '</table>';
dol_fiche_end();
print '<div class="center"><input class="button" type="submit" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
print '</form>';
print "<br>";
llxFooter();
$db->close();

View File

@@ -1,4 +1,5 @@
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
@@ -21,15 +22,14 @@
/**
* \file htdocs/admin/bank.php
* \ingroup bank
* \brief Page to setup the bank module
* \ingroup bank
* \brief Page to setup the bank module
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
$langs->load("admin");
$langs->load("companies");
@@ -38,12 +38,12 @@ $langs->load("other");
$langs->load("banks");
if (!$user->admin)
accessforbidden();
accessforbidden();
$action = GETPOST('action','alpha');
$value = GETPOST('value','alpha');
$label = GETPOST('label','alpha');
$scandir = GETPOST('scandir','alpha');
$action = GETPOST('action', 'alpha');
$value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'bankaccount';
@@ -52,100 +52,109 @@ $type = 'bankaccount';
*/
//Order display of bank account
if ($action == 'setbankorder')
{
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",GETPOST('value','alpha'),'chaine',0,'',$conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
if ($action == 'setbankorder') {
if (dolibarr_set_const($db, "BANK_SHOW_ORDER_OPTION",
GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity) > 0) {
header("Location: " . $_SERVER["PHP_SELF"]);
exit;
}
else {
dol_print_error($db);
}
}
//Auto report last num releve on conciliate
if ($action == 'setreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 1, 'chaine', 0,
'', $conf->entity) > 0) {
header("Location: " . $_SERVER["PHP_SELF"]);
exit;
}
else {
dol_print_error($db);
}
}
elseif ($action == 'unsetreportlastnumreleve') {
if (dolibarr_set_const($db, "BANK_REPORT_LAST_NUM_RELEVE", 0, 'chaine', 0,
'', $conf->entity) > 0) {
header("Location: " . $_SERVER["PHP_SELF"]);
exit;
}
else {
dol_print_error($db);
}
}
if ($action == 'specimen')
{
$modele=GETPOST('module','alpha');
if ($modele == 'sepamandate')
{
if ($action == 'specimen') {
$modele = GETPOST('module', 'alpha');
if ($modele == 'sepamandate') {
$object = new CompanyBankAccount($db);
}
else
{
else {
$object = new Account($db);
}
$object->initAsSpecimen();
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/bank/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
$classname = "pdf_".$modele;
$file = '';
$classname = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir . "core/modules/bank/doc/pdf_" . $modele . ".modules.php",
0);
if (file_exists($file)) {
$filefound = 1;
$classname = "pdf_" . $modele;
break;
}
}
if ($filefound)
{
if ($filefound) {
require_once $file;
$module = new $classname($db);
if ($module->write_file($object,$langs) > 0)
{
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bank&file=SPECIMEN.pdf");
if ($module->write_file($object, $langs) > 0) {
header("Location: " . DOL_URL_ROOT . "/document.php?modulepart=bank&file=SPECIMEN.pdf");
return;
}
else
{
else {
setEventMessages($module->error, null, 'errors');
dol_syslog($module->error, LOG_ERR);
}
}
else
{
else {
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
}
}
// Activate a model
if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
if ($action == 'set') {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
else if ($action == 'del')
{
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($conf->global->BANKADDON_PDF == "$value") dolibarr_del_const($db, 'BANKADDON_PDF',$conf->entity);
}
else if ($action == 'del') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
if ($conf->global->BANKADDON_PDF == "$value")
dolibarr_del_const($db, 'BANKADDON_PDF', $conf->entity);
}
}
// Set default model
else if ($action == 'setdoc')
{
if (dolibarr_set_const($db, "BANKADDON_PDF",$value,'chaine',0,'',$conf->entity))
{
else if ($action == 'setdoc') {
if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '',
$conf->entity)) {
// The constant that was read before the new set
// We therefore requires a variable to have a coherent view
$conf->global->BANKADDON_PDF = $value;
}
// On active le modele
$ret = delDocumentModel($value, $type);
if ($ret > 0)
{
if ($ret > 0) {
$ret = addDocumentModel($value, $type, $label, $scandir);
}
}
@@ -156,80 +165,78 @@ else if ($action == 'setdoc')
* view
*/
$form=new Form($db);
$form = new Form($db);
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
llxHeader("",$langs->trans("BankSetupModule"));
llxHeader("", $langs->trans("BankSetupModule"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BankSetupModule"),$linkback,'title_setup');
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans("BankSetupModule"), $linkback,
'title_setup');
$head = bank_admin_prepare_head(null);
dol_fiche_head($head, 'general', $langs->trans("BankSetupModule"), -1, 'account');
$var=true;
$var = true;
$var=! $var;
$var = !$var;
//Show bank account order
print load_fiche_titre($langs->trans("BankOrderShow"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="140">'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td>'.$langs->trans("Example").'</td>';
print '<td align="center">'.$langs->trans("Status").'</td>';
print '<td width="140">' . $langs->trans("Name") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td>' . $langs->trans("Example") . '</td>';
print '<td align="center">' . $langs->trans("Status") . '</td>';
print '<td align="center" width="60">&nbsp;</td>';
print "</tr>\n";
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
$bankorder[1][0]=$langs->trans("BankOrderES");
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
$bankorder[0][0] = $langs->trans("BankOrderGlobal");
$bankorder[0][1] = $langs->trans("BankOrderGlobalDesc");
$bankorder[0][2] = 'BankCode DeskCode BankAccountNumber BankAccountNumberKey';
$bankorder[1][0] = $langs->trans("BankOrderES");
$bankorder[1][1] = $langs->trans("BankOrderESDesc");
$bankorder[1][2] = 'BankCode DeskCode BankAccountNumberKey BankAccountNumber';
$var = true;
$i=0;
$i = 0;
$nbofbank=count($bankorder);
while ($i < $nbofbank)
{
$var = !$var;
$nbofbank = count($bankorder);
while ($i < $nbofbank) {
$var = !$var;
print '<tr class="oddeven">';
print '<td>'.$bankorder[$i][0]."</td><td>\n";
print $bankorder[$i][1];
print '</td>';
print '<td class="nowrap">';
$tmparray=explode(' ',$bankorder[$i][2]);
foreach($tmparray as $key => $val)
{
if ($key > 0) print ', ';
print $langs->trans($val);
}
print "</td>\n";
print '<tr class="oddeven">';
print '<td>' . $bankorder[$i][0] . "</td><td>\n";
print $bankorder[$i][1];
print '</td>';
print '<td class="nowrap">';
$tmparray = explode(' ', $bankorder[$i][2]);
foreach ($tmparray as $key => $val) {
if ($key > 0)
print ', ';
print $langs->trans($val);
}
print "</td>\n";
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i)
{
print '<td align="center">';
print img_picto($langs->trans("Activated"),'on');
print '</td>';
}
else
{
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setbankorder&amp;value='.$i.'">';
print img_picto($langs->trans("Disabled"),'off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>'."\n";
$i++;
if ($conf->global->BANK_SHOW_ORDER_OPTION == $i) {
print '<td align="center">';
print img_picto($langs->trans("Activated"), 'on');
print '</td>';
}
else {
print '<td align="center"><a href="' . $_SERVER['PHP_SELF'] . '?action=setbankorder&amp;value=' . $i . '">';
print img_picto($langs->trans("Disabled"), 'off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
print '</tr>' . "\n";
$i++;
}
print '</table>'."\n";
print '</table>' . "\n";
print '<br><br>';
@@ -257,7 +264,8 @@ if ($resql) {
array_push($def, $array[0]);
$i ++;
}
} else {
}
else {
dol_print_error($db);
}
@@ -273,11 +281,10 @@ print "</tr>\n";
clearstatcache();
foreach ($dirmodels as $reldir)
{
foreach ($dirmodels as $reldir) {
foreach (array('', '/doc') as $valdir) {
$dir = dol_buildpath($reldir . "core/modules/bank" . $valdir);
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
@@ -286,23 +293,26 @@ foreach ($dirmodels as $reldir)
}
closedir($handle);
arsort($filelist);
foreach ($filelist as $file) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/',
$file)) {
if (file_exists($dir . '/' . $file)) {
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
require_once $dir . '/' . $file;
$module = new $classname($db);
$modulequalified = 1;
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2)
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL
< 2)
$modulequalified = 0;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1)
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL
< 1)
$modulequalified = 0;
if ($modulequalified) {
print '<tr class="oddeven"><td width="100">';
print(empty($module->name) ? $name : $module->name);
@@ -312,29 +322,35 @@ foreach ($dirmodels as $reldir)
else
print $module->description;
print '</td>';
// Active
if (in_array($name, $def)) {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=del&value=' . $name . '">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print img_picto($langs->trans("Enabled"),
'switch_on');
print '</a>';
print '</td>';
} else {
}
else {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"), 'switch_off') . '</a>';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=set&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '">' . img_picto($langs->trans("Disabled"),
'switch_off') . '</a>';
print "</td>";
}
// Default
print '<td align="center">';
if ($conf->global->BANKADDON_PDF == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
print img_picto($langs->trans("Default"),
'on');
}
else {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setdoc&value=' . $name . '&amp;scandir=' . $module->scandir . '&amp;label=' . urlencode($module->name) . '" alt="' . $langs->trans("Default") . '">' . img_picto($langs->trans("Disabled"),
'off') . '</a>';
}
print '</td>';
// Info
$htmltooltip = '' . $langs->trans("Name") . ': ' . $module->name;
$htmltooltip .= '<br>' . $langs->trans("Type") . ': ' . ($module->type ? $module->type : $langs->trans("Unknown"));
@@ -342,27 +358,33 @@ foreach ($dirmodels as $reldir)
$htmltooltip .= '<br>' . $langs->trans("Width") . '/' . $langs->trans("Height") . ': ' . $module->page_largeur . '/' . $module->page_hauteur;
}
$htmltooltip .= '<br><br><u>' . $langs->trans("FeaturesSupported") . ':</u>';
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>' . $langs->trans("Logo") . ': ' . yn($module->option_logo,
1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentMode") . ': ' . yn($module->option_modereg, 1, 1);
//$htmltooltip .= '<br>' . $langs->trans("PaymentConditions") . ': ' . yn($module->option_condreg, 1, 1);
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>' . $langs->trans("MultiLanguage") . ': ' . yn($module->option_multilang,
1, 1);
// $htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
// $htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
//$htmltooltip .= '<br>' . $langs->trans("WatermarkOnDraftOrders") . ': ' . yn($module->option_draft_watermark, 1, 1);
print '<td align="center">';
print $form->textwithpicto('', $htmltooltip, 1, 0);
print $form->textwithpicto('', $htmltooltip, 1,
0);
print '</td>';
// Preview
print '<td align="center">';
if ($module->type == 'pdf') {
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"), 'bill') . '</a>';
} else {
print img_object($langs->trans("PreviewNotAvailable"), 'generic');
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=specimen&module=' . $name . '">' . img_object($langs->trans("Preview"),
'bill') . '</a>';
}
else {
print img_object($langs->trans("PreviewNotAvailable"),
'generic');
}
print '</td>';
print "</tr>\n";
}
}
@@ -372,9 +394,51 @@ foreach ($dirmodels as $reldir)
}
}
}
print '</table>';
//}
print '<br /><br />';
/*
* Document templates generators
*/
//if (! empty($conf->global->MAIN_FEATURES_LEVEL))
//{
print load_fiche_titre($langs->trans("BankAccountReleveModule"), '', '');
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
print '<td>' . $langs->trans("Name") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="center" width="60">' . $langs->trans("Status") . "</td>\n";
print "</tr>\n";
print '<tr class="oddeven"><td width="100">';
print $langs->trans('AccountStatement');
print "</td><td>\n";
print $langs->trans('AutoReportLastAccountStatement');
print '</td>';
// Active
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=unsetreportlastnumreleve">';
print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>';
print '</td>';
}
else {
print '<td align="center">' . "\n";
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=setreportlastnumreleve">' . img_picto($langs->trans("Disabled"),
'switch_off') . '</a>';
print "</td>";
}
print "</tr>\n";
print '</table>';
dol_fiche_end();
llxFooter();

View File

@@ -285,7 +285,7 @@ if ($mode != 'focus')
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
}
// Entity
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
// Actions
print '<td align="center"></td>';
print "</tr>\n";

View File

@@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,35,36,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,);
// Name of SQL tables of dictionaries
$tabname=array();
@@ -126,6 +126,8 @@ $tabname[30]= MAIN_DB_PREFIX."c_format_cards";
//$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
$tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
// Dictionary labels
$tablib=array();
@@ -163,6 +165,8 @@ $tablib[30]= "DictionaryFormatCards";
//$tablib[32]= "DictionaryAccountancyCategory";
$tablib[33]= "DictionaryDepartment";
$tablib[34]= "DictionaryFunction";
$tablib[35]= "DictionaryExpenseTaxCat";
$tablib[36]= "DictionaryExpenseTaxRange";
// Requests to extract data
$tabsql=array();
@@ -200,6 +204,8 @@ $tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmar
//$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
// Criteria to sort dictionaries
$tabsqlsort=array();
@@ -237,6 +243,8 @@ $tabsqlsort[30]="code ASC";
//$tabsqlsort[32]="position ASC";
$tabsqlsort[33]="code ASC";
$tabsqlsort[34]="code ASC";
$tabsqlsort[35]="c.label ASC";
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@@ -249,7 +257,7 @@ $tabfield[6] = "code,libelle,type,color,position";
$tabfield[7] = "code,libelle,country,accountancy_code,deductible";
$tabfield[8] = "code,libelle,country_id,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
$tabfield[9] = "code,label,unicode";
$tabfield[10]= "country_id,country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[11]= "element,source,code,libelle,position";
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
$tabfield[13]= "code,libelle,type,accountancy_code";
@@ -272,8 +280,8 @@ $tabfield[29]= "code,label,percent,position";
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
//$tabfield[31]= "pcg_version,label";
//$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
$tabfield[33]= "code,label";
$tabfield[34]= "code,label";
$tabfield[35]= "label";
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@@ -286,7 +294,7 @@ $tabfieldvalue[6] = "code,libelle,type,color,position";
$tabfieldvalue[7] = "code,libelle,country,accountancy_code,deductible";
$tabfieldvalue[8] = "code,libelle,country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
$tabfieldvalue[9] = "code,label,unicode";
$tabfieldvalue[10]= "country,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[11]= "element,source,code,libelle,position";
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
$tabfieldvalue[13]= "code,libelle,type,accountancy_code";
@@ -311,6 +319,8 @@ $tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargi
//$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
$tabfieldvalue[33]= "code,label";
$tabfieldvalue[34]= "code,label";
$tabfieldvalue[35]= "label";
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@@ -323,7 +333,7 @@ $tabfieldinsert[6] = "code,libelle,type,color,position";
$tabfieldinsert[7] = "code,libelle,fk_pays,accountancy_code,deductible";
$tabfieldinsert[8] = "code,libelle,fk_country".(! empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?',position':'');
$tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10]= "fk_pays,code,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[11]= "element,source,code,libelle,position";
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
@@ -348,6 +358,8 @@ $tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmarg
//$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
$tabfieldinsert[33]= "code,label";
$tabfieldinsert[34]= "code,label";
$tabfieldinsert[35]= "label";
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@@ -387,6 +399,8 @@ $tabrowid[30]= "";
//$tabrowid[32]= "";
$tabrowid[33]= "rowid";
$tabrowid[34]= "rowid";
$tabrowid[35]= "";
$tabrowid[36]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@@ -424,6 +438,8 @@ $tabcond[30]= ! empty($conf->label->enabled);
//$tabcond[32]= ! empty($conf->accounting->enabled);
$tabcond[33]= ! empty($conf->hrm->enabled);
$tabcond[34]= ! empty($conf->hrm->enabled);
$tabcond[35]= ! empty($conf->expensereport->enabled);
$tabcond[36]= ! empty($conf->expensereport->enabled);
// List of help for fields
$tabhelp=array();
@@ -461,6 +477,8 @@ $tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->tran
//$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[35]= array();
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@@ -498,6 +516,8 @@ $tabfieldcheck[30] = array();
//$tabfieldcheck[32] = array();
$tabfieldcheck[33] = array();
$tabfieldcheck[34] = array();
$tabfieldcheck[35]= array();
$tabfieldcheck[36]= array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
@@ -1065,6 +1085,9 @@ if ($id)
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
if ($id == 2) // Special cas for state page
{
@@ -1284,6 +1307,9 @@ if ($id)
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("WithCounter"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }
if ($fieldlist[$field]=='fk_tva') { $valuetoshow=$langs->trans("VAT"); }
if ($fieldlist[$field]=='range_ik') { $valuetoshow=$langs->trans("RangeIk"); }
if ($fieldlist[$field]=='fk_c_exp_tax_cat'){ $valuetoshow=$langs->trans("CarCategory"); }
// Affiche nom du champ
if ($showfield)
@@ -1501,6 +1527,26 @@ if ($id)
else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') {
$valuetoshow = length_accountg($valuetoshow);
}
elseif ($fieldlist[$field] == 'fk_tva')
{
foreach ($form->cache_vatrates as $key => $Tab)
{
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow)
{
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
break;
}
}
}
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
{
$valuetoshow = getDictvalue(MAIN_DB_PREFIX.'c_exp_tax_cat', 'label', $valuetoshow);
$valuetoshow = $langs->trans($valuetoshow);
}
elseif ($tabname[$id] == MAIN_DB_PREFIX.'c_exp_tax_cat')
{
$valuetoshow = $langs->trans($valuetoshow);
}
$class='tddict';
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
@@ -1667,7 +1713,7 @@ $db->close();
*/
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
global $conf,$langs,$db;
global $conf,$langs,$db,$mysoc;
global $form;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
@@ -1834,6 +1880,24 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
}
print '</td>';
}
elseif ($fieldlist[$field] == 'fk_tva')
{
print '<td>';
print $form->load_tva('fk_tva', $obj->taux, $mysoc, new Societe($db), 0, 0, '', false, -1);
print '</td>';
}
elseif ($fieldlist[$field] == 'fk_c_exp_tax_cat')
{
print '<td>';
print $form->selectExpenseCategories($obj->fk_c_exp_tax_cat);
print '</td>';
}
elseif ($fieldlist[$field] == 'fk_range')
{
print '<td>';
print $form->selectExpenseRanges($obj->fk_range);
print '</td>';
}
else
{
$classtd=''; $class='';

View File

@@ -0,0 +1,188 @@
<?php
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/expensereport_ik.php
* \ingroup expensereport
* \brief Page to display expense tax ik
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_ik.class.php';
$langs->load('admin');
$langs->load('other');
$langs->load('trips');
$langs->load('errors');
$langs->load('dict');
if (!$user->admin) accessforbidden();
//Init error
$error = false;
$message = false;
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$offset = GETPOST('offset','int');
$coef = GETPOST('coef','int');
$fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat');
$fk_range = GETPOST('fk_range');
if ($action == 'updateik')
{
$expIk = new ExpenseReportIk($db);
if ($id > 0)
{
$result = $expIk->fetch($id);
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
}
$expIk->setValues($_POST);
$result = $expIk->create($user);
if ($result > 0) setEventMessages('SetupSaved', null, 'mesgs');
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
elseif ($action == 'delete') // TODO add confirm
{
$expIk = new ExpenseReportIk($db);
if ($id > 0)
{
$result = $expIk->fetch($id);
if ($result < 0) dol_print_error('', $expIk->error, $expIk->errors);
$expIk->delete($user);
}
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
$rangesbycateg = ExpenseReportIk::getAllRanges();
/*
* View
*/
llxHeader();
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsIkSetup"),$linkback,'title_setup');
$head=expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenseik', $langs->trans("ExpenseReportsIk"), -1, 'trip');
echo $langs->trans('ExpenseReportIkDesc');
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
if ($action == 'edit')
{
echo '<input type="hidden" name="id" value="'.$id.'" />';
echo '<input type="hidden" name="fk_c_exp_tax_cat" value="'.$fk_c_exp_tax_cat.'" />';
echo '<input type="hidden" name="fk_range" value="'.$fk_range.'" />';
echo '<input type="hidden" name="action" value="updateik" />';
}
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
echo '<table class="noborder" width="100%">';
foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab)
{
$title = ($Tab['active'] == 1) ? $langs->trans($Tab['label']) : $form->textwithpicto($langs->trans($Tab['label']), $langs->trans('expenseReportCatDisabled'), 1, 'help', '', 0, 3);
echo '<tr class="liste_titre">';
echo '<td>'.$title.'</td>';
echo '<td>'.$langs->trans('expenseReportOffset').'</td>';
echo '<td>'.$langs->trans('expenseReportCoef').'</td>';
echo '<td>'.$langs->trans('expenseReportTotalForFive').'</td>';
echo '<td>&nbsp;</td>';
echo '</tr>';
if ($Tab['active'] == 0) continue;
$tranche=1;
$var = true;
foreach ($Tab['ranges'] as $k => $range)
{
if (isset($Tab['ranges'][$k+1])) $label = $langs->trans('expenseReportRangeFromTo', $range->range_ik, ($Tab['ranges'][$k+1]->range_ik-1));
else $label = $langs->trans('expenseReportRangeMoreThan', $range->range_ik);
if ($range->range_active == 0) $label = $form->textwithpicto($label, $langs->trans('expenseReportRangeDisabled'), 1, 'help', '', 0, 3);
echo '<tr '.$bc[$var].'>';
// Label
echo '<td width="20%"><b>['.$langs->trans('RangeNum', $tranche++).']</b> - '.$label.'</td>';
// Offset
echo '<td width="20%">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="offset" value="'.$range->ik->offset.'" />';
else echo $range->ik->offset;
echo '</td>';
// Coef
echo '<td width="20%">';
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) echo '<input type="text" name="coef" value="'.$range->ik->coef.'" />';
else echo ($range->ik->id > 0 ? $range->ik->coef : $langs->trans('expenseReportCoefUndefined'));
echo '</td>';
// Total for one
echo '<td width="30%">'.$langs->trans('expenseReportPrintExample', price($range->ik->offset + 5 * $range->ik->coef)).'</td>';
// Action
echo '<td align="right">';
if ($range->range_active == 1)
{
if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat)
{
echo '<input id="" class="button" name="save" value="'.$langs->trans('Save').'" type="submit" />';
echo '<input class="button" value="'.$langs->trans('Cancel').'" onclick="javascript:history.go(-1)" type="button" />';
}
else
{
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$range->ik->id.'&fk_c_exp_tax_cat='.$range->fk_c_exp_tax_cat.'&fk_range='.$range->rowid.'">'.img_edit().'</a>';
if (!empty($range->ik->id)) echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$range->ik->id.'">'.img_delete().'</a>';
// TODO add delete link
}
}
echo '</td>';
echo '</tr>';
$var=!$var;
}
}
echo '</table>';
echo '</form>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@@ -0,0 +1,366 @@
<?php
/* Copyright (C) 2012 Mikael Carlavan <contact@mika-carl.fr>
* Copyright (C) 2017 ATM Consulting <contact@atm-consulting.fr>
* Copyright (C) 2017 Pierre-Henry Favre <phf@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/expensereport_ik.php
* \ingroup expensereport
* \brief Page to display expense tax ik
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport_rule.class.php';
$langs->load('admin');
$langs->load('other');
$langs->load('trips');
$langs->load('errors');
$langs->load('dict');
if (!$user->admin) accessforbidden();
//Init error
$error = false;
$message = false;
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$apply_to = GETPOST('apply_to');
$fk_user = GETPOST('fk_user');
$fk_usergroup = GETPOST('fk_usergroup');
$fk_c_type_fees = GETPOST('fk_c_type_fees');
$code_expense_rules_type = GETPOST('code_expense_rules_type');
$dates = dol_mktime(12, 0, 0, GETPOST('startmonth'), GETPOST('startday'), GETPOST('startyear'));
$datee = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$amount = GETPOST('amount');
$restrictive = GETPOST('restrictive');
$object = new ExpenseReportRule($db);
if (!empty($id))
{
$result = $object->fetch($id);
if ($result < 0) dol_print_error('', $object->error, $object->errors);
}
// TODO do action
if ($action == 'save')
{
$error = 0;
// check parameters
if (empty($apply_to)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportApplyTo")), null, 'errors');
}
if (empty($fk_c_type_fees)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDomain")), null, 'errors');
}
if (empty($code_expense_rules_type)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitOn")), null, 'errors');
}
if (empty($dates)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateStart")), null, 'errors');
}
if (empty($datee)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportDateEnd")), null, 'errors');
}
if (empty($amount)) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpenseReportLimitAmount")), null, 'errors');
}
if (empty($error))
{
$object->setValues($_POST);
if($apply_to=='U'){
$object->fk_user=$fk_user;
$object->fk_usergroup=0;
$object->is_for_all=0;
}elseif($apply_to=='G'){
$object->fk_usergroup=$fk_usergroup;
$object->fk_user=0;
$object->is_for_all=0;
}elseif($apply_to=='A'){
$object->is_for_all=1;
$object->fk_user=0;
$object->fk_usergroup=0;
}
$object->dates = $dates;
$object->datee = $datee;
$object->entity = $conf->entity;
$res = $object->create($user);
if ($res > 0) setEventMessages($langs->trans('ExpenseReportRuleSave'), null);
else dol_print_error($object->db);
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
}
elseif ($action == 'delete')
{
// TODO add confirm
$res = $object->delete($user);
if ($res < 0) dol_print_error($object->db);
header('Location: '.$_SERVER['PHP_SELF']);
exit;
}
$rules = ExpenseReportRule::getAllRule();
$tab_apply = array('A' => $langs->trans('All'), 'G' => $langs->trans('Group'), 'U' => $langs->trans('User'));
$tab_rules_type = array('EX_DAY' => $langs->trans('Day'), 'EX_MON' => $langs->trans('Month'), 'EX_YEA' => $langs->trans('Year'), 'EX_EXP' => $langs->trans('OnExpense'));
/*
* View
*/
llxHeader();
$form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ExpenseReportsRulesSetup"),$linkback,'title_setup');
$head=expensereport_admin_prepare_head();
dol_fiche_head($head, 'expenserules', $langs->trans("ExpenseReportsRules"), -1, 'trip');
echo $langs->trans('ExpenseReportRulesDesc');
if ($action != 'edit')
{
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
echo '<input type="hidden" name="action" value="save" />';
echo '<table class="noborder" width="100%">';
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
echo '<th>&nbsp;</th>';
echo '</tr>';
$var=true;
echo '<tr '.$bc[$var].'>';
echo '<td>';
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, '', 0).'</div>';
echo '<div id="user" class="float">'.$form->select_dolusers('', 'fk_user').'</div>';
echo '<div id="group" class="float">'.$form->select_dolgroups('', 'fk_usergroup').'</div>';
echo '</td>';
echo '<td>'.$form->selectExpense('', 'fk_c_type_fees', 0, 1, 1).'</td>';
echo '<td>'.$form->selectarray('code_expense_rules_type', $tab_rules_type, '', 0).'</td>';
echo '<td>'.$form->select_date(strtotime(date('Y-m-01', dol_now())), 'start', '', '', 0, '', 1, 0, 1).'</td>';
echo '<td>'.$form->select_date(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0, 1).'</td>';
echo '<td><input type="text" value="" name="amount" class="amount" />'.$conf->currency.'</td>';
echo '<td>'.$form->selectyesno('restrictive', 0, 1).'</td>';
echo '<td align="right"><input type="submit" class="button" value="'.$langs->trans('Add').'" /></td>';
echo '</tr>';
echo '</table>';
echo '</form>';
}
echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
echo '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
if ($action == 'edit')
{
echo '<input type="hidden" name="id" value="'.$object->id.'" />';
echo '<input type="hidden" name="action" value="save" />';
}
echo '<table class="noborder" width="100%">';
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans('ExpenseReportApplyTo').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDomain').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitOn').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateStart').'</th>';
echo '<th>'.$langs->trans('ExpenseReportDateEnd').'</th>';
echo '<th>'.$langs->trans('ExpenseReportLimitAmount').'</th>';
echo '<th>'.$langs->trans('ExpenseReportRestrictive').'</th>';
echo '<th>&nbsp;</th>';
echo '</tr>';
$var=true;
foreach ($rules as $rule)
{
echo '<tr '.$bc[$var].'>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
$selected = ($object->is_for_all > 0) ? 'A' : ($object->fk_usergroup > 0 ? 'G' : 'U');
echo '<div class="float">'.$form->selectarray('apply_to', $tab_apply, $selected, 0).'</div>';
echo '<div id="user" class="float">'.$form->select_dolusers($object->fk_user, 'fk_user').'</div>';
echo '<div id="group" class="float">'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'</div>';
}
else
{
if ($rule->is_for_all > 0) echo $tab_apply['A'];
elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')';
elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')';
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1);
}
else
{
if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport');
else
{
$key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id');
if ($key != $langs->trans($key)) echo $langs->trans($key);
else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code'
}
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0);
}
else
{
echo $tab_rules_type[$rule->code_expense_rules_type];
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->select_date(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0, 1);
}
else
{
echo dol_print_date($rule->dates, 'day');
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->select_date(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0, 1);
}
else
{
echo dol_print_date($rule->datee, 'day');
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo '<input type="text" value="'.price2num($object->amount).'" name="amount" class="amount" />'.$conf->currency;
}
else
{
echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency);
}
echo '</td>';
echo '<td>';
if ($action == 'edit' && $object->id == $rule->id)
{
echo $form->selectyesno('restrictive', $object->restrictive, 1);
}
else
{
echo yn($rule->restrictive, 1, 1);
}
echo '</td>';
echo '<td>';
if ($object->id != $rule->id)
{
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$rule->id.'">'.img_edit().'</a>&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$rule->id.'">'.img_delete().'</a>';
}
else
{
echo '<input type="submit" class="button" value="'.$langs->trans('Update').'" />&nbsp;';
echo '<a href="'.$_SERVER['PHP_SELF'].'" class="button">'.$langs->trans('Cancel').'</a>';
}
echo '</td>';
echo '</tr>';
$var=!$var;
}
echo '</table>';
echo '</form>';
echo '<script type="text/javascript"> $(function() {
$("#apply_to").change(function() {
var value = $(this).val();
if (value == "A") {
$("#group").hide(); $("#user").hide();
} else if (value == "U") {
$("#user").show();
$("#group").hide();
} else if (value == "G") {
$("#group").show();
$("#user").hide();
}
});
$("#apply_to").change();
}); </script>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@@ -296,7 +296,7 @@ if ($conf->use_javascript_ajax)
//puis tous les elements enfants
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.module";
$sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.position, m.module";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'";
$sql.= " AND entity = ".$conf->entity;
@@ -323,6 +323,7 @@ if ($conf->use_javascript_ajax)
'leftmenu'=>$menu['leftmenu'],
'fk_mainmenu'=>$menu['fk_mainmenu'],
'fk_leftmenu'=>$menu['fk_leftmenu'],
'position'=>$menu['position'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td>'.
'<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
'</td><td align="right">'.
@@ -344,10 +345,11 @@ if ($conf->use_javascript_ajax)
global $tree_recur_alreadyadded; // This var was def into tree_recur
// Appelle de la fonction recursive (ammorce)
// avec recherche depuis la racine.
//var_dump($data);
tree_recur($data, $data[0], 0, 'iddivjstree'); // $data[0] is virtual record 'racine'
// Appelle de la fonction recursive (ammorce) avec recherche depuis la racine.
//tree_recur($data, $data[0], 0, 'iddivjstree', 0, 1); // use this to get info on name and foreign keys of menu entry
tree_recur($data, $data[0], 0, 'iddivjstree', 0, 0); // $data[0] is virtual record 'racine'
print '</td>';
@@ -376,7 +378,6 @@ if ($conf->use_javascript_ajax)
print '<tr>';
print '<td colspan="2">';
foreach($remainingdata as $datar)
{
$father = array('rowid'=>$datar['rowid'],'title'=>"???",'mainmenu'=>$datar['fk_mainmenu'],'leftmenu'=>$datar['fk_leftmenu'],'fk_mainmenu'=>'','fk_leftmenu'=>'');

View File

@@ -269,7 +269,7 @@ if ($objMod->isCoreOrExternalModule() == 'external')
$modulename=$objMod->getName();
$moduledesc=$objMod->getDesc();
$moduleauthor=$objMod->getPublisher();
$moduledir=strtolower(preg_replace('/^mod/i','',get_class($objMod)));
print '<div class="centpercent">';
@@ -449,11 +449,28 @@ if ($mode == 'feature')
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
$moreinfoontriggerfile='';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$text.=$langs->trans("Yes");
$yesno='Yes';
}
else $text.=$langs->trans("No");
else
{
$yesno='No';
}
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);
$triggers = $interfaces->getTriggersList(array((($objMod->isCoreOrExternalModule() == 'external')?'/'.$moduledir:'').'/core/triggers'));
foreach($triggers as $triggercursor)
{
if ($triggercursor['module'] == $moduledir)
{
$yesno='Yes';
$moreinfoontriggerfile=' ('.$triggercursor['relpath'].')';
}
}
$text.=$langs->trans($yesno).$moreinfoontriggerfile;
$text.='<br>';

View File

@@ -100,7 +100,7 @@ elseif ($action == 'update_currency')
if ($submit == $langs->trans('Modify'))
{
$fk_multicurrency = GETPOST('fk_multicurrency', 'int');
$rate = GETPOST('rate', 'float');
$rate = price2num(GETPOST('rate', 'alpha'));
$currency = new MultiCurrency($db);
if ($currency->fetch($fk_multicurrency) > 0)

View File

@@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
@@ -103,6 +103,7 @@ else if ($action == 'delete')
exit;
}
/*
* View
*/

View File

@@ -260,11 +260,11 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Code",$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("IP",$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("User",$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Description",$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";

View File

@@ -128,12 +128,12 @@ if ($savehandler == 'files')
{
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SessionId"),$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateModification"),$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Age"),$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Raw"),$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Login",$_SERVER["PHP_SELF"],"login","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("SessionId",$_SERVER["PHP_SELF"],"id","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateModification",$_SERVER["PHP_SELF"],"datem","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Age",$_SERVER["PHP_SELF"],"age","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Raw",$_SERVER["PHP_SELF"],"raw","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@@ -141,7 +141,7 @@ if ($savehandler == 'files')
foreach ($listofsessions as $key => $sessionentry)
{
print '<tr class="oddeven">';

View File

@@ -235,10 +235,10 @@ if ($mode == 'overwrite')
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("NewTranslationStringToShow"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("NewTranslationStringToShow",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print '<td align="center"></td>';
print "</tr>\n";
@@ -393,10 +393,10 @@ if ($mode == 'searchkey')
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CurrentTranslationString"),$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre( $langs->trans("Language").' (en_US, es_MX, ...)',$_SERVER["PHP_SELF"],'lang,transkey','',$param,'',$sortfield,$sortorder).'</td>';
print_liste_field_titre("Key",$_SERVER["PHP_SELF"],'transkey','',$param,'',$sortfield,$sortorder);
print_liste_field_titre("CurrentTranslationString",$_SERVER["PHP_SELF"],'transvalue','',$param,'',$sortfield,$sortorder);
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity",$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
print '<td align="center"></td>';
print "</tr>\n";

View File

@@ -73,7 +73,7 @@ $tablib[1] = "Websites";
// Requests to extract data
$tabsql=array();
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.virtualhost, f.status FROM ".MAIN_DB_PREFIX."website as f";
// Criteria to sort dictionaries
$tabsqlsort=array();
@@ -81,15 +81,15 @@ $tabsqlsort[1] ="ref ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[1] = "ref,description";
$tabfield[1] = "ref,description,virtualhost";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[1] = "ref,description";
$tabfieldvalue[1] = "ref,description,virtualhost";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[1] = "ref,description,entity";
$tabfieldinsert[1] = "ref,description,virtualhost,entity";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@@ -103,7 +103,7 @@ $tabcond[1] = (! empty($conf->websites->enabled));
// List of help for fields
$tabhelp=array();
$tabhelp[1] = array();
$tabhelp[1] = array('ref'=>$langs->trans("EnterAnyCode"), 'virtualhost'=>$langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/websites/<i>websiteref</i>'));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@@ -114,7 +114,7 @@ $tabfieldcheck[1] = array();
$elementList = array();
$sourceList=array();
// Actions add or modify an entry into a dictionary
// Actions add or modify a website
if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
{
$listfield=explode(',',$tabfield[$id]);
@@ -126,12 +126,25 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
$ok=1;
foreach ($listfield as $f => $value)
{
if (! isset($_POST[$value]) || $_POST[$value]=='') // Fields that are not mandatory
if ((! isset($_POST[$value]) || $_POST[$value]=='')
&& (! in_array($listfield[$f], array('virtualhost')))) // Fields that are not mandatory
{
$ok=0;
$fieldnamekey=$listfield[$f];
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
if ($value == 'ref' && ! preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
{
$ok=0;
$fieldnamekey=$listfield[$f];
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Clean parameters
if (! empty($_POST['ref']))
{
$websitekey=strtolower($_POST['ref']);
}
// Si verif ok et action add, on ajoute la ligne
@@ -153,6 +166,12 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
}
}
/* $website=new Website($db);
$website->ref=
$website->description=
$website->virtualhost=
$website->create($user); */
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
@@ -171,6 +190,9 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($value == 'ref') {
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
}
if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null";
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
@@ -182,6 +204,29 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha'))
$result = $db->query($sql);
if ($result) // Add is ok
{
global $dolibarr_main_data_root;
$pathofwebsite=$dolibarr_main_data_root.'/websites/'.$websitekey;
$filehtmlheader=$pathofwebsite.'/htmlheader.html';
$filecss=$pathofwebsite.'/styles.css.php';
$filetpl=$pathofwebsite.'/page'.$pageid.'.tpl.php';
$fileindex=$pathofwebsite.'/index.php';
// Css file
$csscontent = '<!-- BEGIN DOLIBARR-WEBSITE-ADDED-HEADER -->'."\n";
$csscontent.= '<!-- File generated to wrap the css file - YOU CAN MODIFY DIRECTLY THE FILE styles.css.php. Change affects all pages of website. -->'."\n";
$csscontent.= '<?php '."\n";
$csscontent.= "header('Content-type: text/css');\n";
$csscontent.= "?>"."\n";
$csscontent.= '<!-- END -->'."\n";
$csscontent.= 'body { margin: 0; }'."\n";
dol_syslog("Save file css into ".$filecss);
dol_mkdir($pathofwebsite);
$result = file_put_contents($filecss, $csscontent);
if (! empty($conf->global->MAIN_UMASK))
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
unset($_POST); // Clean $_POST array, we keep only
}
@@ -393,7 +438,11 @@ if ($id)
{
print '<td class="'.$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>';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
elseif (! empty($tabhelp[$id][$value]))
{
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
}
else print $valuetoshow;
print '</td>';
}

View File

@@ -238,6 +238,7 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json'
{
$classfile = str_replace('_', '', $module);
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
if ($module == 'supplierorders') $classfile = 'supplier_orders';
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
$classname=ucwords($module);

View File

@@ -101,19 +101,19 @@ if ($resql)
if ($optioncss != '') $param ='&optioncss='.$optioncss;
$moreforfilter='';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print "<tr class=\"liste_titre\">";
//print "<td>&nbsp;</td>";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Link"),'','');
print_liste_field_titre($langs->trans("Target"),'','','','','align="center"');
print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"title","", $param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Link",'','');
print_liste_field_titre("Target",'','','','','align="center"');
print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Position",$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@@ -122,7 +122,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
// Id
@@ -209,7 +209,7 @@ if ($resql)
}
print "</table>";
print '</div>';
$db->free($resql);
}
else

View File

@@ -42,24 +42,24 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
*/
class Categorie extends CommonObject
{
// Categories types
const TYPE_PRODUCT = 0; // TODO Replace with value 'product'
const TYPE_SUPPLIER = 1; // TODO Replace this value with 'supplier'
const TYPE_CUSTOMER = 2; // TODO Replace this value with 'customer'
const TYPE_MEMBER = 3; // TODO Replace this value with 'member'
const TYPE_CONTACT = 4; // TODO Replace this value with 'contact'
const TYPE_USER = 4; // categorie contact and user are same ! TODO Replace this value with 'user'
const TYPE_ACCOUNT = 5; // TODO Replace this value with 'bank_account'
const TYPE_PROJECT = 6; // TODO Replace this value with 'project'
// Categories types (we use string because we want to accept any modules/types in a future)
const TYPE_PRODUCT = 'product';
const TYPE_SUPPLIER = 'supplier';
const TYPE_CUSTOMER = 'customer';
const TYPE_MEMBER = 'member';
const TYPE_CONTACT = 'contact';
const TYPE_USER = 'user';
const TYPE_PROJECT = 'project';
const TYPE_ACCOUNT = 'bank_account';
const TYPE_BANK_LINE = 'bank_line';
public $picto = 'category';
/**
* @var array ID mapping from type string
*
* @note This array should be remove in future, once previous constants are moved to the string value.
* @note This array should be remove in future, once previous constants are moved to the string value. Deprecated
*/
private $MAP_ID = array(
'product' => 0,
@@ -67,10 +67,21 @@ class Categorie extends CommonObject
'customer' => 2,
'member' => 3,
'contact' => 4,
'user' => 4,
'account' => 5,
'project' => 6,
'user' => 7,
);
public static $MAP_ID_TO_CODE = array(
0 => 'product',
1 => 'supplier',
2 => 'customer',
3 => 'member',
4 => 'contact',
5 => 'account',
6 => 'project',
7 => 'user',
);
/**
* @var array Foreign keys mapping from type string
*
@@ -82,9 +93,9 @@ class Categorie extends CommonObject
'supplier' => 'soc',
'member' => 'member',
'contact' => 'socpeople',
'user' => 'user',
'account' => 'account',
'project' => 'project',
'user' => 'user',
'account' => 'account',
'project' => 'project',
);
/**
* @var array Category tables mapping from type string
@@ -97,9 +108,9 @@ class Categorie extends CommonObject
'supplier' => 'fournisseur',
'member' => 'member',
'contact' => 'contact',
'user' => 'user',
'account' => 'account',
'project' => 'project',
'user' => 'user',
'account' => 'account',
'project' => 'project',
);
/**
* @var array Object class mapping from type string
@@ -113,8 +124,8 @@ class Categorie extends CommonObject
'member' => 'Adherent',
'contact' => 'Contact',
'user' => 'User',
'account' => 'Account',
'project' => 'Project',
'account' => 'Account',
'project' => 'Project',
);
/**
* @var array Object table mapping from type string
@@ -128,8 +139,8 @@ class Categorie extends CommonObject
'member' => 'adherent',
'contact' => 'socpeople',
'user' => 'user',
'account' => 'bank_account',
'project' => 'projet',
'account' => 'bank_account',
'project' => 'projet',
);
public $element='category';
@@ -178,15 +189,16 @@ class Categorie extends CommonObject
*
* @param int $id Id of category
* @param string $label Label of category
* @param string $type Type of category
* @param string $type Type of category ('product', '...') or (0, 1, ...)
* @return int <0 if KO, >0 if OK
*/
function fetch($id,$label='',$type='')
function fetch($id, $label='', $type=null)
{
global $conf;
// Check parameters
if (empty($id) && empty($label)) return -1;
if (! is_numeric($type)) $type=$this->MAP_ID[$type];
$sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie";
@@ -197,7 +209,7 @@ class Categorie extends CommonObject
else
{
$sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")";
if ($type) $sql.= " AND type = '".$this->db->escape($type)."'";
if (! is_null($type)) $sql.= " AND type = ".$this->db->escape($type);
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@@ -254,6 +266,10 @@ class Categorie extends CommonObject
global $conf,$langs,$hookmanager;
$langs->load('categories');
$type=$this->type;
if (! is_numeric($type)) $type=$this->MAP_ID[$type];
$error=0;
dol_syslog(get_class($this).'::create', LOG_DEBUG);
@@ -299,7 +315,7 @@ class Categorie extends CommonObject
$sql.= ($this->socid != -1 ? $this->socid : 'null').",";
}
$sql.= "'".$this->visible."',";
$sql.= $this->type.",";
$sql.= $type.",";
$sql.= (! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":'null').",";
$sql.= $conf->entity;
$sql.= ")";
@@ -618,12 +634,11 @@ class Categorie extends CommonObject
/**
* Link an object to the category
*
* @param CommonObject $obj Object to link to category
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
*
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
* @param CommonObject $obj Object to link to category
* @param string $type Type of category ('product', ...)
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/
function add_type($obj,$type)
function add_type($obj, $type)
{
global $user,$langs,$conf;
@@ -840,13 +855,12 @@ class Categorie extends CommonObject
/**
* Check for the presence of an object in a category
*
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @param int $object_id id of the object to search
*
* @return int number of occurrences
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member')
* @param int $object_id Id of the object to search
* @return int Number of occurrences
* @see getObjectsInCateg
*/
function containsObject($type, $object_id )
function containsObject($type, $object_id)
{
$sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type];
$sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id;
@@ -933,24 +947,16 @@ class Categorie extends CommonObject
* fulllabel = nom avec chemin complet de la categorie
* fullpath = chemin complet compose des id
*
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member').
* Old mode (0, 1, 2, ...) is deprecated.
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
* @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...).
* @param int $markafterid Removed all categories including the leaf $markafterid in category tree.
*
* @return array Array of categories. this->cats and this->motherof are set.
* @return array Array of categories. this->cats and this->motherof are set.
*/
function get_full_arbo($type, $markafterid=0)
{
global $conf, $langs;
// For backward compatibility
if (is_numeric($type))
{
// We want to reverse lookup
$map_type = array_flip($this->MAP_ID);
$type = $map_type[$type];
dol_syslog( get_class( $this ) . "::get_full_arbo(): numeric types are deprecated, please use string instead", LOG_WARNING);
}
if (! is_numeric($type)) $type = $this->MAP_ID[$type];
$this->cats = array();
@@ -964,7 +970,7 @@ class Categorie extends CommonObject
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c";
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'";
$sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")";
$sql .= " AND c.type = " . $this->MAP_ID[$type];
$sql .= " AND c.type = " . $type;
dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -1088,7 +1094,7 @@ class Categorie extends CommonObject
/**
* Returns all categories
*
* @param int $type Type of category
* @param int $type Type of category (0, 1, ...)
* @param boolean $parent Just parent categories if true
* @return array Table of Object Category
*/
@@ -1151,13 +1157,17 @@ class Categorie extends CommonObject
*/
function already_exists()
{
$type=$this->type;
if (! is_numeric($type)) $type=$this->MAP_ID[$type];
/* We have to select any rowid from llx_categorie which category's mother and label
* are equals to those of the calling category
*/
$sql = "SELECT c.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as c ";
$sql.= " WHERE c.entity IN (".getEntity('category').")";
$sql.= " AND c.type = ".$this->type;
$sql.= " AND c.type = ".$type;
$sql.= " AND c.fk_parent = ".$this->fk_parent;
$sql.= " AND c.label = '".$this->db->escape($this->label)."'";
@@ -1192,7 +1202,7 @@ class Categorie extends CommonObject
/**
* Returns the top level categories (which are not girls)
*
* @param int $type Type of category
* @param int $type Type of category (0, 1, ...)
* @return array
*/
function get_main_categories($type=null)
@@ -1330,24 +1340,17 @@ class Categorie extends CommonObject
* Return list of categories (object instances or labels) linked to element of id $id and type $type
* Should be named getListOfCategForObject
*
* @param int $id Id of element
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs
* @return mixed Array of category objects or < 0 if KO
* @param int $id Id of element
* @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...)
* @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels, 'id'= Get array of category IDs
* @return mixed Array of category objects or < 0 if KO
*/
function containing($id, $type, $mode='object')
{
$cats = array();
// For backward compatibility
if (is_numeric($type))
{
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
// We want to reverse lookup
$map_type = array_flip($this->MAP_ID);
$type = $map_type[$type];
}
if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type];
if ($type == Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code
{

View File

@@ -39,6 +39,8 @@ $id=GETPOST('id','int');
$type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
$catname=GETPOST('catname','alpha');
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
/*
* View
@@ -53,8 +55,8 @@ elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCat
elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');

View File

@@ -42,6 +42,8 @@ $type=GETPOST('type');
$action=GETPOST('action','aZ09');
$confirm=GETPOST('confirm');
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
if ($id == "")
{
dol_print_error('','Missing parameter id');
@@ -100,15 +102,16 @@ if ($object->id)
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
else $title=$langs->trans("Category");
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'photos', $title, -1, 'category');
$linkback = '<a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("BackToList").'</a>';
$object->ref = $object->label;
$morehtmlref='<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
$ways = $object->print_all_ways(" &gt;&gt; ", '', 1);
@@ -117,9 +120,9 @@ if ($object->id)
$morehtmlref.=$way."<br>\n";
}
$morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
/*
* Confirmation de la suppression de photo
*/
@@ -129,7 +132,7 @@ if ($object->id)
}
print '<br>';
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
@@ -148,7 +151,7 @@ if ($object->id)
print "</table>\n";
print '</div>';
print dol_fiche_end();
@@ -258,7 +261,7 @@ if ($object->id)
}
print '</table>';
if ($nbphoto < 1)
{
print '<div class="opacitymedium">'.$langs->trans("NoPhotoYet")."</div>";

View File

@@ -35,11 +35,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories");
$langs->load("languages");
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action=GETPOST('action','alpha');
$cancel=GETPOST('cancel','alpha');
$type=GETPOST('type');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha');
$cancel = GETPOST('cancel','alpha');
$type = GETPOST('type','aZ09');
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
// Security check
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
@@ -153,6 +155,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("UsersCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);
@@ -256,9 +259,9 @@ if ($action == 'edit')
print '</table>';
}
}
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@@ -271,7 +274,7 @@ if ($action == 'edit')
else if ($action != 'add')
{
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
if (! empty($object->multilangs))
{
foreach ($object->multilangs as $key => $value)

View File

@@ -34,13 +34,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$langs->load("categories");
$id=GETPOST('id','int');
$label=GETPOST('label');
$type=GETPOST('type');
$id = GETPOST('id','int');
$label= GETPOST('label','alpha');
$type = GETPOST('type','az09');
$action=GETPOST('action','aZ09');
$confirm=GETPOST('confirm');
$confirm = GETPOST('confirm','alpha');
$removeelem = GETPOST('removeelem','int');
$elemid=GETPOST('elemid');
$elemid = GETPOST('elemid','alpha');
if ($id == "" && $label == "")
{
@@ -61,6 +61,7 @@ if ($result <= 0)
}
$type=$object->type;
if (is_numeric($type)) $type=Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility
$extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
@@ -187,6 +188,7 @@ elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategor
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesShort");
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesShort");
elseif ($type == Categorie::TYPE_USER) $title=$langs->trans("ProjectsCategoriesShort");
else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type);

View File

@@ -38,11 +38,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
if (! empty($conf->projet->enabled))
{
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
@@ -585,6 +582,8 @@ if ($action == 'mupdate')
* View
*/
$formproject=new FormProjets($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
@@ -786,8 +785,6 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Projet associe
$langs->load("projects");
@@ -1133,8 +1130,6 @@ if ($id > 0)
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
$langs->load("projects");
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td>';

View File

@@ -1194,7 +1194,7 @@ class ActionComm extends CommonObject
{
$libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
}
$result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend;
$result.=$linkstart.img_object(($notooltip?'':$langs->trans("ShowAction").': '.$libelle), ($overwritepicto?$overwritepicto:'action'), ($notooltip?'class="valigntextbottom"':'class="classfortooltip valigntextbottom"'), 0, 0, $notooltip?0:1).$linkend;
}
if ($withpicto==1) $result.=' ';
$result.=$linkstart.$libelleshort.$linkend;
@@ -1498,5 +1498,22 @@ class ActionComm extends CommonObject
return $this->datep && ($this->datep < ($now - $conf->agenda->warning_delay));
}
/**
* Send reminders by emails
* CAN BE A CRON TASK
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
public function sendEmailsReminder()
{
global $conf, $langs;
dol_syslog(__METHOD__, LOG_DEBUG);
return 0;
}
}

View File

@@ -394,17 +394,17 @@ if ($resql)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"a.id",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder);
//if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre($langs->trans("LinkedObject"),$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedByShort"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("DateStart",$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateEnd",$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("ThirdParty",$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Contact",$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
if (! empty($conf->global->AGENDA_SHOW_LINKED_OBJECT)) print_liste_field_titre("LinkedObject",$_SERVER["PHP_SELF"],"a.fk_element",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("ActionsOwnedByShort",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("");
print "</tr>\n";

View File

@@ -30,15 +30,17 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
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;
$filter = GETPOST("filter",'',3);
$filter = GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
@@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page","int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
@@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
$status=GETPOST("status");
$type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$status=GETPOST("status",'alpha');
$type=GETPOST("type",'alpha');
$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)
if (GETPOST('actioncode','array'))
{
@@ -93,22 +95,22 @@ if (GETPOST('actioncode','array'))
}
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("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));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
if ($dateselect > 0)
{
$day=GETPOST('dateselectday');
$month=GETPOST('dateselectmonth');
$year=GETPOST('dateselectyear');
$day=GETPOST('dateselectday','int');
$month=GETPOST('dateselectmonth','int');
$year=GETPOST('dateselectyear','int');
}
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
$tmparray=explode('-',$tmp);
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
if ($end_h < 1 || $end_h > 24) $end_h = 18;
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
@@ -124,13 +126,13 @@ if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $ac
if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
if (GETPOST('viewweek') || $action == 'show_week') {
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week
if (GETPOST('viewday') || $action == 'show_day') {
if (GETPOST('viewday','alpha') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
} // View by day
if (GETPOST('viewyear') || $action == 'show_year') {
if (GETPOST('viewyear','alpha') || $action == 'show_year') {
$action='show_year';
} // View by year
@@ -161,12 +163,12 @@ if ($action =='delete_action')
* View
*/
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$form=new Form($db);
$companystatic=new Societe($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$now=dol_now();
$nowarray=dol_getdate($now);
$nowyear=$nowarray['year'];
@@ -354,7 +356,7 @@ $sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
$sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@@ -456,11 +458,14 @@ if ($resql)
continue;
}
$datep=$db->jdate($obj->datep);
$datep2=$db->jdate($obj->datep2);
// Create a new object action
$event=new ActionComm($db);
$event->id=$obj->id;
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2);
$event->datep=$datep; // datep and datef are GMT date
$event->datef=$datep2;
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
@@ -469,12 +474,13 @@ if ($resql)
//$event->author->id=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
$event->fetch_userassigned(); // This load $event->userassigned
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
$event->fk_project=$obj->fk_project;
$event->socid=$obj->fk_soc;
$event->contactid=$obj->fk_contact;
//$event->societe->id=$obj->fk_soc; // deprecated
@@ -487,15 +493,15 @@ if ($resql)
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0)
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
else
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
{
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
@@ -508,10 +514,14 @@ if ($resql)
$event->date_start_in_calendar >= $lastdaytoshow)
{
// This record is out of visible range
unset($event);
}
else
{
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
$event->fetch_userassigned(); // This load $event->userassigned
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
// Add an entry in actionarray for each day
@@ -881,11 +891,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases1[$h][$event->id]['string'].=' - '.$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases1[$h][$event->id]['string'].='xxx';
}
$cases1[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@@ -901,11 +937,37 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
$cases2[$h][$event->id]['string'].=' - '.$event->label;
$cases2[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases2[$h][$event->id]['string'].='xxx';
}
$cases2[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
}
else
@@ -928,6 +990,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s
}
}
// Now output $casesX
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';

View File

@@ -30,15 +30,17 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
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;
$filter = GETPOST("filter",'',3);
$filter = GETPOST("filter",'alpha',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
@@ -55,7 +57,7 @@ $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page","int");
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$offset = $limit * $page;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="a.datec";
@@ -82,9 +84,9 @@ $month=GETPOST("month","int")?GETPOST("month","int"):date("m");
$week=GETPOST("week","int")?GETPOST("week","int"):date("W");
$day=GETPOST("day","int")?GETPOST("day","int"):date("d");
$pid=GETPOST("projectid","int",3);
$status=GETPOST("status");
$type=GETPOST("type");
$maxprint=(isset($_GET["maxprint"])?GETPOST("maxprint"):$conf->global->AGENDA_MAX_EVENTS_DAY_VIEW);
$status=GETPOST("status",'alpha');
$type=GETPOST("type",'alpha');
$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)
if (GETPOST('actioncode','array'))
{
@@ -93,29 +95,30 @@ if (GETPOST('actioncode','array'))
}
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("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));
}
if ($actioncode == '' && empty($actioncodearray)) $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth','int'), GETPOST('dateselectday','int'), GETPOST('dateselectyear','int'));
if ($dateselect > 0)
{
$day=GETPOST('dateselectday');
$month=GETPOST('dateselectmonth');
$year=GETPOST('dateselectyear');
$day=GETPOST('dateselectday','int');
$month=GETPOST('dateselectmonth','int');
$year=GETPOST('dateselectyear','int');
}
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_HOURS)?'9-18':$conf->global->MAIN_DEFAULT_WORKING_HOURS;
$tmparray=explode('-',$tmp);
$begin_h = GETPOST('begin_h')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h')?GETPOST('end_h'):($tmparray[1] != '' ? $tmparray[1] : 18);
$begin_h = GETPOST('begin_h','int')!=''?GETPOST('begin_h','int'):($tmparray[0] != '' ? $tmparray[0] : 9);
$end_h = GETPOST('end_h','int')?GETPOST('end_h','int'):($tmparray[1] != '' ? $tmparray[1] : 18);
if ($begin_h < 0 || $begin_h > 23) $begin_h = 9;
if ($end_h < 1 || $end_h > 24) $end_h = 18;
if ($end_h <= $begin_h) $end_h = $begin_h + 1;
$tmp=empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)?'1-5':$conf->global->MAIN_DEFAULT_WORKING_DAYS;
$tmparray=explode('-',$tmp);
$begin_d = GETPOST('begin_d')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
$end_d = GETPOST('end_d')?GETPOST('end_d'):($tmparray[1] != '' ? $tmparray[1] : 5);
$begin_d = GETPOST('begin_d','int')?GETPOST('begin_d','int'):($tmparray[0] != '' ? $tmparray[0] : 1);
$end_d = GETPOST('end_d','int')?GETPOST('end_d','int'):($tmparray[1] != '' ? $tmparray[1] : 5);
if ($begin_d < 1 || $begin_d > 7) $begin_d = 1;
if ($end_d < 1 || $end_d > 7) $end_d = 7;
if ($end_d < $begin_d) $end_d = $begin_d + 1;
@@ -123,13 +126,13 @@ if ($end_d < $begin_d) $end_d = $begin_d + 1;
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 (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
if (GETPOST('viewcal','alpha') && $action != 'show_day' && $action != 'show_week' && $action != 'show_peruser') {
$action='show_month'; $day='';
} // View by month
if (GETPOST('viewweek') || $action == 'show_week') {
if (GETPOST('viewweek','alpha') || $action == 'show_week') {
$action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d"));
} // View by week
if (GETPOST('viewday') || $action == 'show_day') {
if (GETPOST('viewday','alpha') || $action == 'show_day') {
$action='show_day'; $day=($day?$day:date("d"));
} // View by day
@@ -160,12 +163,12 @@ if ($action =='delete_action')
* View
*/
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$form=new Form($db);
$companystatic=new Societe($db);
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&oacute;dulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url);
$now=dol_now();
$nowarray=dol_getdate($now);
$nowyear=$nowarray['year'];
@@ -361,7 +364,7 @@ $sql.= ' a.datep2,';
$sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype,';
$sql.= ' a.fk_soc, a.fk_contact, a.fk_element, a.elementtype, a.fk_project,';
$sql.= ' ca.code, ca.color';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
@@ -418,14 +421,14 @@ else
{
// To limit array
$sql.= " AND (";
$sql.= " (a.datep BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'"; // Start 7 days before
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')"; // End 7 days after + 3 to go from 28 to 31
$sql.= " (a.datep BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'"; // Start 2 day before $firstdaytoshow
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')"; // End 2 day after $lastdaytoshow
$sql.= " OR ";
$sql.= " (a.datep2 BETWEEN '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
$sql.= " AND '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
$sql.= " (a.datep2 BETWEEN '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
$sql.= " AND '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
$sql.= " OR ";
$sql.= " (a.datep < '".$db->idate(dol_mktime(0,0,0,$month,1,$year)-(60*60*24*7))."'";
$sql.= " AND a.datep2 > '".$db->idate(dol_mktime(23,59,59,$month,28,$year)+(60*60*24*10))."')";
$sql.= " (a.datep < '".$db->idate($firstdaytoshow-(60*60*24*2))."'";
$sql.= " AND a.datep2 > '".$db->idate($lastdaytoshow+(60*60*24*2))."')";
$sql.= ')';
}
if ($type) $sql.= " AND ca.id = ".$type;
@@ -444,13 +447,14 @@ if ($filtert > 0 || $usergroup > 0)
}
// Sort on date
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
//print $sql;
//print $sql;exit;
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i=0;
while ($i < $num)
{
@@ -463,11 +467,14 @@ if ($resql)
continue;
}
$datep=$db->jdate($obj->datep);
$datep2=$db->jdate($obj->datep2);
// Create a new object action
$event=new ActionComm($db);
$event->id=$obj->id;
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2);
$event->datep=$datep; // datep and datef are GMT date
$event->datef=$datep2;
$event->type_code=$obj->code;
$event->type_color=$obj->color;
//$event->libelle=$obj->label; // deprecated
@@ -476,12 +483,13 @@ if ($resql)
//$event->author->id=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner
$event->fetch_userassigned(); // This load $event->userassigned
$event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location;
$event->transparency=$obj->transparency;
$event->fk_project=$obj->fk_project;
$event->socid=$obj->fk_soc;
$event->contactid=$obj->fk_contact;
//$event->societe->id=$obj->fk_soc; // deprecated
@@ -494,15 +502,15 @@ if ($resql)
// They are date start and end of action but modified to not be outside calendar view.
if ($event->percentage <= 0)
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
else
{
$event->date_start_in_calendar=$event->datep;
if ($event->datef != '' && $event->datef >= $event->datep) $event->date_end_in_calendar=$event->datef;
else $event->date_end_in_calendar=$event->datep;
$event->date_start_in_calendar=$datep;
if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar=$datep2;
else $event->date_end_in_calendar=$datep;
}
// Define ponctual property
if ($event->date_start_in_calendar == $event->date_end_in_calendar)
@@ -515,10 +523,14 @@ if ($resql)
$event->date_start_in_calendar >= $lastdaytoshow)
{
// This record is out of visible range
unset($event);
}
else
{
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
//print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'<br>'."\n";
$event->fetch_userassigned(); // This load $event->userassigned
if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar=$firstdaytoshow;
if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar=($lastdaytoshow - 1);
// Add an entry in actionarray for each day
@@ -548,6 +560,7 @@ if ($resql)
$i++;
}
$db->free($resql);
}
else
{
@@ -865,11 +878,12 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
global $theme_datacolor; // Array with a list of different we can use (come from theme)
global $cachethirdparties, $cachecontacts, $colorindexused;
global $begin_h, $end_h;
global $cache_project, $cache_thirdparty, $cache_contact;
$cases1 = array(); // Color first half hour
$cases2 = array(); // Color second half hour
$curtime = dol_mktime(0, 0, 0, $month, $day, $year);
$curtime = dol_mktime(0, 0, 0, $month, $day, $year, false, 0);
$i=0; $nummytasks=0; $numother=0; $numbirthday=0; $numical=0; $numicals=array();
$ymd=sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day);
@@ -980,13 +994,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
else $cases1[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
}
$cases1[$h][$event->id]['string'].=' - '.$event->label;
if ($event->label) $cases1[$h][$event->id]['string'].=' - '.$event->label;
$cases1[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases1[$h][$event->id]['string'].='xxx';
}
$cases1[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases1[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases1[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases1[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
if ($event->date_start_in_calendar < $c && $dateendtouse > $b)
{
@@ -1000,13 +1040,39 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
if ($tmpa['mday'] == $tmpb['mday'] && $tmpa['mon'] == $tmpb['mon'] && $tmpa['year'] == $tmpb['year']) $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'hour');
else $cases2[$h][$event->id]['string'].='-'.dol_print_date($event->date_end_in_calendar,'dayhour');
}
$cases2[$h][$event->id]['string'].=' - '.$event->label;
if ($event->label) $cases2[$h][$event->id]['string'].=' - '.$event->label;
$cases2[$h][$event->id]['typecode']=$event->type_code;
if ($event->socid)
{
//$cases2[$h][$event->id]['string'].='xxx';
}
$cases2[$h][$event->id]['color']=$color;
if ($event->fk_project > 0)
{
if (empty($cache_project[$event->fk_project]))
{
$tmpproj=new Project($db);
$tmpproj->fetch($event->fk_project);
$cache_project[$event->fk_project]=$tmpproj;
}
$cases2[$h][$event->id]['string'].=', '.$langs->trans("Project").': '.$cache_project[$event->fk_project]->ref.' - '.$cache_project[$event->fk_project]->title;
}
if ($event->socid > 0)
{
if (empty($cache_thirdparty[$event->socid]))
{
$tmpthirdparty=new Societe($db);
$tmpthirdparty->fetch($event->socid);
$cache_thirdparty[$event->socid]=$tmpthirdparty;
}
$cases2[$h][$event->id]['string'].=', '.$cache_thirdparty[$event->socid]->name;
}
if ($event->contactid > 0)
{
if (empty($cache_contact[$event->contactid]))
{
$tmpcontact=new Contact($db);
$tmpcontact->fetch($event->contactid);
$cache_contact[$event->contactid]=$tmpcontact;
}
$cases2[$h][$event->id]['string'].=', '.$cache_contact[$event->contactid]->getFullName($langs);
}
}
}
else
@@ -1029,6 +1095,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
}
}
// Now output $casesX
for ($h = $begin_h; $h < $end_h; $h++)
{
$color1='';$color2='';

View File

@@ -603,11 +603,17 @@ if ($id > 0)
if ($link) $boxstat.='</a>';
}
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);
if(empty($reshook)){
$boxstat.= $hookmanager->resPrint;
}
$boxstat.='</td></tr>';
$boxstat.='</table>';
$boxstat.='</div>';
print $boxstat;
print $boxstat;
$now=dol_now();

View File

@@ -126,14 +126,14 @@ if ($resql)
print_barre_liste($title.($label?" (".$label.")":""),$page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,"",$num);
print '<form action="'.$_SERVER["PHP_SELF"].'?type='.GETPOST("type", "alpha").'" method="GET">';
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Email"));
print_liste_field_titre($langs->trans("Phone"));
print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"p.name", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"p.firstname", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom", $begin, $param,"",$sortfield,$sortorder);
print_liste_field_titre("Email");
print_liste_field_titre("Phone");
print "</tr>\n";
print '<tr class="liste_titre">';
@@ -150,7 +150,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$obj->cidp.'&socid='.$obj->rowid.'">'.img_object($langs->trans("ShowContact"),"contact");
@@ -168,9 +168,9 @@ if ($resql)
$i++;
}
print "</table>";
print '</form>';
$db->free($resql);
}
else

View File

@@ -184,12 +184,12 @@ if ($object->fetch($id) >= 0)
$morehtmlright='';
if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') ';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
@@ -221,7 +221,7 @@ if ($object->fetch($id) >= 0)
print "</div>";
dol_fiche_end();
$allowaddtarget=($object->statut == 0);
@@ -232,7 +232,7 @@ if ($object->fetch($id) >= 0)
//print '<table class="noborder" width="100%">';
print '<div class="tagtable centpercent liste_titre_bydiv" id="tablelines">';
//print '<tr class="liste_titre">';
print '<div class="tagtr liste_titre">';
//print '<td class="liste_titre">'.$langs->trans("RecipientSelectionModules").'</td>';
@@ -245,11 +245,11 @@ if ($object->fetch($id) >= 0)
print '<div class="tagtd">&nbsp;</div>';
//print "</tr>\n";
print '</div>';
clearstatcache();
$var = true;
foreach ($modulesdir as $dir)
{
$modulenames=array();
@@ -324,7 +324,7 @@ if ($object->fetch($id) >= 0)
print $obj->getDesc();
//print '</td>';
print '</div>';
try {
$nbofrecipient=$obj->getNbOfRecipients('');
}
@@ -345,7 +345,7 @@ if ($object->fetch($id) >= 0)
}
//print '</td>';
print '</div>';
//print '<td align="left">';
print '<div class="tagtd" align="left">';
if ($allowaddtarget)
@@ -362,7 +362,7 @@ if ($object->fetch($id) >= 0)
}
//print '</td>';
print '</div>';
//print '<td align="right">';
print '<div class="tagtd" align="right">';
if ($allowaddtarget)
@@ -377,10 +377,10 @@ if ($object->fetch($id) >= 0)
}
//print '</td>';
print '</div>';
if ($allowaddtarget) print '</form>';
else print '</div>';
//print "</tr>\n";
// print '</div>'."\n";
}
@@ -389,7 +389,7 @@ if ($object->fetch($id) >= 0)
//print '</table>';
print '</div>';
print '<br><br>';
}
@@ -412,11 +412,11 @@ if ($object->fetch($id) >= 0)
}
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
$sql .= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$param = "&amp;id=".$object->id;
@@ -436,7 +436,7 @@ if ($object->fetch($id) >= 0)
$cleartext=$langs->trans("ToClearAllRecipientsClickHere").' '.'<a href="'.$_SERVER["PHP_SELF"].'?clearlist=1&id='.$object->id.'" class="button reposition">'.$langs->trans("TargetsReset").'</a>';
}
print_barre_liste($langs->trans("MailSelectedRecipients"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$cleartext,$num,$nbtotalofrecords,'title_generic',0,'','',$limit);
print '</form>';
print "\n<!-- Liste destinataires selectionnes -->\n";
@@ -447,12 +447,12 @@ if ($object->fetch($id) >= 0)
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="limit" value="'.$limit.'">';
if ($page) $param.= "&amp;page=".$page;
print '<table class="noborder" width="100%">';
// Ligne des champs de filtres
print '<tr class="liste_titre_filter">';
// EMail
@@ -475,7 +475,7 @@ if ($object->fetch($id) >= 0)
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
// Date sending
print '<td class="liste_titre">';
print '&nbsp';
@@ -490,13 +490,13 @@ if ($object->fetch($id) >= 0)
print $searchpicto;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("EMail",$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Lastname",$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Firstname",$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("OtherInformations",$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Source",$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
@@ -504,9 +504,9 @@ if ($object->fetch($id) >= 0)
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
@@ -590,7 +590,7 @@ if ($object->fetch($id) >= 0)
}
else
{
if ($object->statut < 2)
if ($object->statut < 2)
{
print '<tr><td colspan="8" class="opacitymedium">';
print $langs->trans("NoTargetYet");

View File

@@ -124,7 +124,7 @@ class AdvanceTargetingMailing extends CommonObject
$sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->fk_mailing."'").",";
$sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").",";
$sql.= " ".$user->id.",";
$sql.= " ".$this->db->idate(dol_now()).",";
$sql.= " '".$this->db->idate(dol_now())."',";
$sql.= " ".$user->id;

View File

@@ -109,7 +109,7 @@ if ($result)
$param = "&amp;sall=".urlencode($sall);
if ($filteremail) $param.='&amp;filteremail='.urlencode($filteremail);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@@ -117,9 +117,9 @@ if ($result)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$moreforfilter = '';
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
@@ -142,24 +142,24 @@ if ($result)
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Title"),$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre($langs->trans("NbOfEMails"),$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"m.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("Title",$_SERVER["PHP_SELF"],"m.titre",$param,"","",$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"m.date_creat",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre("NbOfEMails",$_SERVER["PHP_SELF"],"m.nbemail",$param,"",'align="center"',$sortfield,$sortorder);
if (! $filteremail) print_liste_field_titre("DateLastSend",$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
else print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$email=new Mailing($db);
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
print "<tr>";
print '<td><a href="'.DOL_URL_ROOT.'/comm/mailing/card.php?id='.$obj->rowid.'">';

View File

@@ -1750,6 +1750,7 @@ if ($action == 'create')
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
// Project
if (! empty($conf->projet->enabled))
{

View File

@@ -24,14 +24,14 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
/**
* API class for orders
*
* @access protected
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Proposals extends DolibarrApi
{
/**
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid'
@@ -56,36 +56,36 @@ class Proposals extends DolibarrApi
* Get properties of a commercial proposal object
*
* Return an array with commercial proposal informations
*
*
* @param int $id ID of commercial proposal
* @return array|mixed data without useless information
*
* @throws RestException
*/
function get($id)
{
{
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->propal->fetchObjectLinked();
return $this->_cleanObjectDatas($this->propal);
}
/**
* List commercial proposals
*
*
* Get a list of commercial proposals
*
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
@@ -96,12 +96,12 @@ class Proposals extends DolibarrApi
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
@@ -109,7 +109,7 @@ class Proposals extends DolibarrApi
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."propal as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('propal').')';
@@ -122,7 +122,7 @@ class Proposals extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@@ -131,7 +131,7 @@ class Proposals extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -144,7 +144,7 @@ class Proposals extends DolibarrApi
}
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
@@ -195,7 +195,7 @@ class Proposals extends DolibarrApi
if ($this->propal->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating order", array_merge(array($this->propal->error), $this->propal->errors));
}
return $this->propal->id;
}
@@ -203,21 +203,21 @@ class Proposals extends DolibarrApi
* Get lines of a commercial proposal
*
* @param int $id Id of commercial proposal
*
*
* @url GET {id}/lines
*
* @return int
*
* @return int
*/
function getLines($id) {
if(! DolibarrApiAccess::$user->rights->propal->lire) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -233,22 +233,22 @@ class Proposals extends DolibarrApi
* Add a line to given commercial proposal
*
* @param int $id Id of commercial proposal to update
* @param array $request_data Commercial proposal line data
*
* @param array $request_data Commercial proposal line data
*
* @url POST {id}/lines
*
* @return int
*
* @return int
*/
function postLine($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -294,22 +294,22 @@ class Proposals extends DolibarrApi
*
* @param int $id Id of commercial proposal to update
* @param int $lineid Id of line to update
* @param array $request_data Commercial proposal line data
*
* @param array $request_data Commercial proposal line data
*
* @url PUT {id}/lines/{lineid}
*
* @return object
*
* @return object
*/
function putLine($id, $lineid, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -352,21 +352,21 @@ class Proposals extends DolibarrApi
*
* @param int $id Id of commercial proposal to update
* @param int $lineid Id of line to delete
*
*
* @url DELETE {id}/lines/{lineid}
*
* @return int
*
* @return int
*/
function delLine($id, $lineid) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -382,20 +382,20 @@ class Proposals extends DolibarrApi
* Update commercial proposal general fields (won't touch lines of commercial proposal)
*
* @param int $id Id of commercial proposal to update
* @param array $request_data Datas
*
* @return int
* @param array $request_data Datas
*
* @return int
*/
function put($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->propal->creer) {
throw new RestException(401);
}
$result = $this->propal->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -403,18 +403,18 @@ class Proposals extends DolibarrApi
if ($field == 'id') continue;
$this->propal->$field = $value;
}
if($this->propal->update($id, DolibarrApiAccess::$user,1,'','','update'))
return $this->get($id);
return false;
}
/**
* Delete commercial proposal
*
* @param int $id Commercial proposal ID
*
*
* @return array
*/
function delete($id)
@@ -426,32 +426,32 @@ class Proposals extends DolibarrApi
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( ! $this->propal->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete Commercial Proposal : '.$this->propal->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Commercial Proposal deleted'
)
);
}
/**
* Validate a commercial proposal
*
*
* @param int $id Commercial proposal ID
* @param int $notrigger Use {}
*
*
* @url POST {id}/validate
*
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
@@ -469,11 +469,11 @@ class Proposals extends DolibarrApi
if( ! $result ) {
throw new RestException(404, 'Commercial Proposal not found');
}
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->propal->valid(DolibarrApiAccess::$user, $notrigger);
if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated');
@@ -481,30 +481,30 @@ class Proposals extends DolibarrApi
if ($result < 0) {
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Commercial Proposal validated'
'message' => 'Commercial Proposal validated (Ref='.$this->propal->ref.')'
)
);
}
/**
* Validate fields before create or update object
*
*
* @param array $data Array with data to verify
* @return array
* @return array
* @throws RestException
*/
function _validate($data)
{
$propal = array();
foreach (Orders::$FIELDS as $field) {
foreach (Proposals::$FIELDS as $field) {
if (!isset($data[$field]))
throw new RestException(400, "$field field missing");
$propal[$field] = $data[$field];
}
return $propal;
}

View File

@@ -73,9 +73,9 @@ $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$viewstatut=GETPOST('viewstatut');
$viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha');
$object_statut=GETPOST('propal_statut');
$object_statut=GETPOST('propal_statut','alpha');
$sall=GETPOST('sall', 'alphanohtml');
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
@@ -355,6 +355,7 @@ if ($resql)
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfProposals') . ' - '.$soc->name;
if (empty($search_societe)) $search_societe = $soc->name;
}
else
{
@@ -733,7 +734,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@@ -1924,6 +1924,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherOrders").'</a>)';
// Project
if (! empty($conf->projet->enabled))
{

View File

@@ -80,8 +80,8 @@ class Orders extends DolibarrApi
return $this->_cleanObjectDatas($this->commande);
}
/**
* List orders
*
@@ -101,7 +101,7 @@ class Orders extends DolibarrApi
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
@@ -125,7 +125,7 @@ class Orders extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@@ -134,7 +134,7 @@ class Orders extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -490,7 +490,7 @@ class Orders extends DolibarrApi
return array(
'success' => array(
'code' => 200,
'message' => 'Order validated'
'message' => 'Order validated (Ref='.$this->commande->ref.')'
)
);
}
@@ -502,14 +502,14 @@ class Orders extends DolibarrApi
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->address);
return $object;
}
/**
* Validate fields before create or update object
*

View File

@@ -1000,7 +1000,7 @@ class Commande extends CommonOrder
$this->db->begin();
// get extrafields so they will be clone
// get lines so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);

View File

@@ -120,11 +120,11 @@ if ($resql)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("Town",$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("AccountancyCode",$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Lignes des champs de filtre
@@ -146,7 +146,7 @@ if ($resql)
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>\n";
$var=true;
@@ -155,7 +155,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>';

View File

@@ -578,6 +578,7 @@ if ($resql)
$soc = new Societe($db);
$soc->fetch($socid);
$title = $langs->trans('ListOfOrders') . ' - '.$soc->name;
if (empty($search_company)) $search_company = $soc->name;
}
else
{
@@ -1035,7 +1036,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@@ -602,12 +602,12 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),'','','','','align="right"');
print_liste_field_titre($langs->trans('GenerateBill'),'','','','','align="center"');
print_liste_field_titre('Ref',$_SERVER["PHP_SELF"],'c.ref','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre('RefCustomerOrder',$_SERVER["PHP_SELF"],'c.ref_client','','&amp;socid='.$socid,'',$sortfield,$sortorder);
print_liste_field_titre('OrderDate',$_SERVER["PHP_SELF"],'c.date_commande','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre('DeliveryDate',$_SERVER["PHP_SELF"],'c.date_livraison','','&amp;socid='.$socid, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre('Status','','','','','align="right"');
print_liste_field_titre('GenerateBill','','','','','align="center"');
print '</tr>';
// Lignes des champs de filtre

View File

@@ -605,7 +605,7 @@ if ($resql)
// print '<td>';
print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
print '<input class="flat" id="num_releve" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
print '</div>';
if ($options) {
print $langs->trans("EventualyAddCategory").': ';
@@ -649,6 +649,16 @@ if ($resql)
{
dol_print_error($db);
}
/**
* Using BANK_REPORT_LAST_NUM_RELEVE to automatically report last num (or not)
*/
if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE == 1) {
print '
<script type="text/javascript">
$("#num_releve").val("' . $last_releve . '");
</script>
';
}
print '<br><br>';
// print '</td></tr></table>';
}
@@ -896,7 +906,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
@@ -1117,7 +1127,16 @@ if ($resql)
// Date ope
if (! empty($arrayfields['b.dateo']['checked']))
{
print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
print '<td align="center" class="nowrap">';
print '<span id="dateoperation_'.$objp->rowid.'">'.dol_print_date($db->jdate($objp->do),"day")."</span>";
print '&nbsp;';
print '<span class="inline-block">';
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_remove() . "</a> ";
print '<a class="ajax" href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;account='.$objp->bankid.'&amp;rowid='.$objp->rowid.'">';
print img_edit_add() ."</a>";
print '</span>';
print "</td>\n";
if (! $i) $totalarray['nbfield']++;
}

View File

@@ -1959,6 +1959,67 @@ class AccountLine extends CommonObject
}
/**
* Increase/decrease operation date of a rowid
*
* @param int $rowid Id of line
* @param int $sign 1 or -1
* @return int >0 if OK, 0 if KO
*/
function dateo_change($rowid,$sign=1)
{
$sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid;
$resql = $this->db->query($sql);
if ($resql)
{
$obj=$this->db->fetch_object($resql);
$newdate=$this->db->jdate($obj->dateo)+(3600*24*$sign);
$sql = "UPDATE ".MAIN_DB_PREFIX."bank SET";
$sql.= " dateo = '".$this->db->idate($newdate)."'";
$sql.= " WHERE rowid = ".$rowid;
$result = $this->db->query($sql);
if ($result)
{
if ($this->db->affected_rows($result))
{
return 1;
}
}
else
{
dol_print_error($this->db);
return 0;
}
}
else dol_print_error($this->db);
return 0;
}
/**
* Increase operation date of a rowid
*
* @param int $id Id of line to change
* @return int >0 if OK, 0 if KO
*/
function dateo_next($id)
{
return $this->dateo_change($id,1);
}
/**
* Decrease operation date of a rowid
*
* @param int $id Id of line to change
* @return int >0 if OK, 0 if KO
*/
function dateo_previous($id)
{
return $this->dateo_change($id,-1);
}
/**
* Load miscellaneous information for tab "Info"
*

View File

@@ -72,7 +72,7 @@ class BankAccounts extends DolibarrApi
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t";
$sql.= ' WHERE t.entity IN ('.getEntity('bank_account').')';
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@@ -81,7 +81,7 @@ class BankAccounts extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $this->db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -89,10 +89,10 @@ class BankAccounts extends DolibarrApi
$page = 0;
}
$offset = $limit * $page;
$sql.= $this->db->plimit($limit + 1, $offset);
}
dol_syslog("API Rest request");
$result = $this->db->query($sql);
@@ -236,7 +236,7 @@ class BankAccounts extends DolibarrApi
function _validate($data)
{
$account = array();
foreach (Accounts::$FIELDS as $field) {
foreach (BankAccounts::$FIELDS as $field) {
if (! isset($data[$field]))
throw new RestException(400, "$field field missing");
$account[$field] = $data[$field];

View File

@@ -86,9 +86,9 @@ class PaymentVarious extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " sens=".$this->sens.",";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " fk_typepayment=".$this->fk_typepayment."',";

View File

@@ -418,7 +418,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}
@@ -492,12 +492,10 @@ foreach ($accounts as $key=>$type)
// Account number
if (! empty($arrayfields['b.account_number']['checked']))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$acc->account_number);
print '<td>'.length_accountg($accountingaccount->getNomUrl(0,1,1,'',1)).'</td>';
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
if (! $i) $totalarray['nbfield']++;
}

View File

@@ -71,13 +71,20 @@ if ($cancel)
}
}
if ($user->rights->banque->consolidate && $action == 'dvnext')
if ($user->rights->banque->consolidate && $action == 'donext')
{
$al = new AccountLine($db);
$al->dateo_next($_GET["rowid"]);
}elseif ($user->rights->banque->consolidate && $action == 'doprev')
{
$al = new AccountLine($db);
$al->dateo_previous($_GET["rowid"]);
}elseif ($user->rights->banque->consolidate && $action == 'dvnext')
{
$al = new AccountLine($db);
$al->datev_next($_GET["rowid"]);
}
if ($user->rights->banque->consolidate && $action == 'dvprev')
}elseif ($user->rights->banque->consolidate && $action == 'dvprev')
{
$al = new AccountLine($db);
$al->datev_previous($_GET["rowid"]);
@@ -479,6 +486,14 @@ if ($result)
{
print '<td>';
print $form->select_date($db->jdate($objp->do),'dateo','','','','update',1,0,1,$objp->rappro);
if (! $objp->rappro)
{
print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=doprev&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
print img_edit_remove() . "</a> ";
print '<a href="'.$_SERVER['PHP_SELF'].'?action=donext&amp;id='.$id.'&amp;rowid='.$objp->rowid.'">';
print img_edit_add() ."</a>";
}
print '</td>';
}
else

View File

@@ -275,6 +275,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$refcomp=$societestatic->getNomUrl(1,'',24);
$paiement = $facturestatic->getSommePaiement(); // Payment already done
$paiement+= $facturestatic->getSumDepositsUsed();
$paiement+= $facturestatic->getSumCreditNotesUsed();
}
if ($obj->family == 'social_contribution')
{

View File

@@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy"));
@@ -70,7 +71,7 @@ if (empty($reshook))
{
if ($action != 'addlink')
{
$urltogo=$backtopage?$backtopage:dol_buildpath('/mymodule/myobject_list.php',1);
$urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/index.php',1);
header("Location: ".$urltogo);
exit;
}
@@ -172,7 +173,7 @@ if (empty($reshook))
if ($result >= 0)
{
$db->commit();
header("Location: ".DOL_URL_ROOT.'/compta/salaries/index.php');
header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/index.php');
exit;
}
else
@@ -339,9 +340,9 @@ if ($id)
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/various_payment/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
print "<tr>";
print "<tr>";
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
@@ -349,11 +350,13 @@ if ($id)
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->label.'</td></tr>';
// Payment date
print "<tr>";
print '<td>'.$langs->trans("DatePayment").'</td><td>';
print dol_print_date($object->datep,'day');
print '</td></tr>';
// Value date
print '<tr><td>'.$langs->trans("DateValue").'</td><td>';
print dol_print_date($object->datev,'day');
print '</td></tr>';
@@ -370,11 +373,10 @@ if ($id)
print '</td><td>';
if (! empty($conf->accounting->enabled))
{
$accountancyaccount = new AccountingAccount($db);
$accountancyaccount->fetch('',$object->accountancy_code);
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->accountancy_code);
print $accountancyaccount->getNomUrl(1);
// print length_accountg($object->accountancy_code);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->accountancy_code;
}
@@ -411,7 +413,7 @@ if ($id)
print '<div class="tabsAction">'."\n";
if ($object->rappro == 0)
{
if (! empty($user->rights->banque->delete))
if (! empty($user->rights->banque->modifier))
{
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
}

View File

@@ -17,18 +17,18 @@
*/
/**
* \file htdocs/compta/bank/various_payment/index.php
* \file htdocs/compta/bank/various_payment/index.php
* \ingroup bank
* \brief List of various payments
* \brief List of various payments
*/
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
$langs->load("compta");
$langs->load("banks");
$langs->load("bills");
$langs->loadLangs(array("compta","banks","bills","accountancy"));
// Security check
$socid = GETPOST("socid","int");
@@ -41,7 +41,8 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$search_ref = GETPOST('search_ref','int');
$search_user = GETPOST('search_user','alpha');
$search_label = GETPOST('search_label','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_amount_deb = GETPOST('search_amount_deb','alpha');
$search_amount_cred = GETPOST('search_amount_cred','alpha');
$search_account = GETPOST('search_account','int');
$sortfield = GETPOST("sortfield",'alpha');
@@ -75,7 +76,8 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
{
$search_ref="";
$search_label="";
$search_amount="";
$search_amount_deb="";
$search_amount_cred="";
$search_account='';
$typeid="";
}
@@ -90,8 +92,8 @@ $form = new Form($db);
$variousstatic = new PaymentVarious($db);
$accountstatic = new Account($db);
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.fk_accountancy_journal, ba.label as blabel,";
$sql = "SELECT v.rowid, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,";
$sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,";
$sql.= " pst.code as payment_code";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON v.fk_typepayment = pst.id";
@@ -102,7 +104,8 @@ $sql.= " WHERE v.entity = ".$conf->entity;
// Search criteria
if ($search_ref) $sql.=" AND v.rowid=".$search_ref;
if ($search_label) $sql.=natural_search(array('v.label'), $search_label);
if ($search_amount) $sql.=natural_search("v.amount", $search_amount, 1);
if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1);
if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1);
if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($filtre) {
$filtre=str_replace(":","=",$filtre);
@@ -113,7 +116,6 @@ if ($typeid) {
}
$sql.= $db->order($sortfield,$sortorder);
//$sql.= " GROUP BY u.rowid, u.lastname, u.firstname, v.rowid, v.fk_user, v.amount, v.label, v.datev, v.fk_typepayment, v.num_payment, pst.code";
$totalnboflines=0;
$result=$db->query($sql);
if ($result)
@@ -151,29 +153,35 @@ if ($result)
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("BankAccount"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Sens"),$_SERVER["PHP_SELF"],"v.sens","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
// Ref
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
print '</td>';
// Label
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_label" value="'.$search_label.'"></td>';
// Date
print '<td class="liste_titre">&nbsp;</td>';
// Type
print '<td class="liste_titre" align="left">';
$form->select_types_paiements($typeid,'typeid','',0,0,1,16);
print '</td>';
// Account
if (! empty($conf->banque->enabled))
{
@@ -181,10 +189,15 @@ if ($result)
$form->select_comptes($search_account,'search_account',0,'',1);
print '</td>';
}
// Amount
print '<td class="liste_titre" align="right"><input name="search_amount" class="flat" type="text" size="8" value="'.$search_amount.'"></td>';
// Sens
print '<td class="liste_titre">&nbsp;</td>';
// Accounting account
if (! empty($conf->accounting->enabled)) print '<td class="liste_titre">&nbsp;</td>';
// Debit
print '<td class="liste_titre" align="right"><input name="search_amount_deb" class="flat" type="text" size="8" value="'.$search_amount_deb.'"></td>';
// Credit
print '<td class="liste_titre" align="right"><input name="search_amount_cred" class="flat" type="text" size="8" value="'.$search_amount_cred.'"></td>';
print '<td class="liste_titre" align="right">';
$searchpicto=$form->showFilterAndCheckAddButtons(0);
@@ -193,6 +206,7 @@ if ($result)
print "</tr>\n";
$totalarray=array();
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
@@ -201,50 +215,81 @@ if ($result)
$variousstatic->id=$obj->rowid;
$variousstatic->ref=$obj->rowid;
// Ref
print "<td>".$variousstatic->getNomUrl(1)."</td>\n";
// Label payment
print "<td>".dol_trunc($obj->label,40)."</td>\n";
// Date payment
print '<td align="center">'.dol_print_date($db->jdate($obj->datep),'day')."</td>\n";
// Type
print '<td>'.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.'</td>';
// Account
if (! empty($conf->banque->enabled))
{
print '<td>';
if ($obj->fk_bank > 0)
{
//$accountstatic->fetch($obj->fk_bank);
$accountstatic->id=$obj->bid;
$accountstatic->ref=$obj->bref;
$accountstatic->number=$obj->bnumber;
$accountstatic->accountancy_number=$obj->account_number;
$accountstatic->fk_accountancy_journal=$obj->fk_accountancy_journal;
if (! empty($conf->accounting->enabled)) {
$accountstatic->account_number=$obj->bank_account_number;
$accountingjournal = new AccountingJournal($db);
$accountingjournal->fetch($obj->accountancy_journal);
$accountstatic->accountancy_journal = $accountingjournal->code;
}
$accountstatic->label=$obj->blabel;
print $accountstatic->getNomUrl(1);
}
else print '&nbsp;';
print '</td>';
}
// Amount
print "<td align=\"right\">".price($obj->amount)."</td>";
// Sens
if ($obj->sens == '1') $sens = $langs->trans("Credit"); else $sens = $langs->trans("Debit");
print "<td align=\"right\">".$sens."</td>";
print "<td></td>";
print "</tr>\n";
$total = $total + $obj->amount;
// Accounting account
if (! empty($conf->accounting->enabled)) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$obj->accountancy_code);
print '<td>'.$accountingaccount->getNomUrl(0,1,1,'',1).'</td>';
}
// Debit
print "<td align=\"right\">";
if ($obj->sens == 0)
{
print price($obj->amount);
$totalarray['totaldeb'] += $obj->amount;
}
print "</td>";
// Credit
print "<td align=\"right\">";
if ($obj->sens == 1)
{
print price($obj->amount);
$totalarray['totalcred'] += $obj->amount;
}
print "</td>";
print "<td></td>";
$i++;
}
$colspan=4;
$colspan=5;
if (! empty($conf->banque->enabled)) $colspan++;
print '<tr class="liste_total">';
print '<td colspan="'.$colspan.'" class="liste_total">'.$langs->trans("Total").'</td>';
print '<td class="liste_total" align="right">'.price($total)."</td>";
print '<td class="liste_total" align="right">'.price($totalarray['totaldeb'])."</td>";
print '<td class="liste_total" align="right">'.price($totalarray['totalcred'])."</td>";
print '<td></td>';
print '<td></td>';
print '</tr>';

View File

@@ -92,7 +92,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
if ($mode != 'sconly')
if ($mode != 'sconly')
{
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
print_barre_liste($title,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,$center,$num,$totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
@@ -120,15 +120,15 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pc.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pc.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pc.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT c.id, c.libelle as lib,";
@@ -278,14 +278,14 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@@ -294,7 +294,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
@@ -309,12 +309,12 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
// Date
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
// Type payment
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Account
if (! empty($conf->banque->enabled))
{
@@ -333,7 +333,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
else print '&nbsp;';
print '</td>';
}
// Paid
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";
@@ -411,11 +411,11 @@ while($j<$numlt)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@@ -424,7 +424,7 @@ while($j<$numlt)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\n";
@@ -465,8 +465,8 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$sal = new PaymentSalary($db);
print "<br>";
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
print_fiche_titre( $langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
$sql = "SELECT s.rowid, s.amount, s.label, s.datep as datep, s.datev as datev, s.datesp, s.dateep, s.salary, s.fk_bank, u.salary as current_salary,";
$sql.= " pct.code as payment_code,";
@@ -493,13 +493,13 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$total = 0 ;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder);
if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)
@@ -508,7 +508,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";
@@ -527,7 +527,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
print '<td>';
if ($obj->payment_code) print $langs->trans("PaymentTypeShort".$obj->payment_code).' ';
print $obj->num_payment.'</td>';
// Account
if (! empty($conf->banque->enabled))
{
@@ -546,7 +546,7 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read)
else print '&nbsp;';
print '</td>';
}
// Paid
print '<td align="right">'.price($obj->amount)."</td>";
print "</tr>\n";

View File

@@ -69,7 +69,7 @@ if ($action == 'note')
$result = $db->query($sql);
}
if ($mode == 'search')
if ($mode == 'search')
{
$resql=$db->query($sql);
if ($resql) {
@@ -144,11 +144,11 @@ if ($resql)
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("Town",$_SERVER["PHP_SELF"],"s.town","","",'valign="center"',$sortfield,$sortorder);
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("AccountancyCode",$_SERVER["PHP_SELF"],"s.code_compta","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre("DateCreation",$_SERVER["PHP_SELF"],"datec",$addu,"",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
// Lignes des champs de filtre
@@ -178,7 +178,7 @@ if ($resql)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>';

View File

@@ -133,12 +133,12 @@ if ($resql)
print '<form method="get" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("FeesKilometersOrAmout"),$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"d.rowid","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"d.type","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"d.dated","","&socid=$socid",'align="center"',$sortfield,$sortorder);
print_liste_field_titre("Person",$_SERVER["PHP_SELF"],"u.lastname","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid",'',$sortfield,$sortorder);
print_liste_field_titre("FeesKilometersOrAmout",$_SERVER["PHP_SELF"],"d.km","","&socid=$socid",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
@@ -178,7 +178,7 @@ if ($resql)
$soc = new Societe($db);
if ($obj->socid) $soc->fetch($obj->socid);
print '<tr class="oddeven">';
// Id
print '<td><a href="card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowTrip"),"trip").' '.$obj->rowid.'</a></td>';

View File

@@ -400,6 +400,22 @@ if (empty($reshook))
setEventMessages($discount->error, $discount->errors, 'errors');
}
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$ret = $object->fetch($id); // Reload to get new records
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
}
}
else if ($action == 'setref_client' && $user->rights->facture->creer)
@@ -1105,8 +1121,17 @@ if (empty($reshook))
foreach ($amountdeposit as $tva => $amount)
{
$arraylist = array('amount' => 'FixAmount','variable' => 'VarAmount');
$descline = $langs->trans('Deposit');
$descline.= ' - '.$langs->trans($arraylist[$typeamount]);
if ($typeamount=='amount') {
$descline.= ' ('. price($valuedeposit, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).')';
} elseif ($typeamount=='variable') {
$descline.= ' ('. $valuedeposit.'%)';
}
$descline.= ' - '.$srcobject->ref;
$result = $object->addline(
$langs->trans('Deposit'),
$descline,
$amount, // subprice
1, // quantity
$tva, // vat rate
@@ -1128,8 +1153,8 @@ if (empty($reshook))
0,
0,
0,
0,
$langs->trans('Deposit')
0
//,$langs->trans('Deposit') //Deprecated
);
}
@@ -1440,7 +1465,7 @@ if (empty($reshook))
{
if (GETPOST('type') < 0 && ! GETPOST('search_idprod'))
{
setEventMessages($langs->trans('ErrorChooseBetweenFreeAntryOrPredefinedProduct'), null, 'errors');
setEventMessages($langs->trans('ErrorChooseBetweenFreeEntryOrPredefinedProduct'), null, 'errors');
$error ++;
}
}
@@ -3075,6 +3100,7 @@ else if ($id > 0 || ! empty($ref))
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherBills").'</a>)';
// Project
if (! empty($conf->projet->enabled))
{

View File

@@ -22,14 +22,14 @@
/**
* API class for invoices
*
* @access protected
* @access protected
* @class DolibarrApiAccess {@requires user,external}
*/
class Invoices extends DolibarrApi
{
/**
*
* @var array $FIELDS Mandatory fields, checked when create and update object
* @var array $FIELDS Mandatory fields, checked when create and update object
*/
static $FIELDS = array(
'socid'
@@ -54,23 +54,23 @@ class Invoices extends DolibarrApi
* Get properties of a invoice object
*
* Return an array with invoice informations
*
*
* @param int $id ID of invoice
* @return array|mixed data without useless information
*
* @throws RestException
*/
function get($id)
{
{
if(! DolibarrApiAccess::$user->rights->facture->lire) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -80,9 +80,9 @@ class Invoices extends DolibarrApi
/**
* List invoices
*
*
* Get a list of invoices
*
*
* @param string $sortfield Sort field
* @param string $sortorder Sort order
* @param int $limit Limit for list
@@ -96,12 +96,12 @@ class Invoices extends DolibarrApi
*/
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') {
global $db, $conf;
$obj_ret = array();
// case of external user, $thirdparty_ids param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him
$search_sale = 0;
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
@@ -109,7 +109,7 @@ class Invoices extends DolibarrApi
$sql = "SELECT t.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."facture as t";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('facture').')';
@@ -117,7 +117,7 @@ class Invoices extends DolibarrApi
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Filter by status
if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)";
if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)";
@@ -129,7 +129,7 @@ class Invoices extends DolibarrApi
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
if ($sqlfilters)
if ($sqlfilters)
{
if (! DolibarrApi::_checkFilters($sqlfilters))
{
@@ -138,7 +138,7 @@ class Invoices extends DolibarrApi
$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
$sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
}
$sql.= $db->order($sortfield, $sortorder);
if ($limit) {
if ($page < 0)
@@ -174,10 +174,10 @@ class Invoices extends DolibarrApi
}
return $obj_ret;
}
/**
* Create invoice object
*
*
* @param array $request_data Request datas
* @return int ID of invoice
*/
@@ -188,7 +188,7 @@ class Invoices extends DolibarrApi
}
// Check mandatory fields
$result = $this->_validate($request_data);
foreach($request_data as $field => $value) {
$this->invoice->$field = $value;
}
@@ -203,7 +203,7 @@ class Invoices extends DolibarrApi
}
$this->invoice->lines = $lines;
}*/
if ($this->invoice->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating invoice", array_merge(array($this->invoice->error), $this->invoice->errors));
}
@@ -214,20 +214,20 @@ class Invoices extends DolibarrApi
* Update invoice
*
* @param int $id Id of invoice to update
* @param array $request_data Datas
* @return int
* @param array $request_data Datas
* @return int
*/
function put($id, $request_data = NULL)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
@@ -236,13 +236,13 @@ class Invoices extends DolibarrApi
if ($field == 'id') continue;
$this->invoice->$field = $value;
}
if($this->invoice->update($id, DolibarrApiAccess::$user))
return $this->get ($id);
return false;
}
/**
* Delete invoice
*
@@ -258,16 +258,16 @@ class Invoices extends DolibarrApi
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if( $this->invoice->delete($id) < 0)
{
throw new RestException(500);
}
return array(
'success' => array(
'code' => 200,
@@ -275,13 +275,76 @@ class Invoices extends DolibarrApi
)
);
}
/**
* Validate an order
*
* @param int $id Order ID
* @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
*
* @url POST {id}/validate
*
* @return array
* FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported."
* Workaround: send this in the body
* {
* "idwarehouse": 0,
* "notrigger": 0
* }
*/
function validate($id, $idwarehouse=0, $notrigger=0)
{
if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401);
}
$result = $this->invoice->fetch($id);
if( ! $result ) {
throw new RestException(404, 'Invoice not found');
}
if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$result = $this->invoice->validate(DolibarrApiAccess::$user, '', $idwarehouse, $notrigger);
if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated');
}
if ($result < 0) {
throw new RestException(500, 'Error when validating Invoice: '.$this->invoice->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Invoice validated (Ref='.$this->invoice->ref.')'
)
);
}
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function _cleanObjectDatas($object) {
$object = parent::_cleanObjectDatas($object);
unset($object->address);
return $object;
}
/**
* Validate fields before create or update object
*
*
* @param array|null $data Datas to validate
* @return array
*
*
* @throws RestException
*/
function _validate($data)
@@ -294,5 +357,5 @@ class Invoices extends DolibarrApi
}
return $invoice;
}
}

View File

@@ -748,6 +748,15 @@ class Facture extends CommonInvoice
// Charge facture source
$facture=new Facture($this->db);
$this->fetch_optionals();
if(!empty($this->array_options)){
$facture->array_options = $this->array_options;
}
foreach($this->lines as &$line){
$line->fetch_optionals();//fetch extrafields
}
$facture->fk_facture_source = $this->fk_facture_source;
$facture->type = $this->type;

View File

@@ -1311,7 +1311,7 @@ else
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('RIB');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon))
if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon))
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 colspan="3">';

View File

@@ -531,6 +531,7 @@ if ($resql)
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_societe)) $search_societe = $soc->name;
}
$param='&socid='.$socid;
@@ -978,7 +979,7 @@ if ($resql)
$align=$extrafields->getAlignFlag($key);
$sortonfield = "ef.".$key;
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
print_liste_field_titre($langs->trans($extralabels[$key]),$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
print_liste_field_titre($extralabels[$key],$_SERVER["PHP_SELF"],$sortonfield,"",$param,($align?'align="'.$align.'"':''),$sortfield,$sortorder);
}
}
}

View File

@@ -151,9 +151,9 @@ class Localtax extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."localtax SET";
$sql.= " localtaxtype=".$this->ltt.",";
$sql.= " tms=".$this->db->idate($this->tms).",";
$sql.= " datep=".$this->db->idate($this->datep).",";
$sql.= " datev=".$this->db->idate($this->datev).",";
$sql.= " tms='".$this->db->idate($this->tms)."',";
$sql.= " datep='".$this->db->idate($this->datep)."',";
$sql.= " datev='".$this->db->idate($this->datev)."',";
$sql.= " amount=".price2num($this->amount).",";
$sql.= " label='".$this->db->escape($this->label)."',";
$sql.= " note='".$this->db->escape($this->note)."',";

View File

@@ -854,10 +854,10 @@ if (! GETPOST('action','aZ09'))
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Invoice'),$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Type'),$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Amount'),$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";

View File

@@ -101,17 +101,17 @@ if ($resql)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"p.rowid","","",'width="60"',$sortfield,$sortorder);
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"dp","","",'width="80" align="center"',$sortfield,$sortorder);
print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"c.libelle","","","",$sortfield,$sortorder);
print_liste_field_titre("AmountTTC",$_SERVER["PHP_SELF"],"c.libelle","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
while ($i < min($num,$limit))
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/compta/paiement/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("ShowPayment"),"payment").' '.$objp->rowid.'</a></td>';
print '<td width="80" align="center">'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";

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