Merge pull request #1 from Dolibarr/develop

update
This commit is contained in:
Darkjeff 2015-07-14 09:27:16 +02:00
commit 003a155057
2134 changed files with 44771 additions and 33421 deletions

View File

@ -28,10 +28,10 @@ Restler 3.0 LGPL-3+ Yes
TCPDF 6.2.6 LGPL-3+ Yes PDF generation
JS libraries:
jQuery 1.8.2 MIT License Yes JS library
jQuery UI 1.9.1 GPL and MIT License Yes JS library plugin UI
jQuery 1.11.3 MIT License Yes JS library
jQuery UI 1.11.4 GPL and MIT License Yes JS library plugin UI
jQuery select2 3.5.2 GPL and Apache License Yes JS library plugin for sexier multiselect
jQuery blockUI 2.43 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery blockUI 2.70.0 GPL and MIT License Yes JS library plugin blockUI (to use ajax popups)
jQuery Colorpicker 1.1 MIT License Yes JS library for color picker for a defined list of colors
jQuery DataTables 1.9.4 BSD Yes JS library for tables output
jQuery FileUpload 5.0.3 GPL and MIT License Yes JS library to upload files

223
ChangeLog
View File

@ -11,29 +11,209 @@ make a Dolibarr upgrade.
***** ChangeLog for 3.8 compared to 3.7.* *****
For users:
- New: Add Option to not change date on cloning project
- New: Add check list from table for extrafield type
- New: Use new combobox.
- New: Add hidden option MAXTABS_IN_CARD.
- New: A default label is suggested for stock correction and transfer instead of empty string.
- Fix / Improve : [ bug #1747 ] Remove creation of batch 'Undefined'
- Add Weighted average price as default price for buying price for margin calculation. Add option
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
- Add extrafields on bank account cards.
- Added delay between mails in Newsletter module.
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user.
- Add experimental module ask supplier price to request supplier quotation.
- Add experimental module batch management.
- Fix: Corrected user timezone detection
FIX: #2519
FIX: #2758 Product::update sets product note to "null" when $prod->note is null
FIX: #2832: Fixed a problem with special characters in expense report PDF model
FIX: #2856 : Wrong table design
FIX: #2901
FIX: #2957 : missing $langs object for trigger
FIX: #2983 Load gravatar avatar images securely over HTTPS
FIX: #2987: removed dead function moneyMeter()
FIX: #3009: Better filtering to prevent SQL injection
FIX: #3009: Better filtering to prevent SQL injection
FIX: #3091 TotalHT amount in supplier order is bold unlike the rest of Dolibarr
FIX: #3138 - Too much visible thing when access is denied on public pages
FIX: #3173 Overlapping of shipment ref
FIX: Adding 5 more choice link into survey module was not working with chrome
FIX: bad calculation for stock value
FIX: Bad link to login page into email for password renewal.
FIX: Bad logo for status "Do not contact" of thirdparty.
FIX: Bad variable usage
FIX: Better management error into the color conversion functions
FIX: [bug #1883] missing field in SQL installation
FIX: Bug on order and supplier invoice numeration mask when use supplier code
FIX: Bug on order and supplier invoice numeration mask when use supplier code
FIX: button create payment hide if tax amount is less than 1
FIX: can receive new batch product on supplier order
FIX: can show print page after product save
FIX: Close #2835 Customer prices of a product shows incorrect history order
FIX: Close #2837 Product list table column header does not match column body
FIX: Close bug #2855 Wrong translation key in localtax report page
FIX: Close bug #2861 Undefined variable $res when migrating from 3.6.2 to 3.7.0
FIX: Close bug #2891 Category hooks do not work
FIX: Close bug #2900 Courtesy title is not stored in create thirdparty form
FIX: Close bug #2976: "Report" tab is the current tab but it is not marked as selected by the UI
FIX: Correct migration script
FIX: create contact with extrafiel is null when it is require
FIX: Description of contract line was not visible.
FIX: Correct path of loan class
FIX: Correct problem field with note - Add note_private & use wysiwyg editor
FIX: Edit in place of "Outstanding Limit"
FIX: Module Expense Report - Correct init
FIX: Update licence to GPLv3
FIX: End log must use same level then start log.
FIX: event for restricted user was restricted if company null
FIX: event not linked to contact on creation
FIX: Export of tags for contact and member
FIX: extrafields required on thirdparty
FIX: Force ref
FIX: Function expects an int, not a boolean
FIX: Function was expecting a boolean not a string
FIX: hide category if it's not enable
FIX: If supplier invoice block linked element is display after other block total HT amount is not reset to 0 and sum other block (like customer orders values)
FIX: jdate returning -62169955200 on x64 machine
FIX: Let ability to use IDPROF verifications even if new entry is "private"
FIX: migration error
FIX: moved built-in bug report system to GitHub Issues
FIX: Moved code to where the variable is defined
FIX: No check warehouse is provided if module stock is not enabled.
FIX: Payed invoices are showed as canceled FIX: Bad date filter on customer order
FIX: Ref/label of product on contract line was not visible, nor into page, nor into PDF.
FIX: Removed concatenation on undeclared variable
FIX: remove deprecated property 'libelle' on product object
FIX: Removed HTML file preventing PHP service
FIX: Removed undeclared variable
FIX: Removed undeclared variables
FIX: Removed unused variable
FIX: Replaced deprecated call
FIX: Replaced deprecated property
FIX: Save of filters into export profiles failed.
FIX: "script" balise with wrong syntax
FIX: send mail, copy sendto don't read the list of contact
FIX: top links menu have target attribute with wrong value
FIX: total amount in tpl linked object are not reset
FIX: Typo
FIX; Unknown field 'sc.fk_soc' in field list
FIX: update usergroup name
FIX: Variable declared boolean
FIX: Variable might not be traversable
FIX: We did a test on a permission to export contract when permission did not exists.
FIX: when mailing is deleted, the targets list was kept in database
FIX: when multicompany was enabled, this function didn't check just on the good entity (problem when both company use same mask)
FIX: When we automatically creta an order from a proposal with workflow module, if some extrafields of propal don't exist in order object, insertExtraFields() function tries to insert extrafields in unexistant column of commande_extrafields table.
FIX: When we clone a propal, if it has a project which is not assigned to a third, it was not on new propal because fk_project was always set to empty string if new propal is for another third.
FIX: when we create an agenda event with "Not applicable" status, it is automatically saved with "To do" status
FIX: width multiselect
FIX: Wrong type hinting
FIX: XSS security using the onerror and missing escapement on type of member page.
FIX: Missing visibility of static property
NEW: Add a button to purge criteria in user list
NEW: add all assigned users and all extrafields data in new event when we createFromClone
NEW: Add a new component to select categories/tags from the main edit page of product. The dedicated tab is also removed.
NEW: add an explorer for REST API consultation & documentation
NEW: Add a search field and report on hrm area
NEW: Add a tab document in donation card
NEW: Add bank account owner in invoice/proposal/orders footer
NEW: Add button to purge search criteria into list
NEW: Add close date and user for projects.
NEW: Add company information into category contact export
NEW: Add current salary on list of payment
NEW: add date value filter on account records list
NEW: Add exemple of setup for multitail to render dolibarr log files
NEW: Add filter on status on invoice list
NEW: Add filter on task ref and task label into list of tasks
NEW: Add filter on user contact or user task into task list
NEW: Add function dolCopyDir to copy directory with recursive content.
NEW: Add gender property managed on user card FIX: Better error messages when uploading photo of user when permission to write are not granted
NEW: Add help tooltips on fields of dictionary edit pages. Fix: visible list of tasks are for opened project only.
NEW: Add hidden option MAIN_MAILFORM_DISABLE_ENTERKEY to disable the key enter into the form to send email.
NEW: add hook in send mail
NEW: Add hooks on list of members to allow an external module to add more fields into list view.
NEW: Add hooks to allow an external module to complete list of events into calendar views.
NEW: Add opportunity amount on project card.
NEW: Add option THEME_ELDY_DISABLE_IMAGE to disable images into menu eldy.
NEW: add PDF icon on linked element into project
NEW: add "productpricecard" hook and uniformize code
NEW: Add ref and label of project into export
NEW: add restler framework First step to build REST API into Dolibarr
NEW: Add search box for supplier order search.
NEW: Add status into filters of graph
NEW: Add tab document on salaries payment
NEW: A link to the bugtracker can be enabled in the GUI
NEW: A module can add its entries into cron module.
NEW: autofocus on product selection dropdown list or search field
NEW: Backup and restore tool is easier to use
NEW: Can add all user of a project as user of a task, in one step.
NEW: Can add project search on left menu search area
NEW: Can assign a task to yourself to have it appear on timesheet
NEW: Can close a project that has draft status with no need to switch it to validate status before.
NEW: Can edit Background color for Top menu and Background color for table title line (works only with theme menu eldy).
NEW: Can edit email template using WYSIWYG editor
NEW: Can edit internal label of invoice even when closed (this is a private information)
NEW: Can edit list of prospect status for customers/prospects. Add a new entry into dictionary table to manage list fo status. Removed deprecated files.
NEW: Can filter on contact status in prospect list. Removed deprecated menu entry.
NEW: Can filter proposal on a tag of a product Enhance also the prototype test_arrays to include select form before table.
NEW: Can filter proposal, orders or invoices with criteria "contain at least one product with following tag"
NEW: Can install an external module from admin pages, if web server has permission for and if setup is ok for.
NEW: Can search on customer order amount into customer order list.
NEW: Can upload files on leave requests. Use more standard permissions.
NEW: Can use a "|" to make a OR search on several different criterias into text filters of tables.
NEW: Clean code into salary module, debug and add indexes NEW: Can filter on user list and salary payments on user with naural search.
NEW: clone action on agenda events
NEW: dev feature : replace conf filename with "conf" parameter on url by GET
NEW: display linked object in edit mode when we create an event from an order, propal...
NEW: Enhancement of module 'Notification by Email'. Show nb of notifications set. Can set several emails. Can set a threshold on amount for notifications. Add notification on supplier order validation.
NEW: Enhance prototype, project list and proposal list with new hook to have an external module able to add more fields.
NEW: Enhance the natural_search function so we can use it to search numeric fields with criteria with operator <>= inside (< 100, >= 1000)
NEW: Enter amount for withdraws requests
NEW: Feature request: A page to merge two thirdparties into one #2613
NEW: Feature to build a merged pdf with all unpaid invoice can work for paid invoices.
NEW: Filter "active" by default on user list. Fix label of permission of project module
NEW: For a contract line, price is no more mandatory.
NEW: Forms are using the tab look, even in creation mode.
NEW: Hidden option THEME_ELDY_USE_HOVER is stable enough to become officialy visible into setup.
NEW: If module salaries is on, you can set a hourly value for tome consumed by users. Each time a user enter its time consumed on a project, a calculation is done to provide the cost for human services. This value appears into the "Transversal view" of project.
NEW: Implement option SUPPLIER_ORDER_USE_DISPATCH_STATUS to add a status into each dispathing line of supplier order to "verify" a reception is ok. Status of order can be set to "total/done" only if line is verified.
NEW: Into the overview of projects, the name of thirdparty appears into combo lists of elements to link to project.
NEW: Introduce function dolGetFirstLineOfText
NEW: Introduce option SUPPLIER_ORDER_DOUBLE_APPROVAL to allow 2 approvals to make a supplier order approved. Activating this option introduce a new permission to the second level approval.
NEW: Introduce TCPDI as replacement of FPDI.
NEW: List of recent modified supplier product prices in Supplier card
NEW: Module notification should details of emails into confirm box, not only number.
NEW: On page to see/edit contact of an ojbect, the status of contact is visible (for both external and internal users).
NEW: Product stock and subproduct stock are independant
NEW: Propal merge product card PDF into azur
NEW: Rename install etape to step
NEW: Replace category edition page on members with new select2 component.
NEW: script to build API class from existing class
NEW: Show difference between timespent by everybody and time spent by user making timesheet into timesheet pages. NEW: Can enter start hours of task when creating timesheet
NEW: Show last official stable version into system - update page.
NEW: Show photo of logged user into login top right block. NEW: If no photo is available for user, we show a generic photo depending on gender
NEW: [T1758] Merge bank card & account card
NEW: [ task 1191 ] AJAX selector for projects
NEW: [ task #851 ] Add a new field: Commercial name
NEW: [ task #977 ] New option to manage product unit Migrated code from GPCSolutions/dolibarr:3.2-units branch and adapted for 3.8 with some improvements
NEW: The line where mouse is over can be highlight with option THEME_ELDY_USE_HOVER (on by default)
NEW: The notification module accept keyword __SUPERVISOR__ to send notification to supervisor of user.
NEW: Thumbs for statistics on main page are fully clicable (not only link inside the thumb)
NEW: Title of page project contains project ref and label
NEW: update skeleton and class builder
NEW: Use new select2 component for juridical status, country and state selection.
NEW: Web service to create or update product can correct stock during creation/update.
NEW: When creating order, proposal or invoice from thirdparty card, the project is asked during creation. A link to create project if it does not exists is also available. NEW: Uniformize form creation of proposal to add public and private notes during creation like done for order and invoice.
NEW: When using transfer or correct stock from warehouse, after recording we go back to the warehouse page.
NEW: Add Option to not change date on cloning project
NEW: Add check list from table for extrafield type
NEW: Use new combobox.
NEW: Add hidden option MAXTABS_IN_CARD.
NEW: A default label is suggested for stock correction and transfer instead of empty string.
NEW: Add Weighted average price as default price for buying price for margin calculation. Add option MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
NEW: Introduce option MAIN_HTML_TITLE to start to control format of html title content.
NEW: Add extrafields on bank account cards.
NEW: Added delay between mails in Newsletter module.
NEW: [ task #1793 ] Create new permission to restrict commercial agent margin to logged user.
NEW: Add experimental module ask supplier price to request supplier quotation.
NEW: Add module batch management.
For translators:
- Update language files.
- New: When a translation is not available we always jump to en_US and only en_US.
NEW: Update language files.
NEW: When a translation is not available we always jump to en_US and only en_US.
For developers:
- New: Function yn can show a visual checkbox.
- New: Introduced select2 jquery plugin.
NEW: Function yn can show a visual checkbox.
NEW: Introduced select2 jquery plugin.
NEW: Possibility to add javascript in main login page with "getLoginPageOptions" hook
NEW: possibility to defined a tab for all entities in module descriptor
WARNING: Following changes may create regression for some external modules, but was necessary to make
Dolibarr better:
@ -42,7 +222,10 @@ Dolibarr better:
- Hooks 'printLeftBlock' and 'formConfirm' are now compliant with hook development rules. They are
"addreplace" hooks, so you must return content with "->resprints='mycontent'" and not with "return 'mycontent'"
- All fields "fk_societe" were renamed into "fk_soc".
- Method select_PriceBaseType and load_PriceBaseType were merged into selectPriceBaseType
- Method select_PriceBaseType and load_PriceBaseType were merged into selectPriceBaseType.
- The trigger USER_LOGIN* are deprecated. They are still working but you should prefer use the
hook afterLogin or afterLoginFailed instead.
***** ChangeLog for 3.7.2 compared to 3.7.1 *****

View File

@ -38,6 +38,15 @@ filter-pristine-tar = True
END
# Complete .bashrc with DEBEMAIL and DEBFULLNAME
Example:
export DEBFULLNAME="Laurent Destailleur (eldy)"
export DEBEMAIL=eldy@users.sourceforge.net
Other example:
export DEBFULLNAME="Laurent Destailleur"
export DEBEMAIL="eldy@destailleur.fr"
# To use Alioth.debian.org
* Create an account login
* Update your ~/.ssh/config file to add:
@ -111,7 +120,7 @@ severity 123 xxx
##### Update but tracker system
To set status of a bug to "pending"
> bts tag 999999 +pending
> bts --smtp-host=yoursmtpserver tag 999999 +pending
or replay to email 999999@bugs.debian.org + submitter of bug
With a message starting with:

View File

@ -1,4 +1,4 @@
dolibarr (3.8.0-3) UNRELEASED; urgency=low
dolibarr (__VERSION__) UNRELEASED; urgency=low
[ Laurent Destailleur (eldy) ]
* New upstream release.

View File

@ -64,6 +64,13 @@ $DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
$SOURCE="$DIR/..";
$DESTI="$SOURCE/build";
if ($SOURCE !~ /^\//)
{
print "Error: Launch the script $PROG.$Extension with its full path from /.\n";
print "$PROG.$Extension aborted.\n";
sleep 2;
exit 1;
}
if (! $ENV{"DESTIBETARC"} || ! $ENV{"DESTISTABLE"})
{
print "Error: Missing environment variables.\n";
@ -337,8 +344,8 @@ foreach my $target (sort keys %CHOOSEDPUBLISH) {
if ($nboftargetok) {
# Update CVS if required
#-----------------------
# Update GIT tag if required
#---------------------------
if ($nbofpublishneedtag)
{
print "Go to directory $SOURCE\n";
@ -455,13 +462,15 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
# Removed known external modules to avoid any error when packaging from env where external modules are tested
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom/*`; # For custom we want to keep dir
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/cabinetmed*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/calling*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/lead*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
@ -681,7 +690,7 @@ if ($nboftargetok) {
use Date::Language;
$lang=Date::Language->new('English');
$datestring = $lang->time2str("%a %b %e %Y", time);
$changelogstring="* ".$datestring." Laurent Destailleur $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n";
$changelogstring="* ".$datestring." Laurent Destailleur (eldy) $MAJOR.$MINOR.$REL1-$RPMSUBVERSION\n- Upstream release\n";
print "Generate file $BUILDROOT/$BUILDFIC from $SOURCE/build/rpm/${BUILDFICSRC}\n";
open (SPECFROM,"<$SOURCE/build/rpm/${BUILDFICSRC}") || die "Error";
@ -713,7 +722,7 @@ if ($nboftargetok) {
$ret=`$cmd`;
print "Move $RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz into $NEWDESTI/".$FILENAMETGZ2.".tgz\n";
$cmd="mv \"$RPMDIR/SOURCES/".$FILENAMETGZ2.".tgz\" \"$NEWDESTI/".$FILENAMETGZ2.".tgz\"";
$ret=`$cmd`;
#$ret=`$cmd`;
next;
}
@ -803,8 +812,17 @@ if ($nboftargetok) {
print "Create directory $BUILDROOT/$PROJECT.tmp/debian\n";
$ret=`mkdir "$BUILDROOT/$PROJECT.tmp/debian"`;
print "Copy $SOURCE/build/debian/xxx to $BUILDROOT/$PROJECT.tmp/debian\n";
# Add files for dpkg-source (changelog)
#$ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`;
open (SPECFROM,"<$SOURCE/build/debian/changelog") || die "Error";
open (SPECTO,">$BUILDROOT/$PROJECT.tmp/debian/changelog") || die "Error";
while (<SPECFROM>) {
$_ =~ s/__VERSION__/$MAJOR.$MINOR.$newbuild/;
print SPECTO $_;
}
close SPECFROM;
close SPECTO;
# Add files for dpkg-source
$ret=`cp -f "$SOURCE/build/debian/changelog" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/compat" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/control" "$BUILDROOT/$PROJECT.tmp/debian"`;
$ret=`cp -f "$SOURCE/build/debian/copyright" "$BUILDROOT/$PROJECT.tmp/debian"`;

View File

@ -8,11 +8,11 @@ This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'"
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base 3.7.0 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Update version number with x.y.z-w in build/debian/changelog
- Commit all changes.
- Add a Tag (x.y.betaz_YYYYMMDD) and push it: git push --tags
- Add a Tag (x.y.z-beta) and push it: git push --tags
- Create a branch (x.y).
- Run makepack-dolibarr.pl to generate all packages.
@ -29,7 +29,7 @@ This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'"
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base 3.7.0 origin/develop`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa"
- Update version number with x.y.z in htdocs/filefunc.inc.php
- Update version number with x.y.z in build/debian/changelog
- Commit all changes.

View File

@ -242,7 +242,7 @@ if ($upgrade) {
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
);
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory.
@ -268,12 +268,12 @@ else {
[ "usealternaterootdir", "1" ],
[ "main_alt_dir_name", "custom" ],
);
local $err = &call_dolibarr_wizard_page(\@params, "etape1", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step1", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database)
local @params = ( [ "action", "set" ] );
local $err = &call_dolibarr_wizard_page(\@params, "etape2", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step2", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account)
@ -282,7 +282,7 @@ else {
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
);
local $err = &call_dolibarr_wizard_page(\@params, "etape5", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file.

View File

@ -159,6 +159,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/accountancy
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks

View File

@ -239,6 +239,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/accountancy
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks

View File

@ -156,6 +156,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/accountancy
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks

View File

@ -167,6 +167,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/accountancy
%_datadir/dolibarr/htdocs/adherents
%_datadir/dolibarr/htdocs/admin
%_datadir/dolibarr/htdocs/api
%_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks

View File

@ -6,7 +6,7 @@ PROGNAME=${0##*/}
INPUT=''
QUIET='0'
NOSTATS='0'
INPLACE='0'
INPLACE='0' # (1=Images are replaced, 0=New images are stored into $OUTPUT)
max_input_size=0
max_output_size=0

View File

@ -34,11 +34,11 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
class modMyModule extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
function __construct($db)
public function __construct($db)
{
global $langs,$conf;
@ -249,24 +249,24 @@ class modMyModule extends DolibarrModules
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
public function init($options='')
{
$sql = array();
$result=$this->_load_tables('/mymodule/sql/');
//$this->_load_tables('/mymodule/sql/');
return $this->_init($sql, $options);
}
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* Data directories are not deleted
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
public function remove($options = '')
{
$sql = array();

View File

@ -86,10 +86,9 @@ class Skeleton_Class extends CommonObject
*
* @param DoliDb $db Database handler
*/
public function __construct( DoliDB $db )
public function __construct(DoliDB $db)
{
$this->db = $db;
return 1;
}
@ -101,18 +100,18 @@ class Skeleton_Class extends CommonObject
*
* @return int <0 if KO, Id of created object if OK
*/
public function create( User $user, $notrigger = false )
public function create(User $user, $notrigger = false)
{
dol_syslog( __METHOD__, LOG_DEBUG );
dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0;
// Clean parameters
if (isset( $this->prop1 )) {
$this->prop1 = trim( $this->prop1 );
if (isset($this->prop1)) {
$this->prop1 = trim($this->prop1);
}
if (isset( $this->prop2 )) {
$this->prop2 = trim( $this->prop2 );
if (isset($this->prop2)) {
$this->prop2 = trim($this->prop2);
}
//...
@ -132,15 +131,15 @@ class Skeleton_Class extends CommonObject
$this->db->begin();
$resql = $this->db->query( $sql );
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
}
if (!$error) {
$this->id = $this->db->last_insert_id( MAIN_DB_PREFIX . $this->table_element );
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
if (!$notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
@ -173,9 +172,9 @@ class Skeleton_Class extends CommonObject
*
* @return int <0 if KO, 0 if not found, >0 if OK
*/
public function fetch( $id, $ref = null )
public function fetch($id, $ref = null)
{
dol_syslog( __METHOD__, LOG_DEBUG );
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT';
$sql .= ' t.rowid,';
@ -189,18 +188,18 @@ class Skeleton_Class extends CommonObject
$sql .= ' WHERE t.rowid = ' . $id;
}
$resql = $this->db->query( $sql );
$resql = $this->db->query($sql);
if ($resql) {
$numrows = $this->db->num_rows( $resql );
$numrows = $this->db->num_rows($resql);
if ($numrows) {
$obj = $this->db->fetch_object( $resql );
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->prop1 = $obj->field1;
$this->prop2 = $obj->field2;
//...
}
$this->db->free( $resql );
$this->db->free($resql);
if ($numrows) {
return 1;
@ -209,7 +208,7 @@ class Skeleton_Class extends CommonObject
}
} else {
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
return - 1;
}
@ -226,9 +225,9 @@ class Skeleton_Class extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function fetchAll( $sortorder, $sortfield, $limit, $offset, array $filter = array() )
public function fetchAll($sortorder, $sortfield, $limit, $offset, array $filter = array())
{
dol_syslog( __METHOD__, LOG_DEBUG );
dol_syslog(__METHOD__, LOG_DEBUG);
$sql = 'SELECT';
$sql .= ' t.rowid,';
@ -239,23 +238,23 @@ class Skeleton_Class extends CommonObject
// Manage filter
$sqlwhere = array();
if (count( $filter ) > 0) {
if (count($filter) > 0) {
foreach ($filter as $key => $value) {
$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape( $value ) . '%\'';
$sqlwhere [] = ' AND ' . $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
}
}
if (count( $sqlwhere ) > 0) {
$sql .= ' WHERE ' . implode( ' AND ', $sqlwhere );
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' AND ', $sqlwhere);
}
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit( $limit + 1, $offset );
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder . ' ' . $this->db->plimit($limit + 1, $offset);
$this->lines = array();
$resql = $this->db->query( $sql );
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows( $resql );
$num = $this->db->num_rows($resql);
while ($obj = $this->db->fetch_object( $resql )) {
while ($obj = $this->db->fetch_object($resql)) {
$line = new Skeleton_ClassLine();
$line->id = $obj->rowid;
@ -265,12 +264,12 @@ class Skeleton_Class extends CommonObject
$this->lines[] = $line;
//...
}
$this->db->free( $resql );
$this->db->free($resql);
return $num;
} else {
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
return - 1;
}
@ -284,18 +283,18 @@ class Skeleton_Class extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function update( User $user, $notrigger = false )
public function update(User $user, $notrigger = false)
{
$error = 0;
dol_syslog( __METHOD__, LOG_DEBUG );
dol_syslog(__METHOD__, LOG_DEBUG);
// Clean parameters
if (isset( $this->prop1 )) {
$this->prop1 = trim( $this->prop1 );
if (isset($this->prop1)) {
$this->prop1 = trim($this->prop1);
}
if (isset( $this->prop2 )) {
$this->prop2 = trim( $this->prop2 );
if (isset($this->prop2)) {
$this->prop2 = trim($this->prop2);
}
//...
@ -304,13 +303,13 @@ class Skeleton_Class extends CommonObject
// Update request
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
if (isset( $this->field1 )) {
$sql .= ' field1=\'' . $this->db->escape( $this->field1 ) . '\',';
if (isset($this->field1)) {
$sql .= ' field1=\'' . $this->db->escape($this->field1) . '\',';
} else {
$sql .= ' field1=null' . ',';
}
if (isset( $this->field2 )) {
$sql .= ' field2=\'' . $this->db->escape( $this->field2 ) . '\'';
if (isset($this->field2)) {
$sql .= ' field2=\'' . $this->db->escape($this->field2) . '\'';
} else {
$sql .= ' field2=null';
}
@ -319,11 +318,11 @@ class Skeleton_Class extends CommonObject
$this->db->begin();
$resql = $this->db->query( $sql );
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
}
if (!$error && !$notrigger) {
@ -356,9 +355,9 @@ class Skeleton_Class extends CommonObject
*
* @return int <0 if KO, >0 if OK
*/
public function delete( User $user, $notrigger = false )
public function delete(User $user, $notrigger = false)
{
dol_syslog( __METHOD__, LOG_DEBUG );
dol_syslog(__METHOD__, LOG_DEBUG);
$error = 0;
@ -380,11 +379,11 @@ class Skeleton_Class extends CommonObject
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
$sql .= ' WHERE rowid=' . $this->id;
$resql = $this->db->query( $sql );
$resql = $this->db->query($sql);
if (!$resql) {
$error ++;
$this->errors[] = 'Error ' . $this->db->lasterror();
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
}
}
@ -407,18 +406,18 @@ class Skeleton_Class extends CommonObject
*
* @return int New id of clone
*/
public function createFromClone( $fromid )
public function createFromClone($fromid)
{
dol_syslog( __METHOD__, LOG_DEBUG );
dol_syslog(__METHOD__, LOG_DEBUG);
global $user;
$error = 0;
$object = new Skeleton_Class( $this->db );
$object = new Skeleton_Class($this->db);
$this->db->begin();
// Load source object
$object->fetch( $fromid );
$object->fetch($fromid);
// Reset object
$object->id = 0;
@ -426,13 +425,13 @@ class Skeleton_Class extends CommonObject
// ...
// Create clone
$result = $object->create( $user );
$result = $object->create($user);
// Other options
if ($result < 0) {
$error ++;
$this->errors = $object->errors;
dol_syslog( __METHOD__ . ' ' . join( ',', $this->errors ), LOG_ERR );
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
}
// End

View File

@ -74,6 +74,7 @@ if (($id > 0 || ! empty($ref)) && $action != 'add')
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('skeleton'));
$extrafields = new ExtraFields($db);
@ -217,7 +218,7 @@ jQuery(document).ready(function() {
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_needroot();
init_myfunc();
});
});
</script>';
@ -230,8 +231,18 @@ if ($action == 'list' || empty($id))
$sql.= " t.rowid,";
$sql.= " t.field1,";
$sql.= " t.field2";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."mytable as t";
$sql.= " WHERE field3 = 'xxx'";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " ORDER BY field1 ASC";
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -241,7 +252,8 @@ if ($action == 'list' || empty($id))
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
@ -252,7 +264,8 @@ if ($action == 'list' || empty($id))
print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>'."\n";
// Fields title search
@ -264,7 +277,8 @@ if ($action == 'list' || empty($id))
print '<input type="text" class="flat" name="search_field2" value="'.$search_field2.'" size="10">';
print '</td>';
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>'."\n";
@ -287,8 +301,9 @@ if ($action == 'list' || empty($id))
print $obj->field2;
print '</td>';
$parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print '</tr>';
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</tr>';
}
$i++;
}
@ -302,7 +317,8 @@ if ($action == 'list' || empty($id))
$db->free($resql);
$parameters=array('sql' => $sql);
$formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";

View File

@ -9,10 +9,10 @@
<link rel="shortcut icon" type="image/x-icon" href="/dolibarrnew/theme/eldy/img/favicon.ico"/>
<title>Login Dolibarr 3.4.0-alpha</title>
<!-- Includes for JQuery (Ajax library) -->
<link rel="stylesheet" type="text/css" href="/dolibarrnew/includes/jquery/css/smoothness/jquery-ui-latest.custom.css" />
<link rel="stylesheet" type="text/css" href="/dolibarrnew/includes/jquery/css/smoothness/jquery-ui.custom.css" />
<link rel="stylesheet" type="text/css" title="default" href="/dolibarrnew/custom/filemanager/css/filemanager.css.php"><!-- Added by module filemanager-->
<!-- Includes JS for JQuery -->
<script type="text/javascript" src="/dolibarrnew/includes/jquery/js/jquery-latest.min.js"></script>
<script type="text/javascript" src="/dolibarrnew/includes/jquery/js/jquery.min.js"></script>
<script type="text/javascript" src="/dolibarrnew/core/js/dst.js"></script>
<link rel="stylesheet" type="text/css" href="/dolibarrnew/theme/eldy/style.css.php?lang=fr_FR" />
<!-- HTTP_USER_AGENT = Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22 -->

View File

@ -2,9 +2,9 @@
#------------------------------------------------------
# Script to push language files to Transifex
#
# Laurent Destailleur - eldy@users.sourceforge.net
# Laurent Destailleur (eldy) - eldy@users.sourceforge.net
#------------------------------------------------------
# Usage: txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f]
# Usage: txpush.sh (source|xx_XX) [-r dolibarr.file] [-f]
#------------------------------------------------------
# Syntax
@ -13,7 +13,7 @@ then
echo "This push local files to transifex."
echo "Note: If you push a language file (not source), file will be skipped if transifex file is newer."
echo " Using -f will overwrite translation but not memory."
echo "Usage: ./dev/translation/txpush.sh (source|all|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
echo "Usage: ./dev/translation/txpush.sh (source|xx_XX) [-r dolibarr.file] [-f] [--no-interactive]"
exit
fi
@ -23,20 +23,15 @@ then
exit
fi
if [ "x$1" = "xall" ]
then
for fic in ar_SA bg_BG bs_BA ca_ES cs_CZ da_DK de_DE el_GR es_ES et_EE eu_ES fa_IR fi_FI fr_FR he_IL hr_HR hu_HU id_ID is_IS it_IT ja_JP ka_GE ko_KR lt_LT lv_LV mk_MK nb_NO nl_NL pl_PL pt_PT ro_RO ru_RU ru_UA sk_SK sl_SI sq_AL sv_SE th_TH tr_TR uk_UA uz_UZ vi_VN zh_CN zh_TW
do
echo "tx push --skip -t -l $fic $2 $3"
tx push --skip -t -l $fic $2 $3
done
else
if [ "x$1" = "xsource" ]
then
echo "tx push -s $2 $3"
tx push -s $2 $3
else
echo "tx push --skip -t -l $1 $2 $3 $4"
tx push --skip -t -l $1 $2 $3 $4
fi
for file in `find htdocs/langs/$1/*.lang -type f`
do
export basefile=`basename $file | sed -s s/\.lang//g`
echo "tx push --skip -r dolibarr.$basfile -t -l $1 $2 $3 $4"
tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4
done
fi

1
htdocs/.gitignore vendored
View File

@ -10,3 +10,4 @@
/ovh*
/pos
/ultimatepdf*
/lead

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -154,7 +154,7 @@ if ($result) {
print_liste_field_titre($langs->trans("Accountparent"), $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgtype"), $_SERVER["PHP_SELF"], "aa.pcg_type", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Pcgsubtype"), $_SERVER["PHP_SELF"], "aa.pcg_subtype", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Active"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Activated"), $_SERVER["PHP_SELF"], "aa.active", "", $param, "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",$param,"",'width="60" align="center"',$sortfield,$sortorder);
print '</tr>';
@ -174,12 +174,17 @@ if ($result) {
$var = true;
$accountstatic=new AccountingAccount($db);
while ( $i < min($num, $limit) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
$accountstatic->id=$obj->rowid;
$accountstatic->label=$obj->label;
$accountstatic->account_number=$obj->account_number;
print '<tr ' . $bc[$var] . '>';
print '<td><a href="./card.php?id=' . $obj->rowid . '">' . $obj->account_number . '</td>';
print '<td>' . $accountstatic->getNomUrl(1) . '</td>';
print '<td>' . $obj->label . '</td>';
print '<td>' . $obj->account_parent . '</td>';
print '<td>' . $obj->pcg_type . '</td>';
@ -210,6 +215,7 @@ if ($result) {
print '</td>' . "\n";
print "</tr>\n";
$var=!$var;
$i ++;
}

View File

@ -39,6 +39,7 @@ $mesg = '';
$action = GETPOST('action');
$id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel');
// Security check
if (!$user->admin)
@ -49,7 +50,7 @@ $accounting = new AccountingAccount($db);
// Action
if ($action == 'add')
{
if (! GETPOST('cancel', 'alpha')) {
if (! $cancel) {
$sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS;
dol_syslog('accountancy/admin/card.php:: $sql=' . $sql);
@ -59,7 +60,7 @@ if ($action == 'add')
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_number = GETPOST('account_number');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
$accounting->active = 1;
@ -94,7 +95,7 @@ else if ($action == 'edit')
$accounting->fk_pcg_version = $obj->pcg_version;
$accounting->pcg_type = GETPOST('pcg_type');
$accounting->pcg_subtype = GETPOST('pcg_subtype');
$accounting->account_number = GETPOST('account_number', 'int');
$accounting->account_number = GETPOST('account_number');
$accounting->account_parent = GETPOST('account_parent', 'int');
$accounting->label = GETPOST('label', 'alpha');
@ -261,7 +262,7 @@ else if ($id)
print '<tr><td>' . $langs->trans("Pcgsubtype") . '</td>';
print '<td colspan="2">' . $accounting->pcg_subtype . '</td></tr>';
print '<tr><td>' . $langs->trans("Active") . '</td>';
print '<tr><td>' . $langs->trans("Activated") . '</td>';
print '<td colspan="2">';
if (empty($accounting->active)) {

View File

@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -48,6 +48,8 @@ $action = GETPOST('action', 'alpha');
// Other parameters ACCOUNTING_*
$list = array (
'ACCOUNTING_LIMIT_LIST_VENTILATION',
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT',
'ACCOUNTING_ACCOUNT_CUSTOMER',
@ -56,6 +58,8 @@ $list = array (
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_ACCOUNT_SUSPENSE',
'ACCOUNTING_ACCOUNT_TRANSFER_CASH'
);
@ -285,7 +289,6 @@ if (! empty($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE)) {
}
print '</tr>';
print "</table>\n";
print '<br /><br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';

View File

@ -2,7 +2,9 @@
/*
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
*
* 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
@ -19,129 +21,404 @@
*/
/**
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
* \file htdocs/accountancy/admin/productaccount.php
* \ingroup Accounting Expert
* \brief Onglet de gestion de parametrages des ventilations
*/
// Dolibarr environment
$res = @include ("../main.inc.php");
if (! $res && file_exists("../main.inc.php"))
$res = @include ("../main.inc.php");
if (! $res && file_exists("../../main.inc.php"))
$res = @include ("../../main.inc.php");
if (! $res && file_exists("../../../main.inc.php"))
$res = @include ("../../../main.inc.php");
if (! $res)
die("Include of main fails");
require '../../main.inc.php';
// Class
dol_include_once("/core/lib/report.lib.php");
dol_include_once("/core/lib/date.lib.php");
dol_include_once("/product/class/product.class.php");
// Class
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
// Langs
$langs->load("companies");
$langs->load("compta");
$langs->load("main");
$langs->load("accountancy");
// Security check
if (!$user->admin)
accessforbidden();
// Search & action GETPOST
$action = GETPOST('action');
$codeventil_buy = GETPOST('codeventil_buy', 'array');
$codeventil_sell = GETPOST('codeventil_sell', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$account_number_buy = GETPOST('account_number_buy');
$account_number_sell = GETPOST('account_number_sell');
$changeaccount = GETPOST('changeaccount','array');
$changeaccount_buy = GETPOST('changeaccount_buy','array');
$changeaccount_sell = GETPOST('changeaccount_sell','array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
//bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
//} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
// $limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
if (! $sortfield) $sortfield="p.ref";
if (! $sortorder) $sortorder="ASC";
// Security check
if ($user->societe_id > 0)
accessforbidden();
// TODO after adding menu
// if (! $user->rights->accounting->ventilation->dispatch)
// accessforbidden();
$form = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_servbuy = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_prodbuy = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
$aarowid_servsell = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_prodsell = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
$aacompta_servbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
}
//debug move header to top
llxHeader('', $langs->trans("Accounts"));
$form = new Form($db);
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
//TODO: modify to update all selected product with a sell account
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_sell")) {
//print_r ($changeaccount);
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
$sql1 .= " SET p.accountancy_code_sell=" . $account_number_sell;
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
dol_syslog('accountancy/customer/lines.php::changeaccount product sell sql= ' . $sql1);
print_r ($sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
}
}
print '
<script type="text/javascript">
function launch_export() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
//TODO: modify to update all selected product with a buy account
if (is_array($changeaccount) && count($changeaccount) > 0 && $action == $langs->trans("Accountancy_code_buy")) {
$error = 0;
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "product as p";
$sql1 .= " SET p.accountancy_code_buy=" . $account_number_buy;
$sql1 .= ' WHERE p.rowid IN (' . implode(',', $changeaccount) . ')';
print_r ($sql1);
dol_syslog('accountancy/customer/lines.php::changeaccount product buy sql= ' . $sql1);
$resql1 = $db->query($sql1);
if (! $resql1) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans('Save'), 'mesgs');
} else {
$db->rollback();
setEventMessage($db->lasterror(), 'errors');
}
}
/*
* View
*/
//DEBUG elarifr
//llxHeader('', $langs->trans("Accounts"));
//For updating account export
print '<script type="text/javascript">
function launch_export() {
$("div.fiche div.tabBar form input[name=\"action\"]").val("export_csv");
$("div.fiche div.tabBar form input[type=\"submit\"]").click();
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell as codesell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
//TODO For select box
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
dol_syslog('accountancy/admin/productaccount.php:: $sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
/*
* Action
*/
//TODO
/*
if ($action == 'ventil') {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil_buy) && ! empty($mesCasesCochees)) {
if (! empty($codeventil_sell) && ! empty($mesCasesCochees)) {
/*
* view
*/
print '<br><br>';
print '<table class="noborder" width="100%">';
print '<td align="left">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("Label") . '</td>';
print '<td align="left">' . $langs->trans("Description") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
$var = true;
while ( $i < min($num, 250) ) {
$obj = $db->fetch_object($resql);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if (empty($compta_prodsell)) {
if ($obj->product_type == 0)
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
else
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
$compta_prodbuy = $obj->accountancy_code_buy;
if (empty($compta_prodbuy)) {
if ($obj->product_type == 0)
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
else
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
// Ref produit
$product_static->ref = $objp->ref;
$product_static->id = $objp->rowid;
$product_static->type = $objp->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '&nbsp;';
print '</td>';
print '<td align="left">' . $obj->ref . '</td>';
print '<td align="left">' . $obj->label . '</td>';
print '<td align="left">' . $obj->description . '</td>';
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
print '<td align="left">' . $compta_prodbuy . '</td>';
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
print '<td align="left">' . $compta_prodsell . '</td>';
print "</tr>\n";
$i ++;
}
print "</table>";
$db->free($resql);
} else {
dol_print_error($db);
} else {
print '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>';
}
print '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>';
}
*/
//do we really need to exclude old product not tosell / tobuy ?
//$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type , p.tosell , p.tobuy ";
//$sql .= " WHERE p.accountancy_code_sell IS NULL AND p.tosell = 1 OR p.accountancy_code_buy IS NULL AND p.tobuy = 1";
//$sql .= " WHERE p.accountancy_code_sell ='' AND p.tosell = 1 OR p.accountancy_code_buy ='' AND p.tobuy = 1";
$sql = "SELECT p.rowid, p.ref , p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
//$sql .= " , " . MAIN_DB_PREFIX . "accountingaccount as aa";
$sql .= " WHERE (";
$sql .= " p.accountancy_code_sell ='' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
//Search on correct pcg version
$pcgver = $conf->global->CHARTOFACCOUNTS;
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
//(SELECT account_number FROM " . MAIN_DB_PREFIX . "accountingaccount as aa WHERE fk_pcg_version='PCG99-BASE'))";
$sql .= ")";
//Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (p.description like '%" . $search_desc . "%')";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
/*
* View
*/
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><b>' . $langs->trans("DescProductAccountingAccount") . '</b></td>&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"],"p.rowid","",$param,'',$sortfield,$sortorder);
print '&nbsp;&nbsp;';
//DEBUG
//print $sql;
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post"><br />';
// print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr>';
print '<td width="33%">';
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
print $langs->trans("Accountancy_code_buy") . ': ' . $form->select_account($account_number_buy, 'account_number_buy', 1,'', 0, 1);
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_buy") . '"/></div>';
print '</td>';
print '<td width="33%">';
print '<div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br />';
print $langs->trans("Accountancy_code_sell") . ': ' . $form->select_account($account_number_sell, 'account_number_sell', 1, '', 0, 1);
print '<input type="submit" class="butAction" name="action" value="' . $langs->trans("Accountancy_code_sell") . '"/></div>';
print '</td>';
print '<td width="33%">';
//TODO change button
print '<input type="button" class="button" style="float: right;" value="Renseigner les comptes comptables produits manquant" onclick="launch_export();" />';
print '</td>';
print '</tr>';
print '</table>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// print '<td align="left">' . $langs->trans("Ref") . '</td>';
// print '<td align="left">' . $langs->trans("Label") . '</td>';
// print '<td align="left">' . $langs->trans("Description") . '</td>';
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);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print '<td align="left">' . $langs->trans("Accountancy_code_buy") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_buy_suggest") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
print_liste_field_titre('');
// print_liste_field_titre('');
print '<td align="center" colspan="2">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre">%<input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" colspan="3">&nbsp;</td>';
print '<td align="right" colspan="4" 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 '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
// print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
// print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '</tr>';
$var = true;
while ( $i < min($num_lines, 250) ) {
$obj = $db->fetch_object($result);
$var = ! $var;
$compta_prodsell = $obj->accountancy_code_sell;
if (empty($compta_prodsell)) {
if ($obj->product_type == 0) {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_prodsell;
} else {
$compta_prodsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodsell_id = $aarowid_servsell;
}
}
$compta_prodbuy = $obj->accountancy_code_buy;
if (empty($compta_prodbuy)) {
if ($obj->product_type == 0) {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_prodbuy;
} else {
$compta_prodbuy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$compta_prodbuy_id = $aarowid_servbuy;
}
}
$product_static = new Product($db);
print "<tr $bc[$var]>";
//debug
print '<td align="left" colspan="6">Compte Suggeres compta_prodbuy=' . $compta_prodbuy . ' -- compta_prodbuy_id' . $compta_prodbuy_id . '-- compta_prodsell:' . $compta_prodsell . '-- compta_prodsell_id' . $compta_prodsell_id . '</td>';
print "</tr>";
print "<tr $bc[$var]>";
// Ref produit as link
$product_static->ref = $obj->ref;
$product_static->id = $obj->rowid;
$product_static->type = $obj->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '-&nbsp;';
print '</td>';
print '<td align="left">' . $obj->label . '</td>';
//TODO ADJUST DESCRIPTION SIZE
// print '<td align="left">' . $obj->description . '</td>';
//TODO: we shoul set a user defined value to adjust user square / wide screen size
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
//acountingaccount buy
print '<td align="left">' . $obj->accountancy_code_buy . '</td>';
//TODO: replace by select
// print '<td align="left">' . $compta_prodbuy . '</td>';
//TODO: we shoul set a user defined value to adjust user square / wide screen size
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="center">';
print $form->select_account($compta_prodbuy_id, 'codeventil[]', 1);
print '</td>';
//acountingaccount sel
print '<td align="left">' . $obj->accountancy_code_sell . '</td>';
//TODO: replace by select
//TODO: we shoul set a user defined value to adjust user square / wide screen size
//$trunclenghform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print '<td align="center">';
print $form->select_account($compta_prodsell_id, 'codeventil[]', 1);
print '</td>';
//action edit & select box
print '<td align="center">' . $obj->rowid . '</td>';
print '<td><a href="./card.php?id=' . $obj->rowid . '">';
print img_edit();
print '</a></td>';
//Checkbox select
print '<td align="center">';
print '<input type="checkbox" name="changeaccount[]" value="' . $obj->rowid . '"/></td>';
print "</tr>";
$i ++;
}
$db->free($result);
} else {
// print $db->error();
dol_print_error($db);
}
print "</table></form>";
llxFooter();
$db->close();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -18,23 +18,23 @@
*/
/**
* \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Accounting Expert
* \brief Page to show account
* \file htdocs/accountancy/bookkeeping/card.php
* \ingroup Accounting Expert
* \brief Page to show account
*/
require '../../main.inc.php';
// Class
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("accounting");
$langs->load("accountancy");
// Security check
$id = GETPOST('id', 'int');
if ($user->societe_id > 0)
accessforbidden();
accessforbidden();
$action = GETPOST('action');
$piece_num = GETPOST("piece_num");
@ -48,132 +48,132 @@ $debit = price2num(GETPOST('debit'));
$credit = price2num(GETPOST('credit'));
if ($action == "confirm_update") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$result = $book->fetch($id);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update();
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
}
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$result = $book->fetch($id);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->update();
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
}
else if ($action == "add") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
$book->doc_date = GETPOST('doc_date');
$book->doc_type = GETPOST('doc_type');
$book->piece_num = $piece_num;
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = GETPOST('fk_doc');
$book->fk_docdet = GETPOST('fk_docdet');
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
if (empty($error)) {
$book = new BookKeeping($db);
$book->numero_compte = $numero_compte;
$book->code_tiers = $code_tiers;
$book->label_compte = $label_compte;
$book->debit = $debit;
$book->credit = $credit;
$book->doc_date = GETPOST('doc_date');
$book->doc_type = GETPOST('doc_type');
$book->piece_num = $piece_num;
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = GETPOST('fk_doc');
$book->fk_docdet = GETPOST('fk_docdet');
if (! empty($debit)) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
$book->montant = $credit;
$book->sens = 'C';
}
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
}
}
}
else if ($action == "confirm_delete") {
$book = new BookKeeping($db);
$result = $book->fetch($id);
$piece_num = $book->piece_num;
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$result = $book->delete($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
}
$action = '';
}
$book = new BookKeeping($db);
$result = $book->fetch($id);
$piece_num = $book->piece_num;
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
$result = $book->delete($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
}
$action = '';
}
else if ($action == "confirm_create") {
$book = new BookKeeping($db);
$book->label_compte = '';
$book->debit = 0;
$book->credit = 0;
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
$book->doc_type = GETPOST('doc_type');
$book->piece_num = GETPOST('next_num_mvt');
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = 0;
$book->fk_docdet = 0;
$book->montant = 0;
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
$piece_num = $book->piece_num;
}
$book = new BookKeeping($db);
$book->label_compte = '';
$book->debit = 0;
$book->credit = 0;
$book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
$book->doc_type = GETPOST('doc_type');
$book->piece_num = GETPOST('next_num_mvt');
$book->doc_ref = GETPOST('doc_ref');
$book->code_journal = GETPOST('code_journal');
$book->fk_doc = 0;
$book->fk_docdet = 0;
$book->montant = 0;
$result = $book->create_std($user);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
setEventMessage($langs->trans('Saved'), 'mesgs');
$action = '';
$piece_num = $book->piece_num;
}
}
llxHeader();
@ -181,197 +181,194 @@ llxHeader();
$html = new Form($db);
/*
* Confirmation to delete the command
* Confirmation to delete the command
*/
if ($action == 'delete') {
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
print $formconfirm;
$formconfirm = $html->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $id, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'confirm_delete', '', 0, 1);
print $formconfirm;
}
if ($action == 'create') {
print_fiche_titre($langs->trans("CreateMvts"));
$code_journal_array = array (
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
$conf->global->ACCOUNTING_BANK_JOURNAL => $conf->global->ACCOUNTING_BANK_JOURNAL,
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL
);
$book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt();
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
print_fiche_titre($langs->trans("CreateMvts"));
dol_fiche_head();
$code_journal_array = array (
$conf->global->ACCOUNTING_SELL_JOURNAL => $conf->global->ACCOUNTING_SELL_JOURNAL,
$conf->global->ACCOUNTING_PURCHASE_JOURNAL => $conf->global->ACCOUNTING_PURCHASE_JOURNAL,
$conf->global->ACCOUNTING_SOCIAL_JOURNAL => $conf->global->ACCOUNTING_SOCIAL_JOURNAL,
$conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL => $conf->global->ACCOUNTING_MISCELLANEOUS_JOURNAL,
$conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL => $conf->global->ACCOUNTING_EXPENSEREPORT_JOURNAL
);
print '<table class="border" width="100%">';
print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>';
print '</table>';
$book = new BookKeeping($db);
$next_num_mvt = $book->getNextNumMvt();
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
dol_fiche_head();
print '<table class="border" width="100%">';
print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>';
print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>';
print '</table>';
dol_fiche_end();
print '<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Save") . '">';
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans("Create") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
print '</div>';
print '</form>';
}
else
{
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
if (! empty($book->piece_num)) {
print_fiche_titre($langs->trans("UpdateMvts"));
print '<table class="border" width="100%">';
print '<tr class="pair">';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $book->piece_num . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $book->code_journal . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td>' . $book->doc_ref . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td>' . $book->doc_type . '</td>';
print '</tr>';
print '</table>';
$result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
print_fiche_titre($langs->trans("ListeMvts"));
print "<table class=\"noborder\" width=\"100%\">";
if (count($book->linesmvt) > 0) {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte"));
print_liste_field_titre($langs->trans("Code_tiers"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit"));
print_liste_field_titre($langs->trans("Credit"));
print_liste_field_titre($langs->trans("Amount"));
print_liste_field_titre($langs->trans("Sens"));
print '<td></td>';
print "</tr>\n";
foreach ( $book->linesmvt as $line ) {
$var = ! $var;
print "<tr $bc[$var]>";
if ($action == 'update' && $line->id == $id) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
print '<input type="hidden" name="action" value="confirm_update">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
print '</form>';
print '</td>';
}
else {
print '<td>' . $line->numero_compte . '</td>';
print '<td>' . $line->code_tiers . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->debit . '</td>';
print '<td>' . $line->credit . '</td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_edit();
print '</a>&nbsp;';
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_delete();
print '</a>';
print '</td>';
}
print "</tr>\n";
}
if ($action == "" || $action == 'add') {
$var = ! $var;
print "<tr $bc[$var]>";
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="action" value="add">' . "\n";
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
print '<td></td>';
print '<td></td>';
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
print '</table>';
print '</form>';
}
}
}
else {
print_fiche_titre($langs->trans("NoRecords"));
}
print '</form>';
} else {
$book = new BookKeeping($db);
$result = $book->fetch_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
}
if (! empty($book->piece_num)) {
print_fiche_titre($langs->trans("UpdateMvts"));
print '<table class="border" width="100%">';
print '<tr class="pair">';
print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $book->piece_num . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>' . dol_print_date($book->doc_date, 'daytextshort') . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $book->code_journal . '</td>';
print '</tr>';
print '<tr class="impair">';
print '<td>' . $langs->trans("Docref") . '</td>';
print '<td>' . $book->doc_ref . '</td>';
print '</tr>';
print '<tr class="pair">';
print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td>' . $book->doc_type . '</td>';
print '</tr>';
print '</table>';
$result = $book->fetch_all_per_mvt($piece_num);
if ($result < 0) {
setEventMessage($book->errors, 'errors');
} else {
print_fiche_titre($langs->trans("ListeMvts"));
print "<table class=\"noborder\" width=\"100%\">";
if (count($book->linesmvt) > 0) {
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Numerocompte"));
print_liste_field_titre($langs->trans("Code_tiers"));
print_liste_field_titre($langs->trans("Labelcompte"));
print_liste_field_titre($langs->trans("Debit"));
print_liste_field_titre($langs->trans("Credit"));
print_liste_field_titre($langs->trans("Amount"));
print_liste_field_titre($langs->trans("Sens"));
print_liste_field_titre('');
print "</tr>\n";
foreach ( $book->linesmvt as $line ) {
$var = ! $var;
print "<tr $bc[$var]>";
if ($action == 'update' && $line->id == $id) {
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="id" value="' . $line->id . '">' . "\n";
print '<input type="hidden" name="action" value="confirm_update">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $line->numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $line->code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $line->label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($line->debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($line->credit) . '"/></td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
print '</form>';
print '</td>';
} else {
print '<td>' . $line->numero_compte . '</td>';
print '<td>' . $line->code_tiers . '</td>';
print '<td>' . $line->label_compte . '</td>';
print '<td>' . $line->debit . '</td>';
print '<td>' . $line->credit . '</td>';
print '<td>' . $line->montant . '</td>';
print '<td>' . $line->sens . '</td>';
print '<td>';
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_edit();
print '</a>&nbsp;';
print '<a href="./card.php?action=delete&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_delete();
print '</a>';
print '</td>';
}
print "</tr>\n";
}
if ($action == "" || $action == 'add') {
$var = ! $var;
print "<tr $bc[$var]>";
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $book->piece_num . '" method="post">';
print '<input type="hidden" name="action" value="add">' . "\n";
print '<input type="hidden" name="doc_date" value="' . $book->doc_date . '">' . "\n";
print '<input type="hidden" name="doc_type" value="' . $book->doc_type . '">' . "\n";
print '<input type="hidden" name="doc_ref" value="' . $book->doc_ref . '">' . "\n";
print '<input type="hidden" name="code_journal" value="' . $book->code_journal . '">' . "\n";
print '<input type="hidden" name="fk_doc" value="' . $book->fk_doc . '">' . "\n";
print '<input type="hidden" name="fk_docdet" value="' . $book->fk_docdet . '">' . "\n";
print '<td><input type="text" size="6" name="numero_compte" value="' . $numero_compte . '"/></td>';
print '<td><input type="text" size="15" name="code_tiers" value="' . $code_tiers . '"/></td>';
print '<td><input type="text" size="15" name="label_compte" value="' . $label_compte . '"/></td>';
print '<td><input type="text" size="6" name="debit" value="' . price($debit) . '"/></td>';
print '<td><input type="text" size="6" name="credit" value="' . price($credit) . '"/></td>';
print '<td></td>';
print '<td></td>';
print '<td><input type="submit" class="button" value="' . $langs->trans("Save") . '"></td>';
print '</tr>';
}
print '</table>';
print '</form>';
}
}
}
else {
print_fiche_titre($langs->trans("NoRecords"));
}
}
llxFooter();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
// Langs
$langs->load("accountancy");
$page = GETPOST("page");
$sortorder = GETPOST("sortorder");
@ -155,8 +157,6 @@ else {
print '</form>';
print '<a href="./card.php?action=create" class="butAction">' . $langs->trans("NewAccountingMvt") . '</a></div>';
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="export_csv">';
@ -209,7 +209,7 @@ else {
print "<tr $bc[$var]>";
print '<td>' . $obj->doc_type . '</td>';
print '<td>' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td align="center">' . dol_print_date($db->jdate($obj->doc_date), 'day') . '</td>';
print '<td>' . $obj->doc_ref . '</td>';
print '<td>' . length_accountg($obj->numero_compte) . '</td>';
print '<td>' . length_accounta($obj->code_tiers) . '</td>';
@ -224,6 +224,11 @@ else {
$i ++;
}
print "</table>";
print '<div class="tabsAction">';
print '<a class="butAction" href="./card.php?action=create">'.$langs->trans("NewAccountingMvt").'</a>';
print '</div>';
$db->free($resql);
} else {
dol_print_error($db);

View File

@ -90,7 +90,7 @@ if ($resql) {
print_liste_field_titre($langs->trans("Amount"), $_SERVER['PHP_SELF'], "bk.montant", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "bk.sens", "", "", "", $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "bk.code_journal", "", "", "", $sortfield, $sortorder);
print_liste_field_titre("&nbsp;");
print_liste_field_titre('');
print "</tr>\n";
$var = True;

View File

@ -1,8 +1,9 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
*
* 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
@ -66,8 +67,7 @@ class AccountingAccount extends CommonObject
*/
function fetch($rowid = null, $account_number = null)
{
if ($rowid || $account_number)
{
if ($rowid || $account_number) {
$sql = "SELECT rowid, datec, tms, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, fk_user_author, fk_user_modif, active";
$sql.= " FROM " . MAIN_DB_PREFIX . "accountingaccount WHERE";
if ($rowid) {
@ -78,12 +78,10 @@ class AccountingAccount extends CommonObject
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
if ($result) {
$obj = $this->db->fetch_object($result);
if ($obj)
{
if ($obj) {
$this->id = $obj->rowid;
$this->rowid = $obj->rowid;
$this->datec = $obj->datec;
@ -99,18 +97,13 @@ class AccountingAccount extends CommonObject
$this->active = $obj->active;
return $this->id;
}
else
{
} else {
return 0;
}
}
else
{
} else {
dol_print_error($this->db);
}
}
return -1;
}
@ -127,8 +120,6 @@ class AccountingAccount extends CommonObject
$error = 0;
$now = dol_now();
$now=dol_now();
// Clean parameters
if (isset($this->fk_pcg_version))
$this->fk_pcg_version = trim($this->fk_pcg_version);
@ -344,6 +335,31 @@ class AccountingAccount extends CommonObject
}
}
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
*/
function getNomUrl($withpicto=0)
{
global $langs;
$result='';
$link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?id='.$this->id.'">';
$linkend='</a>';
$picto='billr';
$label=$langs->trans("Show").': '.$this->account_number.' - '.$this->label;
if ($withpicto) $result.=($link.img_object($label,$picto).$linkend);
if ($withpicto && $withpicto != 2) $result.=' ';
if ($withpicto != 2) $result.=$link.$this->account_number.$linkend;
return $result;
}
/**
* Information on record
*

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -91,10 +92,13 @@ class FormVentilation extends Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
* @param int $aabase set accountingaccount base class to display empty=all or from 1 to 8 will display only account beginning by
*
* @return string String with HTML select
*/
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array())
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{
global $conf;
@ -116,21 +120,26 @@ class FormVentilation extends Form
if ($showempty)
$out .= '<option value="-1"></option>';
$num = $this->db->num_rows($resql);
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->account_number . ' - ' . $obj->label;
$label = dol_trunc($label, $trunclength);
if ($select_in == 0 ) $select_value_in = $obj->rowid;
if ($select_in == 1 ) $select_value_in = $obj->account_number;
if ($select_out == 0 ) $select_value_out = $obj->rowid;
if ($select_out == 1 ) $select_value_out = $obj->account_number;
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
// Because same account_number can be share between different accounting_system and do have the same meaning
if (($selectid != '') && $selectid == $obj->rowid) {
if (($selectid != '') && $selectid == $select_value_in) {
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '" selected>' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
} else {
// $out .= '<option value="' . $obj->account_number . '">' . $label . '</option>';
$out .= '<option value="' . $obj->rowid . '">' . $label . '</option>';
$out .= '<option value="' . $select_value_out . '">' . $label . '</option>';
}
$i ++;
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
@ -39,7 +39,7 @@ $langs->load("accountancy");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
$search_ref = GETPOST('search_ref','alpha');
$search_facture = GETPOST('search_facture','alpha');
$search_invoice = GETPOST('search_invoice','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
@ -49,13 +49,37 @@ $sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
//if ($page == -1) { $page = 0; }
if ($page < 0) $page = 0;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="f.facnumber";
if (! $sortorder) $sortorder="DESC";
//$limit = $conf->liste_limit;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
//$offset = $conf->liste_limit * $page;
$offset = $limit * $page;
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="f.facnumber";
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -69,7 +93,7 @@ $formventilation = new FormVentilation($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_facture='';
$search_invoice='';
$search_label='';
$search_desc='';
$search_amount='';
@ -106,20 +130,31 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("CustomersVentilation") . ' - ' . $langs->trans("Dispatched"));
$page = GETPOST("page");
if ($page < 0)
$page = 0;
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} elseif ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
/*
* Action
*/
$offset = $limit * $page;
/*
* Customer Invoice lines
*/
$sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
@ -128,8 +163,8 @@ $sql .= " , " . MAIN_DB_PREFIX . "facturedet as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = l.fk_code_ventilation";
if (strlen(trim(GETPOST("search_facture")))) {
$sql .= " AND f.facnumber like '%" . $search_facture . "%'";
if (strlen(trim($search_invoice))) {
$sql .= " AND f.facnumber like '%" . $search_invoice . "%'";
}
if (strlen(trim($search_ref))) {
$sql .= " AND p.ref like '%" . $search_ref . "%'";
@ -165,12 +200,12 @@ if ($result) {
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account($account_parent, 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoices"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
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);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
@ -178,10 +213,11 @@ if ($result) {
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print "</tr>\n";
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
@ -202,12 +238,12 @@ if ($result) {
print "<tr $bc[$var]>";
// Ref facture
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref produit
// Ref Product
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
@ -222,8 +258,8 @@ if ($result) {
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . $codecompta . '</td>';
print '<td>' . $objp->rowid . '</td>';
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();
print '</a></td>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
@ -31,16 +31,52 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta");
$langs->load("bills");
$langs->load("other");
$langs->load("main");
$langs->load("accountancy");
$action = GETPOST('action');
$codeventil = GETPOST('codeventil', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
//Should move to top with all GETPOST
$page = GETPOST('page');
if ($page < 0) $page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
//End Should move to top with all GETPOST
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.facnumber will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="l.rowid";
if (! $sortfield) $sortfield="f.datef, f.facnumber, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -50,8 +86,31 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_SOLD_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_SOLD_ACCOUNT);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
}
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
//debug
//print_r($aarowid_s);
//print_r($aarowid_p);
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
@ -68,6 +127,7 @@ print '<script type="text/javascript">
});
});
</script>';
/*
* Action
*/
@ -123,7 +183,13 @@ $offset = $limit * $page;
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.rowid, l.fk_code_ventilation,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell";
// A REVOIR elarifr si vraiment necessaire de rajouter , p.fk_product_type as type. le type produit / service est de facto defini pour chaque ligne de facturedet.product_type
// il est donc plus logique de se servir de l.product_type au lieu de p.fk_product_type
$sql .= " , aa.rowid as aarowid";
// we need f.datef to reorder lines
$sql .= " , f.datef";
// we need to use llx_facturedet l.product_type as used at the time on invoice. if llx_product fk_product_type is changed later it could not change the sell already made !
$sql .= " , l.product_type as type_l";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
@ -131,14 +197,27 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON p.accountan
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.pcg_version = aa.fk_pcg_version";
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='" . $conf->global->CHARTOFACCOUNTS . "' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_sell ='')";
// Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '%" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (l.description like '%" . $search_desc . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
//TODO: Remove comment
//replaced by default value $sortfield,$sortorder
//$sql .= " ORDER BY l.rowid";
//if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
// $sql .= " DESC ";
//}
$sql.= $db->order($sortfield,$sortorder);
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sql .= " DESC ";
}
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
@ -156,58 +235,96 @@ if ($result) {
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="right">' . $langs->trans("Amount") . '</td>';
print '<td align="right">' . $langs->trans("AccountAccounting") . '</td>';
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.facnumber","",$param,'',$sortfield,$sortorder);
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);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print '</tr>';
// We add search filter
/* But Hit Enter will validate ventilation....
print '<tr class="liste_titre">';
print '<td class="liste_titre" >&nbsp;</td>';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="30" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" colspan="3">&nbsp;</td>';
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 '&nbsp;';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>';
*/
$facture_static = new Facture($db);
$product_static = new Product($db);
$form = new Form($db);
$var = True;
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
// product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$code_sell_notset = '';
// C'est le contraire dans les base !!!!!! IT IS INVERTED IN LLX_PRODUCT & LLX_FACTUREDET
// elarifr define account numbercode comptable si pas defini dans la fiche produit a partir des lignes de facturation
// product_type: 1 = service ? 0 = product
// because some modules like subtotal module l.product_type can be other than 0 or 1 ! and we don't put in account lines with product_type=9
// first we check product.fk_product_type as type and l.product_type as type_l
// if product does not exist we use the value of l.product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB ! so we report both and user make choice of accounting account.
$objp->code_sell_l = '';
$objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$code_sell_p_l_differ = '';
if (empty($objp->code_sell)) {
$code_sell_notset = 'color:red';
if (! empty($objp->type)) {
if ($objp->type == 1) {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
} else {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
} else {
$code_sell_notset = 'color:blue';
if ($objp->type == 1) {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
} else {
$objp->code_sell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
//check if code_sell defined in product or set default value according p.fk_product_type do not care lines when product_type value not 0 || 1
//and we set suggested accounting account rowid as $objp->aarowid_s
$code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if ( ! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell;
} else {
$code_sell_p_notset = 'color:red';
if ($objp->type == 1) {
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
elseif ($objp->type == 0) {
$objp->code_sell_p = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
}
}
// check facturedet.product_type & set default value according l.type_l, do not care lines when product_type value not 0 || 1
// if ( ! empty($objp->type_l)) {
// $objp->code_sell_l = $objp->type_l;
// } else {
if ($objp->type_l == 1) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
}
elseif ($objp->type_l == 0) {
$objp->code_sell_l = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
}
// }
//if not same code for product fk_prouct_type and facturedet.product_type, product has been change after sale and must report
if ($objp->code_sell_l <> $objp->code_sell_p) $code_sell_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref facture
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
// Ref produit
// Ref Customer Invoice
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
@ -218,27 +335,39 @@ if ($result) {
print '&nbsp;';
print '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
//TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->total_ht);
print '</td>';
print '<td align="center" style="' . $code_sell_notset . '">';
print $objp->code_sell;
print '<td align="center" style="' . $code_sell_p_notset . '">';
// if not same kind of product_type stored in product & facturedet we display both account and let user choose
if ($objp->code_sell_l == $objp->code_sell_p) {
print $objp->code_sell_l;
} else {
print 'lines='.$objp->code_sell_l . '<br />product=' . $objp->code_sell_p;
}
print '</td>';
// Colonne choix du compte
print '<td align="center">';
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
// TODO: we should set a user defined value to adjust user square / wide screen size
// $trunclengthform = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
print '<td align="center">' . $objp->rowid . '</td>';
// Colonne choix ligne a ventiler
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
//TODO checked only if account exist in product, if only suggested do not check, user must validate
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid_suggest ? "checked" : "") . '/>';
print '</td>';
//debug
//print '</tr><tr><td colspan=6>Product: p.type='. $objp->type .' - p.code_sell='. $objp->code_sell .' --- Check code_sell_product=' . $objp->code_sell_p .' ---Check facturedet l.type_l='. $objp->type_l .' - code_sell_lines=' . $objp->code_sell_l . ' -- aarowid_suggest=' . $objp->aarowid_suggest.'</td>';
print '</tr>';
$i ++;
}
@ -250,5 +379,5 @@ if ($result) {
print $db->error();
}
$db->close();
llxFooter();
$db->close();

View File

@ -36,6 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
@ -115,6 +116,7 @@ $object = new Account($db);
$paymentstatic = new Paiement($db);
$paymentsupplierstatic = new PaiementFourn($db);
$societestatic = new Societe($db);
$userstatic = new User($db);
$chargestatic = new ChargeSociales($db);
$paymentvatstatic = new TVA($db);
$paymentsalstatic = new PaymentSalary($db);
@ -127,8 +129,8 @@ if ($result) {
// Variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef"));
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef"));
$cpttva = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) ? $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE : $langs->trans("CodeNotDef"));
$accountancy_account_salary = (! empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : $langs->trans("CodeNotDef"));
$accountancy_account_pay_vat = (! empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : $langs->trans("CodeNotDef"));
$tabpay = array ();
$tabbq = array ();
@ -175,7 +177,6 @@ if ($result) {
{
$tabtype[$obj->rowid] = $links[$key]['type'];
if ($links[$key]['type'] == 'payment')
{
$paymentstatic->id = $links[$key]['url_id'];
@ -194,6 +195,13 @@ if ($result) {
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
}
else if ($links[$key]['type'] == 'user')
{
$userstatic->id = $links[$key]['url_id'];
$userstatic->name = $links[$key]['label'];
$tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
// $tabtp[$obj->rowid][$compta_user] += $obj->amount;
}
else if ($links[$key]['type'] == 'sc')
{
$chargestatic->id = $links[$key]['url_id'];
@ -232,8 +240,8 @@ if ($result) {
{
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2);
$tabtp[$obj->rowid][$cpttva] += $obj->amount;
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("PaymentVat");
$tabtp[$obj->rowid][$accountancy_account_pay_vat] += $obj->amount;
}
else if ($links[$key]['type'] == 'payment_salary')
{
@ -427,7 +435,6 @@ if ($action == 'export_csv')
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
@ -680,6 +687,7 @@ else
print "<td>" . $reflabel . "</td>";
print "<td>" . $conf->global->ACCOUNTING_ACCOUNT_SUSPENSE . "</td>";
print "<td>" . $langs->trans('ThirdParty') . "</td>";
print "<td>&nbsp;</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";

View File

@ -112,7 +112,7 @@ if ($result) {
$num = $db->num_rows($result);
// les variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$tabfac = array ();
$tabht = array ();

View File

@ -136,7 +136,7 @@ if ($result) {
else
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
}
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_ACCOUNT : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
// Situation invoices handling

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
*
@ -40,12 +40,24 @@ $langs->load("accountancy");
$account_parent = GETPOST('account_parent');
$changeaccount = GETPOST('changeaccount');
$search_ref = GETPOST('search_ref','alpha');
$search_facture = GETPOST('search_facture','alpha');
$search_invoice = GETPOST('search_invoice','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha');
$search_account = GETPOST('search_account','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
if (! $sortfield) $sortfield="f.ref";
if (! $sortorder) $sortorder="DESC";
// Security check
if ($user->societe_id > 0)
accessforbidden();
@ -58,7 +70,7 @@ $formventilation = new FormVentilation($db);
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_facture='';
$search_invoice='';
$search_label='';
$search_desc='';
$search_amount='';
@ -95,20 +107,30 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
llxHeader('', $langs->trans("SuppliersVentilation") . ' - ' . $langs->trans("Dispatched"));
$page = GETPOST("page");
if ($page < 0)
$page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = true;
});
});
$(\'#unselect-all\').click(function(event) {
// Iterate each checkbox
$(\':checkbox\').each(function() {
this.checked = false;
});
});
});
</script>';
/*
* Action
*/
/*
* Supplier Invoice lines
*/
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht , l.qty, l.rowid, l.tva_tx, aa.label, aa.account_number, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
@ -117,8 +139,8 @@ $sql .= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = l.fk_code_ventilation";
if (strlen(trim($search_facture))) {
$sql .= " AND f.ref like '%" . $search_facture . "%'";
if (strlen(trim($search_invoice))) {
$sql .= " AND f.ref like '%" . $search_invoice . "%'";
}
if (strlen(trim($search_ref))) {
$sql .= " AND p.ref like '%" . $search_ref . "%'";
@ -138,12 +160,8 @@ if (strlen(trim($search_account))) {
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sql .= " DESC ";
}
$sql .= $db->plimit($limit + 1, $offset);
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1,$offset);
dol_syslog('accountancy/supplier/lines.php::list sql= ' . $sql1);
$result = $db->query($sql);
@ -152,37 +170,37 @@ if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><b>' . $langs->trans("DescVentilDoneSupplier") . '</b></td>';
print '<form method="GET" action="' . $_SERVER["PHP_SELF"] . '">';
print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
print '<table class="noborder" width="100%">';
print '<br><br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount");
print '<br><div class="inline-block divButAction">'. $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>';
print '<tr class="liste_titre"><td>' . $langs->trans("Invoice") . '</td>';
print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="left">' . $langs->trans("Amount") . '</td>';
print '<td colspan="2" align="left">' . $langs->trans("Account") . '</td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
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);
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="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"],"aa.account_number","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate").'<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print "</tr>\n";
print '<tr class="liste_titre"><td><input name="search_facture" size="8" value="' . $search_facture . '"></td>';
print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_ref" value="' . $search_ref . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="8" name="search_amount" value="' . $search_amount . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_account" value="' . $search_account . '"></td>';
print '<td class="liste_titre" colspan="2">&nbsp;</td>';
print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
@ -215,10 +233,10 @@ if ($result) {
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
print '<td align="left">' . price($objp->total_ht) . '</td>';
print '<td align="left">' . $codeCompta . '</td>';
print '<td>' . $objp->rowid . '</td>';
print '<td><a href="./card.php?id=' . $objp->rowid . '">';
print '<td align="right">' . price($objp->total_ht) . '</td>';
print '<td align="center">' . $codeCompta . '</td>';
print '<td align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
print img_edit();
print '</a></td>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>s
*
@ -31,6 +31,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("compta");
@ -42,6 +43,42 @@ $langs->load("accountancy");
$action = GETPOST('action');
$codeventil = GETPOST('codeventil', 'array');
$mesCasesCochees = GETPOST('mesCasesCochees', 'array');
$search_ref = GETPOST('search_ref','alpha');
$search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
//Should move to top with all GETPOST
$page = GETPOST('page');
if ($page < 0) $page = 0;
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
$limit = $conf->liste_limit;
} else {
$limit = $conf->liste_limit;
}
$offset = $limit * $page;
//End Should move to top with all GETPOST
// TODO : remove comment
//elarifr we can not use only
//$sql .= " ORDER BY l.rowid";
// f.datef will order like FA08 FA09 FA10 FA05 FA06 FA07 FA04...
// f.ref will not order properly invoice / avoir / accompte you can have All AC then All AV and all FA
// l.rowid when an invoice is edited rowid are added at end of table & facturedet.rowid are not ordered
//if (! $sortfield) $sortfield="l.rowid";
if (! $sortfield) $sortfield="f.datef, f.ref, l.rowid";
//if (! $sortorder) $sortorder="DESC";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = " DESC ";
}
}
// Security check
if ($user->societe_id > 0)
@ -51,8 +88,31 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db);
//Defaut AccountingAccount RowId Product / Service
//at this time ACCOUNTING_SERVICE_SOLD_ACCOUNT & ACCOUNTING_PRODUCT_SOLD_ACCOUNT are account number not accountingacount rowid
//so we need to get those default value rowid first
$accounting = new AccountingAccount($db);
//TODO: we should need to check if result is a really exist accountaccount rowid.....
$aarowid_s = $accounting->fetch('', ACCOUNTING_SERVICE_BUY_ACCOUNT);
$aarowid_p = $accounting->fetch('', ACCOUNTING_PRODUCT_BUY_ACCOUNT);
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_ref='';
$search_label='';
$search_desc='';
}
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
//debug
//print_r($aarowid_s);
//print_r($aarowid_p);
print '<script type="text/javascript">
$(function () {
$(\'#select-all\').click(function(event) {
@ -91,7 +151,7 @@ if ($action == 'ventil') {
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql);
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
} else {
@ -126,6 +186,9 @@ $offset = $limit * $page;
$sql = "SELECT f.ref, f.rowid as facid, f.ref_supplier, l.fk_product, l.description, l.total_ht as price, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_buy as code_buy";
$sql .= " , aa.rowid as aarowid";
$sql .= " , f.datef";
$sql .= " , l.product_type as type_l";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
@ -134,14 +197,22 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_system as accsys ON accsys.
$sql .= " WHERE f.fk_statut > 0 AND fk_code_ventilation <= 0";
$sql .= " AND (accsys.rowid='".$conf->global->CHARTOFACCOUNTS."' OR p.accountancy_code_sell IS NULL OR p.accountancy_code_buy ='')";
// Add search filter like
if (strlen(trim($search_ref))) {
$sql .= " AND (p.ref like '%" . $search_ref . "%')";
}
if (strlen(trim($search_label))) {
$sql .= " AND (p.label like '%" . $search_label . "%')";
}
if (strlen(trim($search_desc))) {
$sql .= " AND (l.description like '%" . $search_desc . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
}
$sql .= " ORDER BY l.rowid";
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sql .= " DESC ";
}
$sql.= $db->order($sortfield,$sortorder);
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog('accountancy/supplier/list.php:: $sql=' . $sql);
@ -153,20 +224,22 @@ if ($result) {
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<td align="left"><br><b>' . $langs->trans("DescVentilTodoSupplier") . '</b></br></td>';
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>Facture</td>';
print '<td align="left">' . $langs->trans("Ref") . '</td>';
print '<td align="left">' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Description") . '</td>';
print '<td align="right">' . $langs->trans("Amount") . '</td>';
print '<td align="right">' . $langs->trans("Compte") . '</td>';
print '<td align="center">' . $langs->trans("IntoAccount") . '</td>';
print '<td align="center">' . $langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>'.'</td>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"],"f.ref","",$param,'',$sortfield,$sortorder);
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);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"],"l.description","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AccountAccounting"),'','','','','align="center"');
print_liste_field_titre($langs->trans("IntoAccount"),'','','','','align="center"');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">'.$langs->trans('All').'</label>/<label id="unselect-all">'.$langs->trans('None').'</label>','','','','','align="center"');
print "</tr>\n";
$facturefourn_static = new FactureFournisseur($db);
@ -181,27 +254,48 @@ if ($result) {
// product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
$code_buy_notset = '';
if (empty($objp->code_buy)) {
$code_buy_notset = 'color:red';
$objp->code_buy_l = '';
$objp->code_buy_p = '';
$objp->aarowid_suggest = '';
$code_buy_p_l_differ = '';
$code_buy_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if ( ! empty($objp->code_buy)) {
$objp->code_buy_p = $objp->code_buy;
} else {
$code_buy_p_notset = 'color:red';
if ($objp->type == 1) {
$objp->code_buy = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
} else {
$objp->code_buy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
elseif ($objp->type == 0) {
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
}else {
$code_buy_notset = 'color:blue';
}
if ($objp->type_l == 1) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_s;
}
elseif ($objp->type_l == 0) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '') $objp->aarowid_suggest = $aarowid_p;
}
if ($objp->code_buy_l <> $objp->code_buy_p) $code_buy_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref facture
// Ref Invoice
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
// Ref facture supplier
// Ref Supplier Invoice
$productfourn_static->ref = $objp->product_ref;
$productfourn_static->id = $objp->product_id;
$productfourn_static->type = $objp->type;
@ -212,29 +306,33 @@ if ($result) {
print '&nbsp;';
print '</td>';
// print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref.'</a></td>';
print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
// print '<td><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$objp->facid.'">'.$objp->ref_supplier.'</a></td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<td>' . stripslashes(nl2br($objp->description)) . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->price);
print '</td>';
print '<td align="center" style="' . $code_buy_notset . '">';
print $objp->code_buy;
print '<td align="center" style="' . $code_buy_p_notset . '">';
//if not same kind of product_type stored in product & facturedt we display both account and let user choose
if ($objp->code_buy_l == $objp->code_buy_p) {
print $objp->code_buy_l;
} else {
print 'lines='.$objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
}
print '</td>';
// Colonne choix du compte
print '<td align="center">';
print $formventilation->select_account($objp->aarowid, 'codeventil[]', 1);
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
print '<td align="center">' . $objp->rowid . '</td>';
// Colonne choix ligne a ventiler
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid_suggest ? "checked" : "") . '/>';
print '</td>';
print "</tr>";

View File

@ -34,9 +34,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/cotisation.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
$langs->load("companies");
@ -239,7 +240,7 @@ if (empty($reshook))
}
}
if ($action == 'update' && $cancel='' && $user->rights->adherent->creer)
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -322,8 +323,29 @@ if (empty($reshook))
}
$result=$object->update($user,0,$nosyncuser,$nosyncuserpass);
if ($result >= 0 && ! count($object->errors))
{
// Categories association
// First we delete all categories association
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_member';
$sql .= ' WHERE fk_member = ' . $object->id;
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
// Then we add the associated categories
$categories = GETPOST('memcats', 'array');
if (! empty($categories))
{
$cat = new Categorie($db);
foreach ($categories as $id_category)
{
$cat->fetch($id_category);
$cat->add_type($object, 'member');
}
}
// Logo/Photo save
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'member').'/photos';
$file_OK = is_uploaded_file($_FILES['photo']['tmp_name']);
@ -536,6 +558,18 @@ if (empty($reshook))
$result=$object->create($user);
if ($result > 0)
{
// Categories association
$memcats = GETPOST('memcats', 'array');
if (! empty($memcats))
{
$cat = new Categorie($db);
foreach ($memcats as $id_category)
{
$cat->fetch($id_category);
$cat->add_type($object, 'member');
}
}
$db->commit();
$rowid=$object->id;
$action='';
@ -899,6 +933,15 @@ else
print $form->selectyesno("public",$object->public,1);
print "</td></tr>\n";
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
print '<tr><td>' . fieldLabel('Categories', 'memcars') . '</td><td>';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1);
print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%');
print "</td></tr>";
}
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
@ -976,7 +1019,6 @@ else
$head = member_prepare_head($object);
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
if ($conf->use_javascript_ajax)
{
@ -1020,10 +1062,12 @@ else
print '<input type="hidden" name="statut" value="'.$object->statut.'" />';
if ($backtopage) print '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]).'">';
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
print '<table class="border" width="100%">';
// Ref
print '<tr><td>'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$object->id.'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$object->id.'</td></tr>';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -1069,7 +1113,7 @@ else
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(isset($_POST["societe"])?$_POST["societe"]:$object->societe).'"></td></tr>';
// Civility
print '<tr><td width="20%">'.$langs->trans("UserTitle").'</td><td width="35%">';
print '<tr><td>'.$langs->trans("UserTitle").'</td><td>';
print $formcompany->select_civility(isset($_POST["civility_id"])?$_POST["civility_id"]:$object->civility_id)."\n";
print '</td>';
print '</tr>';
@ -1143,12 +1187,27 @@ else
print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1);
print "</td></tr>\n";
// Categories
if (! empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire ))
{
print '<tr><td>' . fieldLabel('Categories', 'memcats') . '</td>';
print '<td colspan="2">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1);
$c = new Categorie($db);
$cats = $c->containing($object->id, Categorie::TYPE_MEMBER);
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('memcats', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>";
}
// Other attributes
$parameters=array();
$parameters=array("colspan"=>2);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields,'edit');
print $object->showOptionals($extrafields,'edit',$parameters);
}
// Third party Dolibarr
@ -1179,7 +1238,9 @@ else
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
@ -1187,7 +1248,6 @@ else
print '</form>';
print '</div>';
}
if ($rowid && $action != 'edit')
@ -1277,7 +1337,7 @@ else
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
$tmp=$langs->trans("SendAnEMailToMember");
$tmp.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent='';
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
@ -1289,7 +1349,7 @@ else
$helpcontent.=dol_htmlentitiesbr($texttosend)."\n";
$label=$form->textwithpicto($tmp,$helpcontent,1,'help');
// Cree un tableau formulaire
// Create form popup
$formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false));
if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_MAILMAN)) {
@ -1298,7 +1358,7 @@ else
if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
}
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1);
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
}
// Confirm send card by mail
@ -1319,7 +1379,7 @@ else
$texttosend=$object->makeSubstitution($adht->getMailOnResiliate());
$tmp=$langs->trans("SendAnEMailToMember");
$tmp.=' ('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent='';
$helpcontent.='<b>'.$langs->trans("MailFrom").'</b>: '.$conf->global->ADHERENT_MAIL_FROM.'<br>'."\n";
@ -1335,7 +1395,7 @@ else
$formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion);
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
}
// Confirm remove member
@ -1463,12 +1523,21 @@ else
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
print '<tr><td>' . $langs->trans("Categories") . '</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, 'member', 1);
print '</td></tr>';
}
// Other attributes
$parameters=array();
$parameters=array('colspan'=>2);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields);
print $object->showOptionals($extrafields, 'view', $parameters);
}
// Third party Dolibarr

View File

@ -944,7 +944,7 @@ if ($rowid > 0)
$datefrom=$object->datevalid;
}
}
$form->select_date($datefrom,'','','','',"cotisation",1,1);
print $form->select_date($datefrom,'','','','',"cotisation",1,1,1);
print "</td></tr>";
// Date end subscription
@ -957,7 +957,7 @@ if ($rowid > 0)
$dateto=-1; // By default, no date is suggested
}
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td>';
$form->select_date($dateto,'end','','','',"cotisation");
print $form->select_date($dateto,'end','','','',"cotisation",1,0,1);
print "</td></tr>";
if ($adht->cotisation)
@ -1058,7 +1058,7 @@ if ($rowid > 0)
// Date of payment
print '<tr class="bankswitchclass"><td class="fieldrequired">'.$langs->trans("DatePayment").'</td><td>';
$form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1);
print $form->select_date(isset($paymentdate)?$paymentdate:-1,'payment',0,0,1,'cotisation',1,1,1);
print "</td></tr>\n";
print '<tr class="bankswitchclass2"><td>'.$langs->trans('Numero');

View File

@ -73,6 +73,10 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$sall="";
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db);
/*
* View
@ -91,6 +95,12 @@ $sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company,
$sql.= " d.datefin,";
$sql.= " d.email, d.fk_adherent_type as type_id, d.morphy, d.statut,";
$sql.= " t.libelle as type, t.cotisation";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; // We need this table joined to the select in order to filter by categ
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
@ -100,52 +110,23 @@ if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
if ($sall)
{
// For natural search
$scrit = explode(' ', $sall);
foreach ($scrit as $crit)
{
$sql.=" AND (";
if (is_numeric($sall)) $sql.= "d.rowid = ".$db->escape($sall)." OR ";
$sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')";
}
}
if ($type > 0)
{
$sql.=" AND t.rowid=".$db->escape($type);
}
if (isset($_GET["statut"]) || isset($_POST["statut"]))
{
$sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
}
if ($sall) $sql.=natural_search(array("d.rowid", "d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref)
{
if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")";
else $sql.=" AND 1 = 2"; // Always wrong
}
if ($search_lastname)
{
$sql.= " AND (d.firstname LIKE '%".$db->escape($search_lastname)."%' OR d.lastname LIKE '%".$db->escape($search_lastname)."%' OR d.societe LIKE '%".$db->escape($search_lastname)."%')";
}
if ($search_login)
{
$sql.= " AND d.login LIKE '%".$db->escape($search_login)."%'";
}
if ($search_email)
{
$sql.= " AND (d.email LIKE '%".$db->escape($search_email)."%')";
}
if ($filter == 'uptodate')
{
$sql.=" AND datefin >= '".$db->idate($now)."'";
}
if ($filter == 'outofdate')
{
$sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
}
if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname);
if ($search_login) $sql.= natural_search("d.login", $search_login);
if ($search_email) $sql.= natural_search("d.email", $search_email);
if ($filter == 'uptodate') $sql.=" AND datefin >= '".$db->idate($now)."'";
if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->idate($now)."')";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records with no order and no limits
$nbtotalofrecords = 0;
@ -199,11 +180,12 @@ if ($resql)
if ($sall)
{
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall;
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ";
print '<strong>'.$sall.'</strong>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
print "<table class=\"noborder\" width=\"100%\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
// Filter on categories
$moreforfilter='';
@ -214,14 +196,17 @@ if ($resql)
$moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
}
if ($moreforfilter)
if (! empty($moreforfilter))
{
print '<tr class="liste_titre">';
print '<td class="liste_titre" colspan="9">';
print '<div class="liste_titre">';
print $moreforfilter;
print '</td></tr>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
@ -229,7 +214,12 @@ if ($resql)
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"t.libelle",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
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 "</tr>\n";
@ -256,7 +246,12 @@ if ($resql)
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
print '<td class="liste_titre">&nbsp;</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
print '<td class="liste_titre">&nbsp;</td>';
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")).'">';
@ -316,7 +311,11 @@ if ($resql)
// EMail
print "<td>".dol_print_email($objp->email,0,0,1)."</td>\n";
// Statut
$parameters=array('obj' => $obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Statut
print '<td class="nowrap">';
print $memberstatic->LibStatut($objp->statut,$objp->cotisation,$datefin,2);
print "</td>";
@ -365,6 +364,12 @@ if ($resql)
$i++;
}
$db->free($resql);
$parameters=array('sql' => $sql);
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print '</form>';

View File

@ -53,6 +53,12 @@ $pagenext = $page + 1;
if (! $sortorder) { $sortorder="DESC"; }
if (! $sortfield) { $sortfield="d.lastname"; }
$label=GETPOST("libelle","alpha");
$cotisation=GETPOST("cotisation","int");
$vote=GETPOST("vote","int");
$comment=GETPOST("comment");
$mail_valid=GETPOST("mail_valid");
// Security check
$result=restrictedArea($user,'adherent',$rowid,'adherent_type');
@ -83,11 +89,11 @@ if ($action == 'add' && $user->rights->adherent->configurer)
{
$object = new AdherentType($db);
$object->libelle = trim($_POST["libelle"]);
$object->cotisation = trim($_POST["cotisation"]);
$object->note = trim($_POST["comment"]);
$object->mail_valid = trim($_POST["mail_valid"]);
$object->vote = trim($_POST["vote"]);
$object->libelle = trim($label);
$object->cotisation = trim($cotisation);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = trim($vote);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -120,12 +126,12 @@ if ($action == 'update' && $user->rights->adherent->configurer)
if ($_POST["button"] != $langs->trans("Cancel"))
{
$object = new AdherentType($db);
$object->id = $_POST["rowid"];
$object->libelle = trim($_POST["libelle"]);
$object->cotisation = trim($_POST["cotisation"]);
$object->note = trim($_POST["comment"]);
$object->mail_valid = trim($_POST["mail_valid"]);
$object->vote = trim($_POST["vote"]);
$object->id = $rowid;
$object->libelle = trim($label);
$object->cotisation = trim($cotisation);
$object->note = trim($comment);
$object->mail_valid = trim($mail_valid);
$object->vote = trim($vote);
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
@ -169,6 +175,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
print_fiche_titre($langs->trans("MembersTypes"));
dol_fiche_head('');
$sql = "SELECT d.rowid, d.libelle, d.cotisation, d.vote";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
@ -197,7 +204,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a></td>';
print '<td>'.$objp->libelle.'</td>';
print '<td>'.dol_escape_htmltag($objp->libelle).'</td>';
print '<td align="center">'.yn($objp->cotisation).'</td>';
print '<td align="center">'.yn($objp->vote).'</td>';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
@ -211,6 +218,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
dol_print_error($db);
}
dol_fiche_end();
/*
* Hotbar
@ -246,7 +254,7 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<tbody>';
print '<input type="hidden" name="action" value="add">';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
@ -277,7 +285,7 @@ if ($action == 'create')
}
print '<tbody>';
print "</table>\n";
dol_fiche_end();
print '<div class="center">';
@ -317,7 +325,7 @@ if ($rowid > 0)
print '</td></tr>';
// Label
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$object->libelle.'</td></tr>';
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.dol_escape_htmltag($object->libelle).'</td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($object->cotisation);
@ -343,7 +351,9 @@ if ($rowid > 0)
}
print '</table>';
print '</div>';
dol_fiche_end();
/*
* Hotbar
@ -493,15 +503,15 @@ if ($rowid > 0)
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_lastname" value="'.$search_lastname.'" size="12"></td>';
print '<input class="flat" type="text" name="search_lastname" value="'.dol_escape_htmltag($search_lastname).'" size="12"></td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_login" value="'.$search_login.'" size="7"></td>';
print '<input class="flat" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).'" size="7"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" name="search_email" value="'.$search_email.'" size="12"></td>';
print '<input class="flat" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'" size="12"></td>';
print '<td class="liste_titre">&nbsp;</td>';
@ -563,7 +573,7 @@ if ($rowid > 0)
if ($datefin)
{
print '<td align="center" class="nowrap">';
if ($datefin < time() && $objp->statut > 0)
if ($datefin < dol_now() && $objp->statut > 0)
{
print dol_print_date($datefin,'day')." ".img_warning($langs->trans("SubscriptionLate"));
}
@ -634,17 +644,18 @@ if ($rowid > 0)
$head = member_type_prepare_head($object);
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?rowid='.$rowid.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$object->libelle.'"></td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.dol_escape_htmltag($object->libelle).'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("cotisation",$object->cotisation,1);
@ -683,6 +694,8 @@ if ($rowid > 0)
print '</table><br><br>';
}
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -693,6 +706,7 @@ if ($rowid > 0)
}
}
$db->close();
llxFooter();
$db->close();

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2008-2014 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -137,6 +137,11 @@ print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="save">';
$head=agenda_prepare_head();
dol_fiche_head($head, 'autoactions', $langs->trans("Agenda"), 0, 'action');
@ -145,10 +150,6 @@ print $langs->trans("AgendaAutoActionDesc")."<br>\n";
print $langs->trans("OnlyActiveElementsAreShown").'<br>';
print "<br>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="save">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -168,8 +169,9 @@ if (! empty($triggers))
//print 'module='.$module.'<br>';
if (! empty($conf->$module->enabled))
{
// Discard special case.
// Discard special case: If option FICHINTER_CLASSIFY_BILLED is not set, we discard both trigger FICHINTER_CLASSIFY_BILLED and FICHINTER_CLASSIFY_UNBILLED
if ($trigger['code'] == 'FICHINTER_CLASSIFY_BILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
if ($trigger['code'] == 'FICHINTER_CLASSIFY_UNBILLED' && empty($conf->global->FICHINTER_CLASSIFY_BILLED)) continue;
$var=!$var;
print '<tr '.$bc[$var].'>';
@ -185,13 +187,14 @@ if (! empty($triggers))
}
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Save").'">';
print "</div>";
print "</form>\n";
dol_fiche_end();
print "<br>";

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
@ -127,6 +127,10 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print '<br>';
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="save">';
$head=agenda_prepare_head();
dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), 0, 'action');
@ -134,7 +138,6 @@ dol_fiche_head($head, 'extsites', $langs->trans("Agenda"), 0, 'action');
print $langs->trans("AgendaExtSitesDesc")."<br>\n";
print "<br>\n";
print '<form name="extsitesconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
$selectedvalue=$conf->global->AGENDA_DISABLE_EXT;
if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1;
@ -219,7 +222,8 @@ while ($i <= $MAXAGENDA)
}
print '</table>';
print '<br>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" id="save" name="save" class="button hideifnotset" value="'.$langs->trans("Save").'">';
@ -227,7 +231,6 @@ print '</div>';
print "</form>\n";
dol_fiche_end();
llxFooter();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -93,17 +93,16 @@ print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print "<br>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="action" value="set">';
$head=agenda_prepare_head();
dol_fiche_head($head, 'other', $langs->trans("Agenda"), 0, 'action');
//print_titre($langs->trans("OtherOptions"));
$var=true;
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";
@ -158,11 +157,12 @@ 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>';
dol_fiche_end();
print "<br>";

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2008-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
@ -78,6 +78,9 @@ print_fiche_titre($langs->trans("AgendaSetup"),$linkback,'title_setup');
print '<br>';
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$head=agenda_prepare_head();
dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), 0, 'action');
@ -85,18 +88,16 @@ dol_fiche_head($head, 'xcal', $langs->trans("Agenda"), 0, 'action');
print $langs->trans("AgendaSetupOtherDesc")."<br>\n";
print "<br>\n";
print '<form name="agendasetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<table class=\"noborder\" width=\"100%\">";
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<tr class="liste_titre">';
print "<td>".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
//print "<td>".$langs->trans("Examples")."</td>";
print "<td>&nbsp;</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<tr ".$bc[false].">";
print '<td class="fieldrequired">'.$langs->trans("PasswordTogetVCalExport")."</td>";
print '<td><input required="required" type="text" class="flat" id="MAIN_AGENDA_XCAL_EXPORTKEY" name="MAIN_AGENDA_XCAL_EXPORTKEY" value="' . (GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha')?GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY','alpha'):$conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) . '" size="40">';
if (! empty($conf->use_javascript_ajax))
@ -105,13 +106,13 @@ print '</td>';
print "<td>&nbsp;</td>";
print "</tr>";
print "<tr class=\"pair\">";
print "<tr ".$bc[true].">";
print "<td>".$langs->trans("PastDelayVCalExport")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_PAST_DELAY\" value=\"". (GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha')?GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY','alpha'):$conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY) . "\" size=\"10\"> ".$langs->trans("days")."</td>";
print "<td>&nbsp;</td>";
print "</tr>";
print "<tr class=\"impair\">";
print "<tr ".$bc[false].">";
print "<td>".$langs->trans("UseACacheDelay")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"MAIN_AGENDA_EXPORT_CACHE\" value=\"". (GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha')?GETPOST('MAIN_AGENDA_EXPORT_CACHE','alpha'):$conf->global->MAIN_AGENDA_EXPORT_CACHE) . "\" size=\"10\"></td>";
print "<td>&nbsp;</td>";
@ -121,13 +122,13 @@ print '</table>';
print '<br>';
print "<table class=\"noborder\" width=\"100%\">";
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print '<tr class="liste_titre">';
print '<td width="25%">'.$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "</tr>";
print "<tr ".$bc[$var].">";
print "<tr ".$bc[false].">";
print '<td class="fieldrequired">'.$langs->trans("FixTZ")."</td>";
print "<td>";
print '<input class="flat" type="text" size="4" name="AGENDA_EXPORT_FIX_TZ" value="'.$conf->global->AGENDA_EXPORT_FIX_TZ.'">';
@ -137,13 +138,14 @@ print "</tr>";
print '</table>';
print '<br><div class="center">';
dol_fiche_end();
print '<div class="center">';
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</div>";
print "</form>\n";
dol_fiche_end();
clearstatcache();

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ $list = array(
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT',
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
'ACCOUNTING_VAT_ACCOUNT',
'ACCOUNTING_VAT_SOLD_ACCOUNT',
'ACCOUNTING_VAT_BUY_ACCOUNT',
'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER'

View File

@ -229,8 +229,9 @@ $sql.= ", note";
$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin
else $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name'));
$sql.= " ORDER BY entity, name ASC";
dol_syslog("Const::listConstant", LOG_DEBUG);

View File

@ -34,10 +34,12 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$langs->load("errors");
$langs->load("admin");
$langs->load("companies");
$langs->load("resource");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
@ -70,7 +72,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,6,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,0,25,0,26);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,0,25,0,26);
// Name of SQL tables of dictionaries
$tabname=array();
@ -102,6 +104,7 @@ $tabname[25]= MAIN_DB_PREFIX."c_email_templates";
$tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27]= MAIN_DB_PREFIX."c_stcomm";
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
$tabname[29]= MAIN_DB_PREFIX."c_lead_status";
// Dictionary labels
$tablib=array();
@ -133,6 +136,7 @@ $tablib[25]= "DictionaryEMailTemplates";
$tablib[26]= "DictionaryUnits";
$tablib[27]= "DictionaryProspectStatus";
$tablib[28]= "DictionaryHolidayTypes";
$tablib[29]= "DictionaryOpportunityStatus";
// Requests to extract data
$tabsql=array();
@ -164,6 +168,7 @@ $tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position,
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.delay, h.newByMonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
// Criteria to sort dictionaries
$tabsqlsort=array();
@ -195,6 +200,7 @@ $tabsqlsort[25]="label ASC";
$tabsqlsort[26]="code ASC";
$tabsqlsort[27]="code ASC";
$tabsqlsort[28]="country ASC, code ASC";
$tabsqlsort[29]="position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
@ -222,10 +228,11 @@ $tabfield[21]= "code,label";
$tabfield[22]= "code,label";
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label";
$tabfield[25]= "label,type_template,private,position,topic,content";
$tabfield[25]= "label,type_template,position,topic,content";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,delay,newByMonth,country_id,country";
$tabfield[29]= "code,label,percent,position";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
@ -253,10 +260,11 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
$tabfieldvalue[25]= "label,type_template,position,topic,content";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,delay,newByMonth,country";
$tabfieldvalue[29]= "code,label,percent,position";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
@ -284,10 +292,11 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
$tabfieldinsert[25]= "label,type_template,position,topic,content";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,delay,newByMonth,fk_country";
$tabfieldinsert[29]= "code,label,percent,position";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
@ -321,6 +330,7 @@ $tabrowid[25]= "";
$tabrowid[26]= "";
$tabrowid[27]= "id";
$tabrowid[28]= "";
$tabrowid[29]= "";
// Condition to show dictionary in setup page
$tabcond=array();
@ -352,37 +362,39 @@ $tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_D
$tabcond[26]= ! empty($conf->product->enabled);
$tabcond[27]= ! empty($conf->societe->enabled);
$tabcond[28]= ! empty($conf->holiday->enabled);
$tabcond[29]= ! empty($conf->projet->enabled);
// List of help for fields
$tabhelp=array();
$tabhelp[1] = array();
$tabhelp[2] = array();
$tabhelp[3] = array();
$tabhelp[4] = array();
$tabhelp[5] = array();
$tabhelp[6] = array();
$tabhelp[7] = array();
$tabhelp[8] = array();
$tabhelp[9] = array();
$tabhelp[10] = array();
$tabhelp[1] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[2] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[3] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[4] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[5] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[6] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[7] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"));
$tabhelp[10] = array('taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"));
$tabhelp[11] = array();
$tabhelp[12] = array();
$tabhelp[13] = array();
$tabhelp[14] = array();
$tabhelp[15] = array();
$tabhelp[16] = array();
$tabhelp[17] = array();
$tabhelp[18] = array();
$tabhelp[19] = array();
$tabhelp[20] = array();
$tabhelp[21] = array();
$tabhelp[22] = array();
$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[14] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[15] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[16] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[17] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[18] = array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"));
$tabhelp[19] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[20] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array();
$tabhelp[24] = array();
$tabhelp[25] = array();
$tabhelp[26] = array();
$tabhelp[27] = array();
$tabhelp[28] = array();
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
@ -414,6 +426,7 @@ $tabfieldcheck[25] = array();
$tabfieldcheck[26] = array();
$tabfieldcheck[27] = array();
$tabfieldcheck[28] = array();
$tabfieldcheck[29] = 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);
@ -457,6 +470,24 @@ if ($id == 11)
'external' => $langs->trans('External')
);
}
if ($id == 25)
{
// We save list of template type Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array(
'propal_send' => $langs->trans('MailToSendProposal'),
'order_send' => $langs->trans('MailToSendOrder'),
'facture_send' => $langs->trans('MailToSendInvoice'),
'shipping_send' => $langs->trans('MailToSendShipment'),
'fichinter_send' => $langs->trans('MailToSendIntervention'),
'askpricesupplier_send' => $langs->trans('MailToSendSupplierRequestForQuotation'),
'order_supplier_send' => $langs->trans('MailToSendSupplierOrder'),
'invoice_supplier_send' => $langs->trans('MailToSendSupplierInvoice'),
'thirdparty' => $langs->trans('MailToThirdparty')
);
}
// Define localtax_typeList (used for dictionary "llx_c_tva")
$localtax_typeList = array();
@ -803,7 +834,6 @@ if ($action == 'delete')
*/
if ($id)
{
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
@ -858,9 +888,9 @@ if ($id)
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";}
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";}
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
@ -892,6 +922,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($id == 2) // Special cas for state page
{
@ -913,7 +944,7 @@ if ($id)
if ($id == 4) print '<td></td>';
print '<td colspan="4">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '&nbsp;</td>';
print '</td>';
print '</tr>';
// Line to enter new values
@ -935,29 +966,43 @@ if ($id)
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if ($id == 3)
if ($id == 3) unset($fieldlist[2]);
if (empty($reshook))
{
unset($fieldlist[2]);
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
}
if (empty($reshook)) fieldList($fieldlist,$obj);
if ($id == 4) print '<td></td>';
print '<td colspan="3" align="right"><input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'"></td>';
print '<td colspan="3" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
print "</tr>";
$colspan=count($fieldlist)+2;
if ($id == 4) $colspan++;
if (! empty($alabelisused)) // Si un des champs est un libelle
if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
{
print '<tr><td colspan="'.$colspan.'">* '.$langs->trans("LabelUsedByDefault").'.</td></tr>';
}
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>';
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
print '</form>';
// List of available values in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql=$db->query($sql);
@ -972,7 +1017,7 @@ if ($id)
if ($num > $listlimit)
{
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
print_fleche_navigation($page,$_SERVER["PHP_SELF"],'&id='.$id,($num > $listlimit),$langs->trans("Page").' '.($page+1));
print_fleche_navigation($page, $_SERVER["PHP_SELF"], '&id='.$id, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
print '</td></tr>';
}
@ -1002,9 +1047,9 @@ if ($id)
else $valuetoshow=$langs->trans("Amount");
$align='right';
}
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 2",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$form->textwithtooltip($langs->trans("UseLocalTax")." 3",$langs->trans("LocalTaxDesc"),2,1,img_help(1,'')); $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; }
if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; }
if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
@ -1030,6 +1075,7 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
// Affiche nom du champ
if ($showfield)
@ -1065,7 +1111,7 @@ if ($id)
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id]);
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
@ -1085,6 +1131,10 @@ if ($id)
$showfield=1;
$align="left";
$valuetoshow=$obj->$fieldlist[$field];
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
@ -1381,21 +1431,24 @@ $db->close();
* @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldList($fieldlist,$obj='',$tabname='')
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
global $conf,$langs,$db;
global $form;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
global $bc;
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
foreach ($fieldlist as $field => $value)
{
if ($fieldlist[$field] == 'country') {
if ($fieldlist[$field] == 'country')
{
if (in_array('region_id',$fieldlist))
{
print '<td>';
@ -1408,7 +1461,8 @@ function fieldList($fieldlist,$obj='',$tabname='')
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28);
print '</td>';
}
elseif ($fieldlist[$field] == 'country_id') {
elseif ($fieldlist[$field] == 'country_id')
{
if (! in_array('country',$fieldlist)) // If there is already a field country, we don't show country_id (avoid duplicate)
{
$country_id = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0);
@ -1417,22 +1471,32 @@ function fieldList($fieldlist,$obj='',$tabname='')
print '</td>';
}
}
elseif ($fieldlist[$field] == 'region') {
elseif ($fieldlist[$field] == 'region')
{
print '<td>';
$formcompany->select_region($region_id,'region');
print '</td>';
}
elseif ($fieldlist[$field] == 'region_id') {
elseif ($fieldlist[$field] == 'region_id')
{
$region_id = (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:0);
print '<td>';
print '<input type="hidden" name="'.$fieldlist[$field].'" value="'.$region_id.'">';
print '</td>';
}
elseif ($fieldlist[$field] == 'lang') {
elseif ($fieldlist[$field] == 'lang')
{
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>';
}
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''));
print '</td>';
}
// Le type de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'element')
{
@ -1465,9 +1529,25 @@ function fieldList($fieldlist,$obj='',$tabname='')
print '<input type="text" class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" size="3" name="'.$fieldlist[$field].'">';
print '</td>';
}
elseif (in_array($fieldlist[$field], array('libelle_facture','content'))) {
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea></td>';
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'</textarea>';
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
print '<td><input type="text" class="flat" value="'.price((! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')).'" size="8" name="'.$fieldlist[$field].'"></td>';
}
@ -1496,6 +1576,8 @@ function fieldList($fieldlist,$obj='',$tabname='')
{
print '<td>';
$size='';
if ($fieldlist[$field]=='code') $size='size="8" ';
if ($fieldlist[$field]=='position') $size='size="4" ';
if ($fieldlist[$field]=='libelle') $size='size="32" ';
if ($fieldlist[$field]=='tracking') $size='size="92" ';
if ($fieldlist[$field]=='accountancy_code') $size='size="10" ';

View File

@ -146,6 +146,10 @@ if ($action == 'setModuleOptions')
else if ($action == 'set')
{
$ret = addDocumentModel($value, $type, $label, $scandir);
if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF))
{
dolibarr_set_const($db, 'EXPENSEREPORT_ADDON_PDF', $value,'chaine',0,'',$conf->entity);
}
}
else if ($action == 'del')

View File

@ -45,10 +45,10 @@ $action = GETPOST('action');
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
// List of supported permanent search area
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT);
$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"),$langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')',$langs->trans("Members"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name');
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("ProductsAndServices").' ('.$langs->trans("SupplierRef").')', $langs->trans("Members"), $langs->trans("Projects"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module50Name','Module310Name','Module400Name');
if ($action == 'update')
@ -68,11 +68,20 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_THEME", $_POST["main_theme"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', join(',',colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'),array())),'chaine',0,'',$conf->entity);
$val=(join(',',(colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array()))));
if ($val == '') dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
else dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', join(',',colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'),array())),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_CONTACT", $_POST["MAIN_SEARCHFORM_CONTACT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_SOCIETE", $_POST["MAIN_SEARCHFORM_SOCIETE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE", $_POST["MAIN_SEARCHFORM_PRODUITSERVICE"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER",$_POST["MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_ADHERENT", $_POST["MAIN_SEARCHFORM_ADHERENT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_SEARCHFORM_PROJECT", $_POST["MAIN_SEARCHFORM_PROJECT"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", $_POST["MAIN_HELPCENTER_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
@ -147,7 +156,7 @@ if ($action == 'edit') // Edit
print '</table><br>'."\n";
// Themes
// Themes and themes options
show_theme(null,1);
print '<br>';

View File

@ -230,7 +230,6 @@ $linuxlike=1;
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0;
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
$port=! empty($conf->global->MAIN_MAIL_SMTP_PORT)?$conf->global->MAIN_MAIL_SMTP_PORT:ini_get('smtp_port');
if (! $port) $port=25;
@ -275,8 +274,21 @@ if ($action == 'edit')
';
if ($linuxlike)
{
print ' jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);';
print ' jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);';
print '
jQuery("#MAIN_MAIL_SMTP_SERVER").hide();
jQuery("#MAIN_MAIL_SMTP_PORT").hide();
jQuery("#smtp_server_mess").show();
jQuery("#smtp_port_mess").show();
';
}
else
{
print '
jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true);
jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true);
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
';
}
print '
}
@ -287,7 +299,11 @@ if ($action == 'edit')
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_SERVER").removeAttr("disabled");
jQuery("#MAIN_MAIL_SMTP_PORT").removeAttr("disabled");
}
jQuery("#MAIN_MAIL_SMTP_SERVER").show();
jQuery("#MAIN_MAIL_SMTP_PORT").show();
jQuery("#smtp_server_mess").hide();
jQuery("#smtp_port_mess").hide();
}
}
initfields();
jQuery("#MAIN_MAIL_SENDMODE").change(function() {
@ -336,7 +352,7 @@ if ($action == 'edit')
}
print '</td></tr>';
// Server
// Host server
$var=!$var;
print '<tr '.$bc[$var].'><td>';
if (! $conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE == 'mail')
@ -357,6 +373,7 @@ if ($action == 'edit')
{
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER" name="MAIN_MAIL_SMTP_SERVER" size="18" value="' . $mainserver . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_sav" name="MAIN_MAIL_SMTP_SERVER_sav" value="' . $mainserver . '">';
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
}
else
{
@ -389,6 +406,7 @@ if ($action == 'edit')
{
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT" name="MAIN_MAIL_SMTP_PORT" size="3" value="' . $mainport . '">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_sav" name="MAIN_MAIL_SMTP_PORT_sav" value="' . $mainport . '">';
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
}
else
{
@ -509,7 +527,7 @@ else
print $text;
print '</td></tr>';
// Server
// Host server
$var=!$var;
if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'mail'))
{

View File

@ -172,7 +172,7 @@ jQuery(document).ready(function() {
var compcssstring;
getcssurl = $.ajax({
type: "GET",
url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui-latest.custom.css\',
url: \''.DOL_URL_ROOT.'/includes/jquery/css/smoothness/jquery-ui.custom.css\',
cache: false,
/* async: false, */
/*crossDomain: true, */

View File

@ -2,7 +2,8 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -33,6 +34,11 @@ if (!$user->admin) accessforbidden();
$action = GETPOST('action','alpha');
// Other parameters ACCOUNTING_*
$list = array (
'ACCOUNTING_VAT_PAY_ACCOUNT'
);
/*
* Actions
*/
@ -51,9 +57,11 @@ $action = GETPOST('action','alpha');
$tax_mode = empty($conf->global->TAX_MODE)?0:$conf->global->TAX_MODE;
if ($action == 'settaxmode')
{
$tax_mode = GETPOST('tax_mode','alpha');
if ($action == 'update') {
$error = 0;
// Tax mode
$tax_mode = GETPOST('tax_mode','alpha');
$db->begin();
@ -79,38 +87,24 @@ if ($action == 'settaxmode')
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
// Others options
foreach ($list as $constname) {
$constvalue = GETPOST($constname, 'alpha');
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error++;
}
}
if (! $error) {
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
}
else
{
} else {
$db->rollback();
setEventMessage($langs->trans("Error"),'errors');
}
}
/*
if ($_POST['action'] == 'update' || $_POST['action'] == 'add')
{
if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity));
{
print $db->error();
}
}
if ($_GET['action'] == 'delete')
{
if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity));
{
print $db->error();
}
}
*/
/*
* View
@ -122,7 +116,8 @@ $form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans('TaxSetup'),$linkback,'title_setup');
print '<br>';
dol_fiche_head();
if (empty($mysoc->tva_assuj))
{
print $langs->trans("YourCompanyDoesNotUseVAT").'<br>';
@ -134,29 +129,28 @@ else
// Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="settaxmode">';
print '<input type="hidden" name="action" value="update">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print '<td align="right"><input class="button" type="submit" value="'.$langs->trans('Modify').'"></td>';
print '<td colspan="2">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n";
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc'));
print "</td></tr>\n";
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
print '</form>';
print "</table>\n";
print '<br><br>';
print '<br>';
print_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'','');
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
print '<table class="border" width="100%">';
print '<tr><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
// Products
print '<tr><td>'.$langs->trans("Product").'</td>';
print '<tr '.$bc[false].'><td>'.$langs->trans("Product").'</td>';
print '<td>';
print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
@ -167,7 +161,7 @@ else
print '</td></tr>';
// Services
print '<tr><td>'.$langs->trans("Services").'</td>';
print '<tr '.$bc[true].'><td>'.$langs->trans("Services").'</td>';
print '<td>';
if ($tax_mode == 0)
{
@ -196,6 +190,42 @@ else
print '</table>';
}
print "<br>\n";
/*
* Others params
*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
print "</tr>\n";
foreach ($list as $key)
{
$var=!$var;
print '<tr '.$bc[$var].' class="value">';
// Param
$label = $langs->trans($key);
print '<td><label for="'.$key.'">'.$label.'</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
print '</td></tr>';
}
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="button">';
print '</div>';
print '</form>';
$db->close();
llxFooter();

View File

@ -190,7 +190,7 @@ if ($result)
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre('','','');
print_liste_field_titre('');
print "</tr>\n";

View File

@ -134,7 +134,7 @@ if ($savehandler == 'files')
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('','','');
print_liste_field_titre('');
print "</tr>\n";
$var=True;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2014-2015 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
@ -211,7 +211,7 @@ if ($conf->societe->enabled)
{
$nbno=$nbtotal=0;
print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'','');
print_fiche_titre($langs->trans("BarcodeInitForThirdparties"),'','object_company');
print '<br>'."\n";
$sql="SELECT count(rowid) as nb FROM ".MAIN_DB_PREFIX."societe where barcode IS NULL or barcode = ''";
$resql=$db->query($sql);
@ -236,7 +236,7 @@ if ($conf->societe->enabled)
print '<br><input class="button" type="submit" id="submitformbarcodethirdpartygen" '.((GETPOST("selectorforbarcode") && GETPOST("selectorforbarcode"))?'':'disabled ').'value="'.$langs->trans("InitEmptyBarCode",$nbno).'"';
print ' title="'.dol_escape_htmltag($langs->trans("FeatureNotYetAvailable")).'" disabled';
print '>';
print '<br><br><br>';
print '<br><br><br><br>';
}
@ -252,7 +252,7 @@ if ($conf->product->enabled || $conf->product->service)
$nbno=$nbtotal=0;
print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','');
print_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"),'','object_product');
print '<br>'."\n";
$sql ="SELECT count(rowid) as nb, fk_product_type, datec";
@ -312,7 +312,7 @@ if ($conf->product->enabled || $conf->product->service)
$moretags2=(($nbno == $nbtotal)?' disabled':'');
print ' &nbsp; ';
print '<input class="button" type="submit" name="eraseallbarcode" id="eraseallbarcode" value="'.$langs->trans("EraseAllCurrentBarCode").'"'.$moretags2.' onClick="return confirm_erase();">';
print '<br><br><br>';
print '<br><br><br><br>';
}

View File

@ -103,7 +103,7 @@ if ($resql)
print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","","",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","","",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('','','');
print_liste_field_titre('');
print "</tr>\n";
$var=True;

View File

@ -206,8 +206,8 @@ $langs->load("cashdesk");
<td>
<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="<?php echo $langs->trans("Reported"); ?>" onclick="javascript: verifClic('DIF');" />
<?php
echo $langs->trans("DateEcheance").' :';
print $form->select_date(-1,'txtDatePaiement');
print $langs->trans("DateEcheance").' :';
print $form->select_date(-1,'txtDatePaiement',0,0,0,'paymentmode',1,0,1);
?>
</td>
</tr>

View File

@ -160,7 +160,7 @@ foreach($fulltree as $key => $val)
}
print '<table class="liste" width="100%">';
print '<table class="liste nohover" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Categories").'</td><td></td><td align="right">';
if (! empty($conf->use_javascript_ajax))
{

View File

@ -924,9 +924,66 @@ if ($id > 0)
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
if (GETPOST("afaire") == 1) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
else if (GETPOST("afaire") == 2) $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
//else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend','ap');
else $form->select_date($datef?$datef:$object->datef,'p2',1,1,1,"action",1,1,0,0,'fulldayend');
print '</td></tr>';
$userepeatevent=0; // Dev in progress
if ($userepeatevent)
{
// Repeat
print '<tr><td>'.$langs->trans("RepeatEvent").'</td><td colspan="3">';
print '<input type="hidden" name="recurid" value="'.$object->recurid.'">';
$arrayrecurrulefreq=array(
'no'=>$langs->trans("No"),
'MONTHLY'=>$langs->trans("EveryMonth"),
'WEEKLY'=>$langs->trans("EveryWeek"),
//'DAYLY'=>$langs->trans("EveryDay")
);
$selectedrecurrulefreq='no';
$selectedrecurrulebymonthday='';
$selectedrecurrulebyday='';
if ($object->recurrule && preg_match('/FREQ=([A-Z]+)/i',$object->recurrule,$reg)) $selectedrecurrulefreq=$reg[1];
if ($object->recurrule && preg_match('/FREQ=MONTHLY.*BYMONTHDAY=(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebymonthday=$reg[1];
if ($object->recurrule && preg_match('/FREQ=WEEKLY.*BYDAY(\d+)/i',$object->recurrule,$reg)) $selectedrecurrulebyday=$reg[1];
print $form->selectarray('recurrulefreq', $arrayrecurrulefreq, $selectedrecurrulefreq);
// If recurrulefreq is MONTHLY
print '<div class="repeateventBYMONTHDAY">';
print $langs->trans("DayOfMonth").': <input type="input" size="2" name="BYMONTHDAY" value="'.$selectedrecurrulebymonthday.'">';
print '</div>';
// If recurrulefreq is WEEKLY
print '<div class="repeateventBYDAY">';
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>';
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_repeat()
{
if (jQuery("#recurrulefreq").val() == \'MONTHLY\')
{
jQuery(".repeateventBYMONTHDAY").show();
jQuery(".repeateventBYDAY").hide();
}
else if (jQuery("#recurrulefreq").val() == \'WEEKLY\')
{
jQuery(".repeateventBYMONTHDAY").hide();
jQuery(".repeateventBYDAY").show();
}
else
{
jQuery(".repeateventBYMONTHDAY").hide();
jQuery(".repeateventBYDAY").hide();
}
}
init_repeat();
jQuery("#recurrulefreq").change(function() {
init_repeat();
});
});
</script>';
print '</td></tr>';
}
// Status
print '<tr><td class="nowrap">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td><td colspan="3">';
$percent=GETPOST("percentage")?GETPOST("percentage"):$object->percentage;
@ -992,7 +1049,7 @@ if ($id > 0)
print '</td>';
// Contact
print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
print '<td>'.$langs->trans("Contact").'</td><td>';
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>';
}
@ -1000,17 +1057,15 @@ if ($id > 0)
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Projet associe
$langs->load("project");
print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
if ($numprojet==0)
{
print ' &nbsp; <a href="../../projet/card.php?socid='.$object->socid.'&action=create">'.$langs->trans("AddProject").'</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit').'">'.$langs->trans("AddProject").'</a>';
}
print '</td></tr>';
}
@ -1065,7 +1120,7 @@ if ($id > 0)
if($action == 'clone')
{
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . GETPOST('id'), $langs->trans('CloneAction'), $langs->trans('ConfirmCloneAction', $object->label), 'confirm_clone', $formquestion, 'yes', 1);
print $formconfirm;
}
@ -1275,7 +1330,7 @@ if ($id > 0)
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("Modify").'</a></div>';
}
if ($user->rights->agenda->allactions->create ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create))
{
@ -1285,7 +1340,7 @@ if ($id > 0)
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("ToClone").'</a></div>';
}
if ($user->rights->agenda->allactions->delete ||
(($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete))
{

View File

@ -341,11 +341,14 @@ dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action');
print_actions_filter($form,$canedit,$status,$year,$month,$day,$showbirthday,0,$filtert,0,$pid,$socid,$action,$listofextcals,$actioncode,$usergroup);
dol_fiche_end();
// Define the legend/list of calendard to show
$s=''; $link='';
$showextcals=$listofextcals;
// Legend
if (! empty($conf->use_javascript_ajax))
if (! empty($conf->use_javascript_ajax)) // If javascript on
{
$s='';
$s.='<script type="text/javascript">' . "\n";
$s.='jQuery(document).ready(function () {' . "\n";
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
@ -358,7 +361,10 @@ if (! empty($conf->use_javascript_ajax))
$s.='});' . "\n";
$s.='</script>' . "\n";
// Local calendar
$s.='<div class="nowrap clear float"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' &nbsp; </div>';
// External calendars
if (is_array($showextcals) && count($showextcals) > 0)
{
$s.='<script type="text/javascript">' . "\n";
@ -377,13 +383,23 @@ if (! empty($conf->use_javascript_ajax))
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked> ' . $val['name'] . ' &nbsp; </div>';
}
}
// Birthdays
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' &nbsp; </div>';
// Calendars from hooks
$parameters=array(); $object=null;
$reshook=$hookmanager->executeHooks('addCalendarChoice',$parameters,$object,$action);
if (empty($reshook))
{
$s.= $hookmanager->resPrint;
}
elseif ($reshook > 1)
{
$s = $hookmanager->resPrint;
}
}
$link='';
// Add link to show birthdays
if (empty($conf->use_javascript_ajax))
else // If javascript off
{
$newparam=$param; // newparam is for birthday links
$newparam=preg_replace('/showbirthday=[0-1]/i','showbirthday='.(empty($showbirthday)?1:0),$newparam);
@ -396,10 +412,10 @@ if (empty($conf->use_javascript_ajax))
$link.='</a>';
}
print_fiche_titre($s,$link.' &nbsp; &nbsp; '.$nav, '');
print_fiche_titre($s, $link.' &nbsp; &nbsp; '.$nav, '');
// Get event in an array
// Load events from database into $eventarray
$eventarray=array();
$sql = 'SELECT ';
@ -470,6 +486,7 @@ if ($filtert > 0 || $usergroup > 0)
$sql.= ' ORDER BY datep';
//print $sql;
dol_syslog("comm/action/index.php", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
@ -571,6 +588,7 @@ else
dol_print_error($db);
}
// Complete $eventarray with birthdates
if ($showbirthday)
{
// Add events in array
@ -638,6 +656,7 @@ if ($showbirthday)
}
}
// Complete $eventarray with external import Ical
if (count($listofextcals))
{
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/ical.class.php';
@ -878,6 +897,15 @@ if (count($listofextcals))
}
}
// Complete $eventarray with events coming from external module
$parameters=array(); $object=null;
$reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action);
if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']);
$maxnbofchar=18;
$cachethirdparties=array();
$cachecontacts=array();

View File

@ -1768,8 +1768,11 @@ if ($action == 'create')
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans('SendAskByMail'));
print_fiche_titre($langs->trans('SendAskByMail'));
dol_fiche_head('');
// Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
@ -1816,7 +1819,7 @@ if ($action == 'create')
print $formmail->get_form();
print '<br>';
dol_fiche_end();
}
}

View File

@ -131,7 +131,7 @@ if ($resql)
}
if ($conf->use_javascript_ajax)
{
print '<tr><td align="center" colspan="2">';
print '<tr '.$bc[false].'><td align="center" colspan="2">';
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);
print '</td></tr>';

View File

@ -270,22 +270,22 @@ if ($result)
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('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AskPriceSupplierDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
print '</td>';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
print '</td>';
// Date
print '<td class="liste_titre" colspan="1" align="center">';
//print $langs->trans('Month').': ';
@ -294,7 +294,7 @@ if ($result)
$syear = $year;
$formother->select_year($syear,'year',1, 20, 5);
print '</td>';
// Amount
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
@ -353,7 +353,7 @@ if ($result)
print '</td></tr></table>';
print "</td>\n";
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid;
// Company
@ -364,12 +364,12 @@ if ($result)
print '<td>';
print $companystatic->getNomUrl(1,'customer');
print '</td>';
// Date askprice
print '<td align="center">';
print dol_print_date($db->jdate($objp->dp), 'day');
print "</td>\n";
print '<td align="right">'.price($objp->total_ht)."</td>\n";
$userstatic->id=$objp->fk_user_author;

View File

@ -410,17 +410,19 @@ if ($id > 0)
print '</td><td colspan="3">';
$limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
if (empty($object->outstanding_limit)) print $langs->trans("NoLimit");
// display amount and link to unpaid bill
$outstandingBills = $object->get_OutstandingBill();
if ($outstandingBills != 0)
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
if ($object->outstanding_limit != '')
{
print ' ('.$langs->trans("CurrentOutstandingBill");
print ' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'&search_status=1">';
print price($outstandingBills, '', $langs, 0, -1, -1, $conf->currency);
print '</a>';
if ($outstandingBills > $object->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
print ')';
if ($outstandingBills > $object->outstanding_limit)
print img_warning($langs->trans("OutstandingBillReached"));
//print ' / ' . price($soc->outstanding_limit);
}
print ')';
print '</td>';
print '</tr>';
}

View File

@ -131,8 +131,8 @@ if ($resql)
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 '<td class="liste_titre">'.$langs->trans("Email").'</td>';
print '<td class="liste_titre">'.$langs->trans("Phone").'</td>';
print_liste_field_titre($langs->trans("Email"));
print_liste_field_titre($langs->trans("Phone"));
print "</tr>\n";
print '<form action="'.$_SERVER["PHP_SELF"].'?type='.$_GET["type"].'" method="GET">';

View File

@ -55,7 +55,7 @@ $search_zipcode=GETPOST("search_zipcode");
$search_town=GETPOST("search_town");
$search_code=GETPOST("search_code");
$search_compta=GETPOST("search_compta");
$search_status = GETPOST("search_status",'int');
$search_status= GETPOST("search_status",'int');
// Load sale and categ filters
$search_sale = GETPOST("search_sale",'int');
@ -66,6 +66,7 @@ if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('customerlist'));
$extrafields = new ExtraFields($db);
/*
@ -107,6 +108,12 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url);
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
$sql.= " s.datec, s.canvas";
if ((!$user->rights->societe->client->voir && !$socid) || $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)
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
if ((!$user->rights->societe->client->voir && !$socid) || $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
@ -116,33 +123,22 @@ $sql.= " AND s.client IN (1, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_company) {
$sql .= natural_search(
array(
's.nom',
's.name_alias'
),
$search_company
);
}
if ($search_zipcode) $sql.= " AND s.zip LIKE '".$db->escape($search_zipcode)."%'";
if ($search_town) {
$sql .= natural_search('s.town', $search_town);
}
if ($search_code) $sql.= " AND s.code_client LIKE '%".$db->escape($search_code)."%'";
if ($search_compta) $sql.= " AND s.code_compta LIKE '%".$db->escape($search_compta)."%'";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
// Insert sale filter
if ($search_sale > 0)
{
$sql .= " AND sc.fk_user = ".$search_sale;
}
if ($search_company) $sql.= natural_search(array('s.nom', 's.name_alias'), $search_company);
if ($search_zipcode) $sql.= natural_search("s.zip", $search_zipcode);
if ($search_town) $sql.= natural_search('s.town', $search_town);
if ($search_code) $sql.= natural_search("s.code_client", $search_code);
if ($search_compta) $sql.= natural_search("s.code_compta", $search_compta);
if ($search_status!='') $sql.= " AND s.status = ".$db->escape($search_status);
if ($search_sale > 0) $sql.= " AND sc.fk_user = ".$search_sale;
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
@ -190,6 +186,9 @@ if ($result)
{
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
@ -202,11 +201,12 @@ if ($result)
print_liste_field_titre($langs->trans("CustomerCode"),$_SERVER["PHP_SELF"],"s.code_client","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("AccountancyCode"),$_SERVER["PHP_SELF"],"s.code_compta","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"datec","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print "</tr>\n";
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
@ -234,6 +234,10 @@ if ($result)
print '&nbsp;';
print '</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
@ -242,9 +246,6 @@ if ($result)
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print '</tr>'."\n";
@ -272,12 +273,15 @@ if ($result)
print '<td>'.$obj->code_client.'</td>';
print '<td>'.$obj->code_compta.'</td>';
print '<td align="right">'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
print '</td>';
print '<td></td>';
$parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="center">'.$thirdpartystatic->getLibStatut(3);
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
@ -285,7 +289,8 @@ if ($result)
$db->free($result);
$parameters=array('sql' => $sql);
$formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</table>\n";
print "</form>\n";

View File

@ -992,6 +992,9 @@ else
// Print mail content
print_fiche_titre($langs->trans("EMail"),'','');
dol_fiche_head('');
print '<table class="border" width="100%">';
// Subject
@ -1042,7 +1045,8 @@ else
print '</tr>';
print '</table>';
print "<br>";
dol_fiche_end();
}
else
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2013 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
*
@ -408,25 +408,17 @@ if ($object->fetch($id) >= 0)
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);
// Date sending
if ($object->statut < 2)
{
print '<td class="liste_titre">&nbsp;</td>';
print_liste_field_titre('');
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
// Statut
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
//Search Icon
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
// Ligne des champs de filtres
@ -463,8 +455,7 @@ if ($object->fetch($id) >= 0)
//Search Icon
print '<td class="liste_titre" align="right">';
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 '&nbsp; ';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '</td>';
print '</tr>';
@ -523,9 +514,6 @@ if ($object->fetch($id) >= 0)
{
print '<td align="center">&nbsp;</td>';
print '<td align="right" class="nowrap">'.$langs->trans("MailingStatusNotSent");
if ($user->rights->mailing->creer && $allowaddtarget) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
}
print '</td>';
}
else
@ -537,7 +525,14 @@ if ($object->fetch($id) >= 0)
}
//Sreach Icon
print '<td></td>';
print '<td align="right">';
if ($obj->statut == 0)
{
if ($user->rights->mailing->creer && $allowaddtarget) {
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$obj->rowid.$param.'">'.img_delete($langs->trans("RemoveRecipient"));
}
}
print '</td>';
print '</tr>';
$i++;
@ -545,7 +540,7 @@ if ($object->fetch($id) >= 0)
}
else
{
print '<tr '.$bc[false].'><td colspan="7">'.$langs->trans("NoTargetYet").'</td></tr>';
print '<tr '.$bc[false].'><td colspan="8">'.$langs->trans("NoTargetYet").'</td></tr>';
}
print "</table><br>";

View File

@ -2288,6 +2288,9 @@ if ($action == 'create')
}
print "<br>\n";
//Select mail models is same action as presend
if (GETPOST('modelselected')) $action = 'presend';
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
@ -2330,10 +2333,6 @@ if ($action == 'create')
/*
* Action presend
*/
//Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
}
if ($action == 'presend')
{
$object->fetch_projet();
@ -2369,8 +2368,11 @@ if ($action == 'create')
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans('SendPropalByMail'));
print_fiche_titre($langs->trans('SendPropalByMail'));
dol_fiche_head('');
// Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
@ -2439,7 +2441,7 @@ if ($action == 'create')
print $formmail->get_form();
print '<br>';
dol_fiche_end();
}
}

View File

@ -66,7 +66,7 @@ class PropaleStats extends Stats
$this->field='total_ht';
$this->field_line='total_ht';
$this->where.= " p.fk_statut > 0";
//$this->where.= " AND p.fk_soc = s.rowid AND p.entity = ".$conf->entity;
$this->where.= " AND p.entity IN (".getEntity('propal', 1).")";
@ -183,7 +183,7 @@ class PropaleStats extends Stats
return $this->_getAllByYear($sql);
}
/**
* Return nb, amount of predefined product for year
@ -193,9 +193,11 @@ class PropaleStats extends Stats
*/
function getAllByProduct($year)
{
global $user;
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " AND p.rowid = tl.fk_propal AND tl.fk_product = product.rowid";
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";
@ -204,5 +206,5 @@ class PropaleStats extends Stats
//$sql.= $this->db->plimit(20);
return $this->_getAllByProduct($sql);
}
}
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
@ -9,8 +9,8 @@
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* 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
@ -58,8 +58,8 @@ $search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_author=GETPOST('search_author','alpha');
$search_product_category=GETPOST('search_product_category','int');
$search_town=GETPOST('search_town','alpha');
$viewstatut=$db->escape(GETPOST('viewstatut'));
$object_statut=$db->escape(GETPOST('propal_statut'));
$viewstatut=GETPOST('viewstatut');
$object_statut=GETPOST('propal_statut');
$sall=GETPOST("sall");
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
@ -255,6 +255,7 @@ if ($result)
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
if ($search_author) $param.='&search_author='.$search_author;
if ($search_town) $param.='&search_town='.$search_town;
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png');
// Lignes des champs de filtre
@ -271,7 +272,7 @@ if ($result)
$langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300');
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
@ -279,7 +280,7 @@ if ($result)
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
@ -310,7 +311,7 @@ if ($result)
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -28,10 +28,13 @@
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
$WIDTH=DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT=DolGraph::getDefaultGraphSizeForStats('height');
$object_statut=GETPOST('propal_statut');
$userid=GETPOST('userid','int');
$socid=GETPOST('socid','int');
// Security check
@ -55,11 +58,12 @@ $mode=GETPOST('mode');
*/
$form=new Form($db);
$formpropal=new FormPropal($db);
$langs->load('propal');
$langs->load('other');
llxHeader();
llxHeader('', $langs->trans("ProposalsStatistics"));
print_fiche_titre($langs->trans("ProposalsStatistics"),'','title_commercial.png');
@ -67,7 +71,9 @@ $dir=$conf->propal->dir_temp;
dol_mkdir($dir);
$stats = new PropaleStats($db, $socid, ($userid>0?$userid:0));
if ($object_statut != '' && $object_statut >= 0) $stats->where .= ' AND p.fk_statut IN ('.$object_statut.')';
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear,$startyear);
@ -113,7 +119,7 @@ if (! $mesg)
}
// Build graphic amount of object
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear);
$data = $stats->getAmountByMonthWithPrevYear($endyear,$startyear,0);
// $data = array(array('Lib',val1,val2,val3),...)
if (!$user->rights->societe->client->voir || $user->societe_id)
@ -154,7 +160,7 @@ if (! $mesg)
$px2->draw($filenameamount,$fileurlamount);
}
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear, $filter);
$fileurl_avg='';
if (!$user->rights->societe->client->voir || $user->societe_id)
@ -239,6 +245,10 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
print '<tr><td align="left">'.$langs->trans("CreatedBy").'</td><td align="left">';
print $form->select_dolusers($userid,'userid',1);
print '</td></tr>';
// Status
print '<tr><td align="left">'.$langs->trans("Status").'</td><td align="left">';
$formpropal->selectProposalStatus($object_statut,0,1);
print '</td></tr>';
// Year
print '<tr><td align="left">'.$langs->trans("Year").'</td><td align="left">';
if (! in_array($year,$arrayyears)) $arrayyears[$year]=$year;

View File

@ -156,6 +156,7 @@ $sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('prospectlist'));
$extrafields = new ExtraFields($db);
// Do we click on purge search criteria ?
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
@ -214,6 +215,12 @@ $sql.= " s.prefix_comm, s.fk_prospectlevel, s.fk_stcomm as stcomm_id,";
$sql.= " st.libelle as stcomm_label,";
$sql.= " d.nom as departement";
if ((!$user->rights->societe->client->voir && !$socid) || $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)
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
@ -229,15 +236,7 @@ if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) {
$sql .= natural_search(
array(
's.nom',
's.name_alias'
),
$search_nom
);
}
if ($search_nom) $sql .= natural_search(array('s.nom','s.name_alias'), $search_nom);
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
if ($search_town) $sql .= natural_search('s.town', $search_town);
if ($search_state) $sql .= natural_search('d.nom', $search_state);
@ -253,6 +252,10 @@ if ($socname)
$sortfield = "s.nom";
$sortorder = "ASC";
}
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -326,6 +329,9 @@ if ($resql)
{
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
@ -340,12 +346,13 @@ if ($resql)
print_liste_field_titre($langs->trans("ProspectLevelShort"),$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("StatusProsp"),$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
$parameters=array();
$formconfirm=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"s.status","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
@ -404,7 +411,11 @@ if ($resql)
print '&nbsp;';
print '</td>';
print '<td class="liste_titre" align="center">';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
@ -413,10 +424,6 @@ if ($resql)
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print "</tr>\n";
$i = 0;
@ -462,13 +469,15 @@ if ($resql)
}
print '</td>';
print '<td align="center">';
print $prospectstatic->LibStatut($prospectstatic->status,3);
print '</td>';
print '<td></td>';
$parameters=array('obj' => $obj);
$formconfirm=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '<td align="right">';
print $prospectstatic->LibStatut($prospectstatic->status,5);
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
@ -483,7 +492,8 @@ if ($resql)
$db->free($resql);
$parameters=array('sql' => $sql);
$formconfirm=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
}
else
{

View File

@ -32,6 +32,7 @@
* \ingroup commande
* \brief Page to show customer order
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formorder.class.php';
@ -1371,7 +1372,6 @@ if ($action == 'create' && $user->rights->commande->creer)
}
// Date
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
//$form->select_date($dateorder, 're', '', '', '', "crea_commande", 1, 1);
$form->select_date('', 're', '', '', '', "crea_commande", 1, 1); // Always autofill date with current date
print '</td></tr>';
@ -1430,7 +1430,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td>';
print '</tr>';
}
@ -2362,8 +2362,11 @@ if ($action == 'create' && $user->rights->commande->creer)
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans('SendOrderByMail'));
print_fiche_titre($langs->trans('SendOrderByMail'));
dol_fiche_head('');
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
@ -2402,8 +2405,10 @@ if ($action == 'create' && $user->rights->commande->creer)
$contactarr = array();
$contactarr = $object->liste_contact(- 1, 'external');
if (is_array($contactarr) && count($contactarr) > 0) {
foreach ($contactarr as $contact) {
if (is_array($contactarr) && count($contactarr) > 0)
{
foreach ($contactarr as $contact)
{
if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
$contactstatic = new Contact($db);
$contactstatic->fetch($contact ['id']);
@ -2432,7 +2437,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Show form
print $formmail->get_form();
print '<br>';
dol_fiche_end();
}
}
}

View File

@ -46,6 +46,7 @@ $orderyear=GETPOST("orderyear","int");
$ordermonth=GETPOST("ordermonth","int");
$deliveryyear=GETPOST("deliveryyear","int");
$deliverymonth=GETPOST("deliverymonth","int");
$search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('search_ref','alpha')!=''?GETPOST('search_ref','alpha'):GETPOST('sref','alpha');
$search_ref_customer=GETPOST('search_ref_customer','alpha');
$search_company=GETPOST('search_company','alpha');
@ -79,6 +80,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_categ='';
$search_user='';
$search_sale='';
$search_product_category='';
$search_ref='';
$search_ref_customer='';
$search_company='';
@ -115,10 +117,14 @@ $companystatic = new Societe($db);
$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
llxHeader('',$langs->trans("Orders"),$help_url);
$sql = 'SELECT s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' s.nom as name, s.rowid as socid, s.client, s.code_client, c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client,';
$sql.= ' c.date_valid, c.date_commande, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as facturee';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'commande as c';
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON c.rowid=pd.fk_commande';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
// We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($search_user > 0)
@ -128,15 +134,11 @@ if ($search_user > 0)
}
$sql.= ' WHERE c.fk_soc = s.rowid';
$sql.= ' AND c.entity IN ('.getEntity('commande', 1).')';
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_ref) {
$sql .= natural_search('c.ref', $search_ref);
}
if ($sall)
{
$sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
}
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
if ($sall) $sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
if ($viewstatut <> '')
{
if ($viewstatut < 4 && $viewstatut > -3)
@ -190,24 +192,12 @@ else if ($deliveryyear > 0)
{
$sql.= " AND c.date_livraison BETWEEN '".$db->idate(dol_get_first_day($deliveryyear,1,false))."' AND '".$db->idate(dol_get_last_day($deliveryyear,12,false))."'";
}
if (!empty($search_company))
{
$sql .= natural_search('s.nom', $search_company);
}
if (!empty($search_ref_customer))
{
$sql.= ' AND c.ref_client LIKE \'%'.$db->escape($search_ref_customer).'%\'';
}
if (!empty($search_company)) $sql .= natural_search('s.nom', $search_company);
if (!empty($search_ref_customer)) $sql.= natural_search('c.ref_client', $search_ref_customer);
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
if ($search_user > 0)
{
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
}
if ($search_total_ht != '')
{
$sql.= natural_search('c.total_ht', $search_total_ht, 1);
}
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1);
$sql.= $db->order($sortfield,$sortorder);
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -216,7 +206,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit + 1,$offset);
//print $sql;
@ -278,22 +267,37 @@ if ($resql)
if ($user->rights->societe->client->voir || $socid)
{
$langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300');
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
$moreforfilter.='</div>';
}
if (! empty($moreforfilter))
{
print '<tr class="liste_titre">';
print '<td class="liste_titre" colspan="9">';
print $moreforfilter;
print '</td></tr>';
print '<div class="liste_titre">';
print $moreforfilter;
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print '</div>';
}
print '<tr class="liste_titre">';
@ -303,7 +307,11 @@ if ($resql)
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'c.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
print '<tr class="liste_titre">';
@ -328,6 +336,10 @@ if ($resql)
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
print '</td>';
print '<td align="right">';
$liststatus=array('0'=>$langs->trans("StatusOrderDraftShort"), '1'=>$langs->trans("StatusOrderValidated"), '2'=>$langs->trans("StatusOrderSentShort"), '3'=>$langs->trans("StatusOrderToBill"), '4'=>$langs->trans("StatusOrderProcessed"), '-1'=>$langs->trans("StatusOrderCanceledShort"));
print $form->selectarray('viewstatut', $liststatus, $viewstatut, 1);
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
@ -493,6 +505,8 @@ if ($resql)
// Statut
print '<td align="right" class="nowrap">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).'</td>';
print '<td></td>';
print '</tr>';
$total+=$objp->total_ht;
@ -507,7 +521,8 @@ if ($resql)
print '<td class="nowrap" colspan="5">'.$langs->trans('TotalHT').'</td>';
// Total HT
print '<td align="right" class="nowrap">'.price($total).'</td>';
print '<td class="nowrap">&nbsp;</td>';
print '<td></td>';
print '<td></td>';
print '</tr>';
}

View File

@ -374,43 +374,34 @@ if ($id > 0 || ! empty($ref))
* Boutons actions
*/
if ($action != 'delete')
{
if ($action != 'delete') {
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro) // If not cash account and can be reconciliate
{
if ($user->rights->banque->consolidate)
{
if ($object->type != 2 && $object->rappro) { // If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
if ($action != 'addline')
{
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT))
{
if ($user->rights->banque->modifier)
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
else
{
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
print '</div>';
}
if ($action != 'addline') {
if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) {
if (empty($conf->accounting->enabled)) {
if ($user->rights->banque->modifier) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=addline&amp;id='.$object->id.'&amp;page='.$page.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("AddBankRecord").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
} else {
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
} else {
print '<a class="butActionRefused" title="'.$langs->trans("FeatureDisabled").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
}
}
print '</div>';
}
print '<br>';
@ -466,15 +457,12 @@ if ($id > 0 || ! empty($ref))
print '<div class="floatright">'.$navig.'</div>';
}
print '<table class="noborder" width="100%">';
// Form to add a transaction with no invoice
if ($user->rights->banque->modifier && $action == 'addline')
{
print '<tr>';
print '<td align="left" colspan="10"><b>'.$langs->trans("AddBankRecordLong").'</b></td>';
print '</tr>';
print_fiche_titre($langs->trans("AddBankRecordLong"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Date").'</td>';
print '<td>&nbsp;</td>';
@ -507,11 +495,13 @@ if ($id > 0 || ! empty($ref))
print '<input type="submit" name="save" class="button" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print "</form>";
print '<tr class="noborder"><td colspan="10">&nbsp;</td></tr>'."\n";
print '</table>';
print '</form>';
print '<br>';
}
print '<table class="noborder" width="100%">';
/*
* Affiche tableau des transactions bancaires
*/

View File

@ -113,12 +113,12 @@ if ($conf->salaries->enabled)
$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("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.dateep","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$var=1;
while ($i < $num)

View File

@ -262,7 +262,7 @@ if ($action == 'create')
print "<tr>";
print '<td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
print $form->select_date($datec?$datec:-1,'','','','','add',1,1);
print $form->select_date($datec?$datec:-1,'','','','','add',1,1,1);
print '</td></tr>';
// Km
@ -358,7 +358,7 @@ else if ($id)
// Date
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
print $form->select_date($object->date,'','','','','update');
print $form->select_date($object->date,'',0,0,0,'update',1,0,1);
print '</td></tr>';
// Km
@ -433,7 +433,7 @@ else if ($id)
print '</td></tr>';
$form->load_cache_types_fees();
// Type
print '<tr><td>';
print $form->editfieldkey("Type",'type',$langs->trans($object->type),$object,$conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer,'select:types_fees');

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
*
@ -98,7 +98,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Statistics
print '<table class="noborder" width="100%">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("Statistics").'</td>';
print "</tr>\n";
@ -111,7 +111,7 @@ foreach ($listoftype as $code => $label)
if ($conf->use_javascript_ajax)
{
print '<tr><td align="center" colspan="4">';
print '<tr '.$bc[false].'><td align="center" colspan="4">';
$data=array('series'=>$dataseries);
dol_print_graph('stats',300,180,$data,1,'pie',1);
print '</td></tr>';

View File

@ -139,7 +139,7 @@ if ($resql)
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('',$_SERVER["PHP_SELF"], '');
print_liste_field_titre('');
print "</tr>\n";
// Filters lines

View File

@ -2273,7 +2273,7 @@ if ($action == 'create')
// Date invoice
print '<tr><td class="fieldrequired">' . $langs->trans('Date') . '</td><td colspan="2">';
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
$form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1);
print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1);
print '</td></tr>';
// Payment term
@ -2300,7 +2300,7 @@ if ($action == 'create')
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
print ' &nbsp; <a href="../projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid=' . $soc->id . '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$soc->id).'">' . $langs->trans("AddProject") . '</a>';
print '</td></tr>';
}
@ -2457,12 +2457,12 @@ if ($action == 'create')
print '<td class="nobordernopadding nowrap">';
print $langs->trans('From') . ' ';
print '</td><td class="nobordernopadding nowrap">';
print $form->select_date('', 'date_start' . $i, $usehm, $usehm, 1, "add");
print $form->select_date('', 'date_start' . $i, $usehm, $usehm, 1, "add", 1, 0, 1);
print '</td></tr>';
print '<td class="nobordernopadding nowrap">';
print $langs->trans('to') . ' ';
print '</td><td class="nobordernopadding nowrap">';
print $form->select_date('', 'date_end' . $i, $usehm, $usehm, 1, "add");
print $form->select_date('', 'date_end' . $i, $usehm, $usehm, 1, "add", 1, 0, 1);
print '</td></tr></table>';
print '</td>';
}
@ -2502,7 +2502,9 @@ if ($action == 'create')
}
print '<br>';
} else if ($id > 0 || ! empty($ref)) {
}
else if ($id > 0 || ! empty($ref))
{
/*
* Show object in view mode
*/
@ -2522,7 +2524,8 @@ if ($action == 'create')
$result = $object->fetch_thirdparty();
$soc = new Societe($db);
$soc->fetch($object->socid);
$result=$soc->fetch($object->socid);
if ($result < 0) dol_print_error($db);
$selleruserevenustamp = $mysoc->useRevenueStamp();
$totalpaye = $object->getSommePaiement();
@ -2857,7 +2860,8 @@ if ($action == 'create')
$outstandingBills = $soc->get_OutstandingBill();
print ' - ' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency);
if ($soc->outstanding_limit != '') {
if ($soc->outstanding_limit != '')
{
if ($outstandingBills > $soc->outstanding_limit)
print img_warning($langs->trans("OutstandingBillReached"));
print ' / ' . price($soc->outstanding_limit);
@ -2946,7 +2950,8 @@ if ($action == 'create')
} else
print '. ';
}
if ($absolute_creditnote > 0) {
if ($absolute_creditnote > 0)
{
// If validated, we show link "add credit note to payment"
if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) {
@ -3850,8 +3855,9 @@ if ($action == 'create')
$file = $fileparams['fullname'];
}
print '<div class="clearboth"></div>';
print '<br>';
print_titre($langs->trans($titreform));
print_fiche_titre($langs->trans($titreform));
// Cree l'objet formulaire mail
dol_fiche_head();

View File

@ -2721,7 +2721,10 @@ class Facture extends CommonInvoice
$dir = dol_buildpath($reldir."core/modules/facture/");
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
if (is_file($dir.$file) && is_readable($dir.$file))
{
$mybool |= include_once $dir . $file;
}
}
// For compatibility
@ -2734,8 +2737,11 @@ class Facture extends CommonInvoice
foreach ($conf->file->dol_document_root as $dirroot)
{
$dir = $dirroot."/core/modules/facture/";
// Load file with numbering class (if found)
$mybool|=@include_once $dir.$file;
if (is_file($dir.$file) && is_readable($dir.$file)) {
$mybool |= include_once $dir . $file;
}
}
}
@ -3061,11 +3067,14 @@ class Facture extends CommonInvoice
/**
* Create a withdrawal request for a standing order
*
* @param User $user User asking standing order
* @param User $fuser User asking standing order
* @param float $amount Amount we request withdraw for
* @return int <0 if KO, >0 if OK
*/
function demande_prelevement($user)
function demande_prelevement($fuser, $amount=0)
{
global $langs;
$error=0;
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
@ -3099,27 +3108,36 @@ class Facture extends CommonInvoice
// For example print 239.2 - 229.3 - 9.9; does not return 0.
//$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
//$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
$resteapayer = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
if (empty($amount)) $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits,'MT');
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($resteapayer)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$user->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
if (is_numeric($amount) && $amount != 0)
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($amount)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$fuser->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
$error++;
}
dol_syslog(get_class($this)."::demande_prelevement", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
$error++;
}
}
else
{
$this->error='WithdrawRequestErrorNilAmount';
dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount');
$error++;
}
if (! $error)
{
@ -3159,11 +3177,11 @@ class Facture extends CommonInvoice
/**
* Supprime une demande de prelevement
*
* @param User $user utilisateur creant la demande
* @param User $fuser User making delete
* @param int $did id de la demande a supprimer
* @return int <0 if OK, >0 if KO
*/
function demande_prelevement_delete($user, $did)
function demande_prelevement_delete($fuser, $did)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande';
$sql .= ' WHERE rowid = '.$did;
@ -3184,8 +3202,8 @@ class Facture extends CommonInvoice
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @param User $user Object user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
* @param User $user Object user
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user)
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
@ -129,7 +129,7 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="facid" value="'.$object->id.'">';
dol_fiche_head();
$rowspan=4;
@ -202,7 +202,7 @@ if ($action == 'create')
$sql = 'SELECT l.fk_product, l.product_type, l.label as custom_label, l.description, l.qty, l.rowid, l.tva_tx,';
$sql.= ' l.fk_remise_except,';
$sql.= ' l.remise_percent, l.subprice, l.info_bits,';
$sql.= ' l.total_ht, l.total_tva, l.total_ttc,';
$sql.= ' l.total_ht, l.total_tva as total_vat, l.total_ttc,';
$sql.= ' l.date_start,';
$sql.= ' l.date_end,';
$sql.= ' l.product_type,';
@ -220,7 +220,7 @@ if ($action == 'create')
$num = $db->num_rows($result);
$i = 0; $total = 0;
echo '<table class="notopnoleftnoright" width="100%">';
echo '<table class="noborder" width="100%">';
if ($num)
{
print '<tr class="liste_titre">';
@ -572,7 +572,7 @@ else
/*
* List mode
*/
$sql = "SELECT s.nom as name, s.rowid as socid, f.titre, f.total, f.rowid as facid";
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity = ".$conf->entity;
@ -592,11 +592,13 @@ else
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Ref").'</td>';
print_liste_field_titre($langs->trans("Ref"));
print_liste_field_titre($langs->trans("Company"),$_SERVER['PHP_SELF'],"s.nom","","&socid=$socid","",$sortfiled,$sortorder);
print '</td><td align="right">'.$langs->trans("Amount").'</td>';
print '<td>&nbsp;</td>';
print "</td>\n";
print_liste_field_titre($langs->trans("AmountHT"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AmountVAT"),'','','','','align="right"');
print_liste_field_titre($langs->trans("AmountTTC"),'','','','','align="right"');
print_liste_field_titre(''); // Field may contains ling text
print "</tr>\n";
if ($num > 0)
{
@ -616,19 +618,21 @@ else
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
print '<td align="right">'.price($objp->total).'</td>'."\n";
print '<td align="right">'.price($objp->total_vat).'</td>'."\n";
print '<td align="right">'.price($objp->total_ttc).'</td>'."\n";
echo '<td align="center">';
print '<td align="center">';
if ($user->rights->facture->creer)
{
echo '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">';
echo $langs->trans("CreateBill"),'</a>';
print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">';
print $langs->trans("CreateBill").'</a>';
}
else
{
echo "&nbsp;";
print "&nbsp;";
}
echo "</td></tr>\n";
print "</td>";
print "</tr>\n";
$i++;
}
}

View File

@ -63,6 +63,7 @@ $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha');
$lineid=GETPOST('lineid','int');
$userid=GETPOST('userid','int');
$search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
$search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_societe=GETPOST('search_societe','alpha');
@ -121,6 +122,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_categ='';
$search_user='';
$search_sale='';
$search_product_category='';
$search_ref='';
$search_refcustomer='';
$search_societe='';
@ -144,8 +146,8 @@ $formfile = new FormFile($db);
$bankaccountstatic=new Account($db);
$facturestatic=new Facture($db);
if (! $sall) $sql = 'SELECT';
else $sql = 'SELECT DISTINCT';
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as facid, f.facnumber, f.ref_client, f.type, f.note_private, f.increment, f.total as total_ht, f.tva as total_tva, f.total_ttc,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,';
@ -155,6 +157,8 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s';
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid';
else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid';
if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture';
if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product';
// We'll need this table joined to the select in order to filter by sale
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if ($search_user > 0)
@ -165,7 +169,8 @@ if ($search_user > 0)
$sql.= ' WHERE f.fk_soc = s.rowid';
$sql.= " AND f.entity = ".$conf->entity;
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= ' AND s.rowid = '.$socid;
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if ($userid)
{
if ($userid == -1) $sql.=' AND f.fk_user_author IS NULL';
@ -180,30 +185,12 @@ if ($filtre)
$sql .= ' AND ' . trim($filt[0]) . ' = ' . trim($filt[1]);
}
}
if ($search_ref)
{
$sql .= natural_search('f.facnumber', $search_ref);
}
if ($search_refcustomer)
{
$sql .= natural_search('f.ref_client', $search_refcustomer);
}
if ($search_societe)
{
$sql .= natural_search('s.nom', $search_societe);
}
if ($search_montant_ht != '')
{
$sql.= natural_search('f.total', $search_montant_ht, 1);
}
if ($search_montant_ttc != '')
{
$sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
}
if ($search_status != '')
{
$sql.= " AND f.fk_statut = '".$db->escape($search_status)."'";
}
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '') $sql.= " AND f.fk_statut = '".$db->escape($search_status)."'";
if ($month > 0)
{
if ($year > 0 && empty($day))
@ -258,7 +245,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1,$offset);
//print $sql;
@ -294,20 +280,34 @@ if ($resql)
if ($user->rights->societe->client->voir || $socid)
{
$langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, 1, 'maxwidth300');
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
$moreforfilter.='</div>';
}
// If the user can view prospects other than his'
if ($conf->categorie->enabled && $user->rights->produit->lire)
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1);
$moreforfilter.='</div>';
}
if ($moreforfilter)
{
print '<tr class="liste_titre">';
print '<td class="liste_titre" colspan="10">';
print '<td class="liste_titre" colspan="11">';
print $moreforfilter;
print '</td></tr>';
}
@ -323,8 +323,8 @@ if ($resql)
print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','',$param,'align="right"',$sortfield,$sortorder);
//print '<td class="liste_titre">&nbsp;</td>';
print '</tr>';
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Filters lines
print '<tr class="liste_titre">';
@ -346,9 +346,13 @@ if ($resql)
print '</td>';
print '<td class="liste_titre" align="left"><input class="flat" type="text" size="8" name="search_societe" value="'.$search_societe.'"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
print '<td class="liste_titre" align="right">&nbsp;</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
print '<td class="liste_titre" align="right">&nbsp;</td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right">';
$liststatus=array('0'=>$langs->trans("Draft"), '1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid"), '3'=>$langs->trans("Cancel"));
print $form->selectarray('search_status', $liststatus, $search_status, 1);
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print "</td></tr>\n";
@ -440,7 +444,9 @@ if ($resql)
print '<td align="right" class="nowrap">';
print $facturestatic->LibStatut($objp->paye,$objp->fk_statut,5,$paiement,$objp->type);
print "</td>";
//print "<td>&nbsp;</td>";
print "<td></td>";
print "</tr>\n";
$total_ht+=$objp->total_ht;
$total_tva+=$objp->total_tva;
@ -458,7 +464,8 @@ if ($resql)
print '<td class="liste_total" align="right">'.price($total_tva,0,$langs).'</td>';
print '<td class="liste_total" align="right">'.price($total_ttc,0,$langs).'</td>';
print '<td class="liste_total" align="right">'.price($totalrecu,0,$langs).'</td>';
print '<td class="liste_total" align="center">&nbsp;</td>';
print '<td class="liste_total"></td>';
print '<td class="liste_total"></td>';
print '</tr>';
}
}

View File

@ -654,13 +654,16 @@ if ($resql)
print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Rest"),$_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder);
$searchpitco='<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
$searchpitco.='<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Reset"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
if (empty($mode))
{
print_liste_field_titre($langs->trans("PDFMerge"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($searchpitco,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
}
else
{
print_liste_field_titre($langs->trans("Remind"),$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($searchpitco,$_SERVER["PHP_SELF"],"","",$param,'align="center"',$sortfield,$sortorder);
}
print "</tr>\n";
@ -695,9 +698,6 @@ if ($resql)
print $form->selectarray('filtre', $liststatus, $filter, 1);
print '</td>';
print '<td class="liste_titre" align="center">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
print '<br>';
if (empty($mode))
{
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
*
@ -68,14 +68,19 @@ if ($action == "new")
{
if ($object->id > 0)
{
$result = $object->demande_prelevement($user);
$db->begin();
$result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount'));
if ($result > 0)
{
$db->commit();
setEventMessage($langs->trans("RecordSaved"));
}
else
{
setEventMessage($object->error, 'errors');
{
$db->rollback();
setEventMessage($object->error, $object->errors, 'errors');
}
}
$action='';
@ -309,7 +314,7 @@ if ($object->id > 0)
print '</td>';
print '</tr>';
// Conditions de reglement
// Payment condition
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
@ -370,11 +375,11 @@ if ($object->id > 0)
print '</td><td colspan="3">';
if ($action == 'editmode')
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id');
}
else
{
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none');
}
print '</td></tr>';
@ -478,7 +483,13 @@ if ($object->id > 0)
{
if ($user->rights->prelevement->bons->creer)
{
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=new">'.$langs->trans("MakeWithdrawRequest").'</a>';
print '<form method="POST" action="">';
print '<input type="hidden" name="id" value="' . $object->id . '" />';
print '<input type="hidden" name="action" value="new" />';
print '<label for="withdraw_request_amount">' . $langs->trans('WithdrawRequestAmount') . ' </label>';
print '<input type="text" id="withdraw_request_amount" name="withdraw_request_amount" value="' . $resteapayer . '" size="10" />';
print '<input type="submit" class="butAction" value="'.$langs->trans("MakeWithdrawRequest").'" />';
print '</form>';
}
else
{
@ -508,10 +519,12 @@ if ($object->id > 0)
print '<tr class="liste_titre">';
print '<td align="left">'.$langs->trans("DateRequest").'</td>';
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
print '<td align="center">'.$langs->trans("User").'</td>';
print '<td align="center">'.$langs->trans("Amount").'</td>';
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="center">'.$langs->trans("DateProcess").'</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$var=true;
@ -526,15 +539,18 @@ if ($object->id > 0)
print "<tr ".$bc[$var].">";
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td align="center">'.price($obj->amount).'</td>';
print '<td align="center">-</td>';
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td>&nbsp;</td>';
print '<td>';
print '<td align="center">'.$langs->trans("OrderWaiting").'</td>';
print '<td align="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete&amp;did='.$obj->rowid.'">';
print img_delete();
print '</a></td>';
print "</tr>\n";
$i++;
}
@ -574,7 +590,7 @@ if ($object->id > 0)
print '<td align="left">'.dol_print_date($db->jdate($obj->date_demande),'day')."</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td align="center">'.price($obj->amount).'</td>';
@ -585,9 +601,10 @@ if ($object->id > 0)
print $withdrawreceipt->getNomUrl(1);
print "</td>\n";
print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/card.php?id='.$obj->user_id.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.'</a></td>';
print '<td>&nbsp;</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_traite),'day')."</td>\n";
print '<td>&nbsp;</td>';
print "</tr>\n";

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
@ -109,15 +109,22 @@ if (! empty($conf->holiday->enabled))
{
$user_id = $user->id;
$nbaquis=$holiday->getCPforUser($user_id);
$nbdeduced=$holiday->getConfCP('nbHolidayDeducted');
$nb_holiday = $nbaquis / $nbdeduced;
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Holidays").'</td></tr>';
print "<tr ".$bc[0].">";
print '<td colspan="3">';
print $langs->trans('SoldeCPUser',round($nb_holiday,2)).($nbdeduced != 1 ? ' ('.$nbaquis.' / '.$nbdeduced.')' : '');
$out='';
$typeleaves=$holiday->getTypes(1,1);
foreach($typeleaves as $key => $val)
{
$nb_type = $holiday->getCPforUser($user->id, $val['rowid']);
$nb_holiday += $nb_type;
$out .= ' - '.$val['label'].': <strong>'.($nb_type?price2num($nb_type):0).'</strong><br>';
}
print $langs->trans('SoldeCPUser', round($nb_holiday,5)).'<br>';
print $out;
print '</td>';
print '</tr>';
print '</table><br>';
@ -196,7 +203,7 @@ if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
{
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE u.rowid = x.fk_user_author";
@ -231,8 +238,8 @@ if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire
while ($i < $num && $i < $max)
{
$obj = $db->fetch_object($result);
$expensereportstatic->ref=$obj->rowid;
$expensereportstatic->id=$obj->rowid;
$expensereportstatic->ref=$obj->ref;
$userstatic->id=$obj->uid;
$userstatic->lastname=$obj->lastname;
$userstatic->firstname=$obj->firstname;

View File

@ -151,7 +151,7 @@ if ($result)
if($obj->product_type == 0) $compta_prod = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)?$conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT:$langs->trans("CodeNotDef"));
else $compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)?$conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT:$langs->trans("CodeNotDef"));
}
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_ACCOUNT)?$conf->global->ACCOUNTING_VAT_ACCOUNT:$langs->trans("CodeNotDef"));
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)?$conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT:$langs->trans("CodeNotDef"));
$compta_tva = (! empty($obj->account_tva)?$obj->account_tva:$cpttva);
$account_localtax1=getLocalTaxesFromRate($obj->tva_tx, 1, $obj->thirdparty, $mysoc);

View File

@ -705,7 +705,7 @@ if (! GETPOST('action'))
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 '<td>&nbsp;</td>';
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
while ($i < min($num,$limit))
@ -728,6 +728,6 @@ if (! GETPOST('action'))
}
}
$db->close();
llxFooter();
$db->close();

View File

@ -88,7 +88,7 @@ if ($resql)
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 "<td>&nbsp;</td>";
print_liste_field_titre('');
print "</tr>\n";
while ($i < min($num,$limit))

View File

@ -221,7 +221,26 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c
}
else
{
setEventMessage($paiement->error, 'errors');
setEventMessage($object->error, 'errors');
}
}
if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->banque->cheque)
{
$reject_date = dol_mktime(0, 0, 0, GETPOST('rejectdate_month'), GETPOST('rejectdate_day'), GETPOST('rejectdate_year'));
$rejected_check = GETPOST('bankid');
$object->fetch($id);
$paiement_id = $object->reject_check($rejected_check, $reject_date);
if ($paiement_id > 0)
{
setEventMessage($langs->trans("CheckRejectedAndInvoicesReopened"));
header("Location: ".DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id);
exit;
}
else
{
setEventMessage($object->error, 'errors');
}
}
@ -334,6 +353,18 @@ else
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("ValidateCheckReceipt"), $langs->trans("ConfirmValidateCheckReceipt"), 'confirm_valide','','',1);
}
/*
* Confirm check rejection
*/
if ($action == 'reject_check')
{
$formquestion = array(
array('type' => 'hidden','name' => 'bankid','value' => GETPOST('lineid')),
array('type' => 'date','name' => 'rejectdate_','label' => $langs->trans("RejectCheckDate"),'value' => dol_now())
);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans("RejectCheck"), $langs->trans("ConfirmRejectCheck"), 'confirm_reject_check',$formquestion,'',1);
}
}
$accounts = array();
@ -350,20 +381,20 @@ if ($action == 'new')
print '<input type="hidden" name="action" value="new">';
dol_fiche_head();
print '<table class="border" width="100%">';
//print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>';
// Filter
print '<tr><td width="200">'.$langs->trans("DateChequeReceived").'</td><td>';
print $form->select_date($filterdate,'fd',0,0,1,'',1,1);
print $form->select_date($filterdate,'fd',0,0,1,'',1,1,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("BankAccount").'</td><td>';
$form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1);
print '</td></tr>';
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">';
if ($filterdate || $filteraccountid > 0)
@ -377,10 +408,9 @@ if ($action == 'new')
$sql = "SELECT ba.rowid as bid, b.datec as datec, b.dateo as date, b.rowid as chqid, ";
$sql.= " b.amount, ba.label, b.emetteur, b.num_chq, b.banque";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b,";
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON (b.fk_account = ba.rowid)";
$sql.= " WHERE b.fk_type = 'CHQ'";
$sql.= " AND b.fk_account = ba.rowid";
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
$sql.= " AND b.fk_bordereau = 0";
$sql.= " AND b.amount > 0";
@ -599,12 +629,11 @@ else
// Liste des cheques
$sql = "SELECT b.rowid, b.amount, b.num_chq, b.emetteur,";
$sql.= " b.dateo as date, b.datec as datec, b.banque,";
$sql.= " p.rowid as pid, ba.rowid as bid";
$sql.= " p.rowid as pid, ba.rowid as bid, p.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON (b.fk_account = ba.rowid)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement as p ON p.fk_bank = b.rowid";
$sql.= " WHERE ba.rowid = b.fk_account";
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
$sql.= " WHERE ba.entity IN (".getEntity('bank_account', 1).")";
$sql.= " AND b.fk_type= 'CHQ'";
$sql.= " AND b.fk_bordereau = ".$object->id;
$sql.= " ORDER BY $sortfield $sortorder";
@ -625,7 +654,8 @@ else
print_liste_field_titre($langs->trans("Bank"),$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('','','');
print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$i=1;
$var=false;
@ -654,13 +684,25 @@ else
print '&nbsp;';
}
print '</td>';
if ($object->statut == 0)
print '<td align="center">';
$paymentstatic->id=$objp->pid;
$paymentstatic->ref=$objp->pid;
if ($paymentstatic->id)
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a></td>';
print $paymentstatic->getNomUrl(1);
}
else
{
print '<td>&nbsp;</td>';
print '&nbsp;';
}
print '</td>';
if ($object->statut == 0)
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').'</a></td>';
}
else if($objp->statut == 2) {
print '<td align="right">'.img_picto($langs->trans('CheckRejected'),'statut8').'</a></td>';
}
print '</tr>';
$var=!$var;

View File

@ -25,6 +25,7 @@
* \brief File with class to manage cheque delivery receipts
*/
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
/**
@ -647,17 +648,83 @@ class RemiseCheque extends CommonObject
$resql = $this->db->query($sql);
if ($resql)
{
$this->updateAmount();
}
else
{
$this->errno = -1032;
dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)");
}
{
$this->updateAmount();
}
else
{
$this->errno = -1032;
dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)");
}
}
return 0;
}
/**
* Check rejection management
* Reopen linked invoices and saves a new negative payment
*
* @param int $bank_id Id of bank line concerned
* @param date $rejection_date Date to use on the negative payment
* @return int
*/
function reject_check($bank_id, $rejection_date)
{
global $db, $user;
$payment = new Paiement($db);
$payment->fetch(0,0,$bank_id);
$bankaccount = $payment->fk_account;
// Get invoice list to reopen them
$sql = 'SELECT pf.fk_facture, pf.amount';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf';
$sql.= ' WHERE pf.fk_paiement = '.$payment->id;
$resql=$db->query($sql);
if ($resql)
{
$rejectedPayment = new Paiement($db);
$rejectedPayment->amounts = array();
$rejectedPayment->datepaye = $rejection_date;
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement');
$rejectedPayment->num_paiement = $payment->numero;
while($obj = $db->fetch_object($resql))
{
$invoice = new Facture($db);
$invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user);
$rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1;
}
if ($rejectedPayment->create($user) > 0)
{
$result=$rejectedPayment->addPaymentToBank($user,'payment','(CheckRejected)',$bankaccount,'','');
if ($result > 0)
{
$payment->reject();
return $rejectedPayment->id;
}
else
{
return -1;
}
}
else
{
return -1;
}
}
else
{
$this->error=$this->db->error();
return -1;
}
}
/**
* Charge les proprietes ref_previous et ref_next
*
@ -747,7 +814,7 @@ class RemiseCheque extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET number = '".$number."'" ;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog("RemiseCheque::set_number", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)

View File

@ -78,11 +78,12 @@ class Paiement extends CommonObject
/**
* Load payment from database
*
* @param int $id Id of payment to get
* @param int $ref Ref of payment to get (same as $id)
* @return int <0 if KO, 0 if not found, >0 if OK
* @param int $id Id of payment to get
* @param string $ref Ref of payment to get (currently ref = id but this may change in future)
* @param int $fk_bank Id of bank line associated to payment
* @return int <0 if KO, 0 if not found, >0 if OK
*/
function fetch($id, $ref='')
function fetch($id, $ref='', $fk_bank='')
{
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
$sql.= ' c.code as type_code, c.libelle as type_libelle,';
@ -91,10 +92,12 @@ class Paiement extends CommonObject
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql.= ' WHERE p.fk_paiement = c.id';
if ($ref)
$sql.= ' AND p.rowid = '.$ref;
else
if ($id > 0)
$sql.= ' AND p.rowid = '.$id;
else if ($ref)
$sql.= ' AND p.rowid = '.$ref;
else if ($fk_bank)
$sql.= ' AND p.fk_bank = '.$fk_bank;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
@ -116,7 +119,8 @@ class Paiement extends CommonObject
$this->type_code = $obj->type_code;
$this->statut = $obj->statut;
$this->bank_account = $obj->fk_account;
$this->bank_account = $obj->fk_account; // deprecated
$this->fk_account = $obj->fk_account;
$this->bank_line = $obj->fk_bank;
$this->db->free($result);
@ -670,6 +674,29 @@ class Paiement extends CommonObject
}
}
/**
* Reject payment
*
* @return int <0 if KO, >0 if OK
*/
function reject()
{
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id;
dol_syslog(get_class($this).'::reject', LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
return 1;
}
else
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::reject '.$this->error);
return -1;
}
}
/*
* \brief Information sur l'objet
* \param id id du paiement dont il faut afficher les infos

View File

@ -68,6 +68,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_company="";
}
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('paymentlist'));
$extrafields = new ExtraFields($db);
/*
* View
*/
@ -81,24 +87,37 @@ if (GETPOST("orphelins"))
// Paiements lies a aucune facture (pour aide au diagnostic)
$sql = "SELECT p.rowid, p.datep as dp, p.amount,";
$sql.= " p.statut, p.num_paiement,";
//$sql.= " c.libelle as paiement_type";
$sql.= " c.code as paiement_code";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM (".MAIN_DB_PREFIX."paiement as p,";
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
$sql.= " WHERE p.fk_paiement = c.id";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND pf.fk_facture IS NULL";
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
}
else
{
$sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql.= " p.statut, p.num_paiement,";
//$sql.= " c.libelle as paiement_type,";
$sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.label,";
$sql.= " s.rowid as socid, s.nom as name";
//$sql.= " f.facnumber";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
$sql.= " FROM (".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement as p)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid";
@ -127,6 +146,10 @@ else
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'";
if ($search_company) $sql .= natural_search('s.nom', $search_company);
// Add where from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
$sql.=$hookmanager->resPrint;
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@ -157,11 +180,13 @@ if ($resql)
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$paramlist,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"p.amount","",$paramlist,'align="right"',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("Invoices"),"","","",$paramlist,'align="left"',$sortfield,$sortorder);
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
}
print '<td class="liste_titre">&nbsp;</td>';
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$paramlist,'align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
// Lines for filters fields
@ -199,7 +224,7 @@ if ($resql)
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td width="40">';
print '<td>';
$paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->rowid;
print $paymentstatic->getNomUrl(1);

View File

@ -176,6 +176,8 @@ if ($_GET["action"] == 'create')
print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head('', '');
print '<table cellspacing="0" class="border" width="100%" cellpadding="2">';
print "<tr class=\"liste_titre\"><td colspan=\"3\">".$langs->trans("SocialContribution")."</td>";
@ -235,7 +237,7 @@ if ($_GET["action"] == 'create')
print '</table>';
print '<br>';
dol_fiche_end();
/*
* Autres charges impayees

View File

@ -55,7 +55,7 @@ $pagenext = $page + 1;
/*
* Mode Liste
* Mode List
*
*/
$sql = "SELECT p.rowid, p.ref, p.amount, p.statut";
@ -75,17 +75,16 @@ if ($result)
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("WithdrawalsReceipts"),$_SERVER["PHP_SELF"],"p.ref",'','','class="liste_titre"');
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"p.datec","","",'class="liste_titre" align="center"');
print '<td class="liste_titre" align="right">'.$langs->trans("Amount").'</td>';
print '</tr>';
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"","","",'align="center"');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="bons.php" method="GET">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="GET">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_ligne" value="'. $search_line.'" size="10"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><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")).'"></td>';
@ -121,7 +120,7 @@ else
dol_print_error($db);
}
$db->close();
llxFooter();
$db->close();

View File

@ -25,6 +25,7 @@
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
@ -45,6 +46,11 @@ if ($user->societe_id > 0) accessforbidden();
$action = GETPOST('action','alpha');
$id = GETPOST('id','int');
$socid = GETPOST('socid','int');
$page = GETPOST('page','int');
$sortorder = ((GETPOST('sortorder','alpha')=="")) ? "DESC" : GETPOST('sortorder','alpha');
$sortfield = ((GETPOST('sortfield','alpha')=="")) ? "pl.fk_soc" : GETPOST('sortfield','alpha');
/*
* Actions
@ -207,10 +213,10 @@ if ($id > 0)
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyTransmision").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransData").'</td><td>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransData").'</td><td>';
print $form->select_date('','','','','',"userfile",1,1);
print '</td></tr>';
print '<tr><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans("TransMetod").'</td><td>';
print $form->selectarray("methode",$bon->methodes_trans);
print '</td></tr>';
/* print '<tr><td width="20%">'.$langs->trans("File").'</td><td>';
@ -230,7 +236,7 @@ if ($id > 0)
print '<table class="border" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("NotifyCredit").'</td></tr>';
print '<tr><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print '<tr '.$bc[false].'><td width="20%">'.$langs->trans('CreditDate').'</td><td>';
print $form->select_date('','','','','',"infocredit",1,1);
print '</td></tr>';
print '</table>';
@ -259,6 +265,122 @@ if ($id > 0)
print "</div>";
}
$ligne=new LignePrelevement($db,$user);
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* Lines into withdraw request
*/
$sql = "SELECT pl.rowid, pl.statut, pl.amount";
$sql.= ", s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_bons as pb";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE pl.fk_prelevement_bons = ".$id;
$sql.= " AND pl.fk_prelevement_bons = pb.rowid";
$sql.= " AND pb.entity = ".$conf->entity;
$sql.= " AND pl.fk_soc = s.rowid";
if ($socid) $sql.= " AND s.rowid = ".$socid;
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$urladd = "&amp;id=".$prev_id;
print_barre_liste("", $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num);
print"\n<!-- debut table -->\n";
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Lines"),$_SERVER["PHP_SELF"],"pl.rowid",'',$urladd);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"pl.amount","",$urladd,'align="center"');
print_liste_field_titre('');
print "</tr>\n";
$var=false;
$total = 0;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($result);
print "<tr ".$bc[$var].">";
print "<td>";
print $ligne->LibStatut($obj->statut,2);
print "&nbsp;";
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
print substr('000000'.$obj->rowid, -6);
print '</a></td>';
$thirdparty=new Societe($db);
$thirdparty->fetch($obj->socid);
print '<td>';
print $thirdparty->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.price($obj->amount)."</td>\n";
print '<td>';
if ($obj->statut == 3)
{
print '<b>'.$langs->trans("StatusRefused").'</b>';
}
else
{
print "&nbsp;";
}
print '</td></tr>';
$total += $obj->total_ttc;
$var=!$var;
$i++;
}
if($socid)
{
print "<tr ".$bc[$var].">";
print '<td>'.$langs->trans("Total").'</td>';
print '<td align="center">'.price($total)."</td>\n";
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
}
print "</table>";
$db->free($result);
}
else
{
dol_print_error($db);
}
}

View File

@ -446,8 +446,17 @@ class BonPrelevement extends CommonObject
$fac = new Facture($this->db);
$fac->fetch($facs[$i][0]);
$amounts[$fac->id] = $facs[$i][1];
$result = $fac->set_paid($user);
$totalpaye = $fac->getSommePaiement();
$totalcreditnotes = $fac->getSumCreditNotesUsed();
$totaldeposits = $fac->getSumDepositsUsed();
$alreadypayed = $totalpaye + $totalcreditnotes + $totaldeposits;
if ($alreadypayed + $facs[$i][1] >= $fac->total_ttc) {
$result = $fac->set_paid($user);
}
}
$paiement = new Paiement($this->db);
$paiement->datepaye = $date ;
$paiement->amounts = $amounts;
@ -651,7 +660,7 @@ class BonPrelevement extends CommonObject
{
global $conf;
$sql = "SELECT sum(f.total_ttc) as nb";
$sql = "SELECT sum(pfd.amount) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
//$sql.= " ,".MAIN_DB_PREFIX."c_paiement as cp";
@ -837,7 +846,7 @@ class BonPrelevement extends CommonObject
else
{
dol_syslog(__METHOD__."::Check RIB Error on default bank number RIB/IBAN for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_ERR);
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->name;
$this->invoice_in_error[$fac[0]]="Error on default bank number RIB/IBAN for invoice ".$fact->getNomUrl(0)." for thirdparty (reported by function verif) ".$soc->getNomUrl(0);
}
}
else
@ -924,6 +933,7 @@ class BonPrelevement extends CommonObject
if ($resql)
{
$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
$this->id = $prev_id;
$dir=$conf->prelevement->dir_output.'/receipts';
$file=$filebonprev;
@ -981,6 +991,7 @@ class BonPrelevement extends CommonObject
dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql)
{
$error++;
@ -1210,7 +1221,7 @@ class BonPrelevement extends CommonObject
/**
* Generate a withdrawal file.
* Generation Formats:
* - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled)
* - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled)
* - Others countries: Warning message
* File is generated with name this->filename
*
@ -1226,6 +1237,11 @@ class BonPrelevement extends CommonObject
dol_syslog(get_class($this)."::generate build file ".$this->filename);
$this->file = fopen($this->filename,"w");
if (empty($this->file))
{
$this->error=$langs->trans('ErrorFailedToOpenFile', $this->filename);
return -1;
}
$found=0;
@ -1287,7 +1303,8 @@ class BonPrelevement extends CommonObject
//echo $sql;
$resql=$this->db->query($sql);
if ($resql)
{ $num = $this->db->num_rows($resql);
{
$num = $this->db->num_rows($resql);
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
@ -1297,7 +1314,8 @@ class BonPrelevement extends CommonObject
}
}
else
{ fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
{
fputs($this->file, 'ERREUR DEBITEUR '.$sql.$CrLf);
$result = -2;
}
@ -1305,10 +1323,12 @@ class BonPrelevement extends CommonObject
* section Emetteur(sepa Emetteur bloc lines)
*/
if ($result != -2)
{ $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
{
$fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $i, $this->total, $CrLf);
}
else
{ fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
{
fputs($this->file, 'ERREUR EMETTEUR'.$CrLf);
}
/**
@ -1503,7 +1523,7 @@ class BonPrelevement extends CommonObject
*/
static function buildRumNumber($row_code_client, $row_datec, $row_drum)
{
$pre = ($row_datec > 1359673200) ? 'Rum' : '++R';
$pre = ($row_datec > 1359673200) ? 'RUM-' : '++R';
return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec);
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2012 Juanjo Menent <jmenent@2byte.es>
*
@ -96,13 +96,19 @@ if (prelevement_check_config() < 0)
print '</div>';
}
$h=0;
/*$h=0;
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/create.php';
$head[$h][1] = $langs->trans("NewStandingOrder");
$head[$h][2] = 'payment';
$hselected = 'payment';
$h++;
dol_fiche_head($head, $hselected, $langs->trans("StandingOrders"), 0, 'payment');
*/
print_fiche_titre($langs->trans("NewStandingOrder"));
dol_fiche_head();
$nb=$bprev->NbFactureAPrelever();
$nb1=$bprev->NbFactureAPrelever(1);
@ -161,7 +167,7 @@ print '<br>';
*/
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande";
$sql.= " pfd.date_demande, pfd.amount";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
$sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
@ -184,6 +190,7 @@ if ($resql)
print '<td>'.$langs->trans("Invoice").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>';
print '<td>'.$langs->trans("RIB").'</td>';
print '<td>'.$langs->trans("RUM").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("DateRequest").'</td>';
print '</tr>';
@ -210,9 +217,13 @@ if ($resql)
print '<td>';
print $thirdpartystatic->display_rib();
print '</td>';
// RUM
print '<td>';
print $thirdpartystatic->display_rib('rum');
print '</td>';
// Amount
print '<td align="right">';
print price($obj->total_ttc,0,$langs,0,0,-1,$conf->currency);
print price($obj->amount,0,$langs,0,0,-1,$conf->currency);
print '</td>';
// Date
print '<td align="right">';
@ -265,11 +276,14 @@ if ($result)
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var]."><td>";
print "<tr ".$bc[$var].">";
print "<td>";
$bprev->id=$obj->rowid;
$bprev->ref=$obj->ref;
print $bprev->getNomUrl(1);
print "</td>\n";
print '<td align="center">'.dol_print_date($db->jdate($obj->datec),'day')."</td>\n";
print '<td align="right">'.price($obj->amount,0,$langs,0,0,-1,$conf->currency)."</td>\n";

View File

@ -147,7 +147,9 @@ if ($result)
print_liste_field_titre($langs->trans("Bill"),$_SERVER["PHP_SELF"],"p.ref",'',$urladd,'class="liste_titre"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",'',$urladd,'class="liste_titre"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"f.total_ttc","",$urladd,'class="liste_titre" align="center"',$sortfield,$sortorder);
print '<td class="liste_titre" colspan="2">&nbsp;</td></tr>';
print_liste_field_titre('');
print_liste_field_titre('');
print "</tr>\n";
$var=false;

View File

@ -96,7 +96,7 @@ print '</td></tr></table><br>';
* Invoices waiting for withdraw
*/
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql.= " pfd.date_demande,";
$sql.= " pfd.date_demande, pfd.amount,";
$sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
@ -143,7 +143,7 @@ if ($resql)
print '</td>';
print '<td align="right">';
print price($obj->total_ttc);
print price($obj->amount);
print '</td>';
print '<td align="right">';

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