Merge branch 'develop' into develop_advtargetemailiing
Conflicts: htdocs/install/mysql/migration/3.9.0-4.0.0.sql htdocs/install/mysql/tables/llx_c_accounting_category.sql
@ -14,7 +14,7 @@ Component Version License GPL Compatible
|
||||
PHP libraries:
|
||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
ChromePHP 4.1.0 Apache Software License 2.0 Yes Return server log to chrome browser console
|
||||
CKEditor 4.5.6 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
CKEditor 4.5.8 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||
Escpos-php MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||
FPDI 1.5.2 Apache Software License 2.0 Yes PDF templates management
|
||||
@ -30,6 +30,7 @@ PHPPrintIPP 1.3 GPL-2+ Yes
|
||||
Restler 3.0 LGPL-3+ Yes Library to develop REST Web services
|
||||
TCPDF 6.2.12 LGPL-3+ Yes PDF generation
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
|
||||
|
||||
JS libraries:
|
||||
jQuery 1.11.3 MIT License Yes JS library
|
||||
@ -61,6 +62,8 @@ http://www.gnu.org/licenses/licenses.en.html
|
||||
Copyright
|
||||
---------
|
||||
|
||||
Copyright (C) 2016
|
||||
|
||||
Copyright (C) 2015
|
||||
- Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
- Marcos García <marcosgdf@gmail.com>
|
||||
|
||||
91
ChangeLog
@ -6,8 +6,8 @@ WARNING:
|
||||
|
||||
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
|
||||
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
|
||||
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection"
|
||||
during migration.
|
||||
You may also experience troubles with Mysql 5.5.41/42/43 with error "Lost connection" during
|
||||
migration.
|
||||
Upgrading to any other version or any other database system is abolutely required BEFORE trying
|
||||
make a Dolibarr upgrade.
|
||||
|
||||
@ -24,9 +24,80 @@ Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expect
|
||||
|
||||
Following changes may create regression for some external modules, but were necessary to make
|
||||
Dolibarr better:
|
||||
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
|
||||
- Class Resource was renamed into DolResource to avoid conflict with a reserved PHP word.
|
||||
- Method commonobject->add_thumb() has been renamed into commonobject->addThumbs().
|
||||
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
|
||||
- Property ->client that was deprecated 6 years ago, is replaced in all core code with ->thirdparty.
|
||||
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
|
||||
So if you included it into your module, change your code like this to be compatible with all version:
|
||||
$res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
if (! $res) include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||
|
||||
|
||||
***** ChangeLog for 3.9.1 compared to 3.9.* *****
|
||||
FIX: #3815 Call to undefined function local_by_date()
|
||||
FIX: #4424 Missing email of user popup in supplier orders area
|
||||
FIX: #4442 Missing translation in Banks menu
|
||||
FIX: #4737 Bank transacion type selector translation is cropped
|
||||
FIX: #4742 Able to delete a supplier invoice with a registered payment
|
||||
FIX: #4743 UI glitch in project summary page
|
||||
FIX: #4747 Missing UI background when registering a supplier invoice payment
|
||||
FIX: #4748 Supplier invoice payment confirmation amount is not translated
|
||||
FIX: #4766 VAT not shown in supplier invoice popup
|
||||
FIX: #4784
|
||||
FIX: #4809 Duplicate functions with different content
|
||||
FIX: #4812
|
||||
FIX: #4839
|
||||
FIX: #4851 Project selector in supplier invoices shows the project label twice
|
||||
FIX: #4870
|
||||
FIX: #4874 SQL error when listing users
|
||||
FIX: #4880
|
||||
FIX: #4961
|
||||
FIX: #4989
|
||||
FIX: If oauth has never been activated two tables are missing and printing is not working
|
||||
FIX: A not enabled field for list must not into fields to add
|
||||
FIX: Bad color of message password changed
|
||||
FIX: Bad error and style message when changing its own login
|
||||
FIX: Bad function name call on delete
|
||||
FIX: Bad include and param for project numbering module call
|
||||
FIX: bad translation language loaded FIX: When changing thirdparty on event card, the showempty option of contact was lost. FIX: Bad placeholder shown on combo to select a thirdparty.
|
||||
FIX: Bad vat definition when using POS module
|
||||
FIX: Box disabled because bugged
|
||||
FIX: Can not select a commercial on the creation of a third
|
||||
FIX: Check of EAN13 barcode when mask was set to use 13 digits instead of 12
|
||||
FIX: correct display of minimum buying price
|
||||
FIX: Creation of thumb image for size "small" was not done.
|
||||
FIX: Damn, where was the project ref ?
|
||||
FIX: Default vat is not set correctly when an error occured and we use VAT identified by a code.
|
||||
FIX: dont retrieve new buying price on margin display
|
||||
FIX: Duplicate records into export
|
||||
FIX: Each time we edit a line, we loose the unit price.
|
||||
FIX: Email templates not compatible with Multicompany
|
||||
FIX: Export must use a left join to not loose lines
|
||||
FIX: fetchAllEMailTemplate
|
||||
FIX: Filter/search on extrafields on lists
|
||||
FIX: finished parameters not used
|
||||
FIX: Generated thumbs must always use the png format so using thumbs can work.
|
||||
FIX: Hook resprint be printed
|
||||
FIX: image extension must be in lower case
|
||||
FIX: Missing clean of criteria
|
||||
FIX: Missing database escaping on supplier price insert/update
|
||||
FIX: Missing function
|
||||
FIX: Multiprice generator didn't recalculate prices if only the price_base_type property changes
|
||||
FIX: Not removing code into vatrate.
|
||||
FIX: Not showing sellprice properly on product list
|
||||
FIX: Parsing of amount to pay vat
|
||||
FIX: PHPCS
|
||||
FIX: PMP is deprecated at warehouse level
|
||||
FIX: real min buying price
|
||||
FIX: Same term to create than other objects
|
||||
FIX: Some records were lost into margin per product report
|
||||
FIX: systematic rounding causes prices to be updated without reason
|
||||
FIX: Template email must take care of positino column
|
||||
FIX: VAT rate can be negative. Example spain selling to morroco.
|
||||
FIX: When cloning an order the order result from clone must be now
|
||||
FIX: When using option Price per level, when adding a predefined product, the vat for customer was not correctly set.
|
||||
|
||||
***** ChangeLog for 3.9.0 compared to 3.8.* *****
|
||||
For users:
|
||||
@ -1061,6 +1132,11 @@ Dolibarr better:
|
||||
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 3.6.7 compared to 3.6.6 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: CVE CVE-2015-8685
|
||||
|
||||
***** ChangeLog for 3.6.6 compared to 3.6.5 *****
|
||||
FIX: #3734 Do not show empty links of deleted source objects in stock movement list
|
||||
FIX: #4081 Added missing translation
|
||||
@ -1313,6 +1389,17 @@ removed. You must now use the 6 parameters way. See file modMyModule.class.php f
|
||||
- Remove add_photo_web() that is not used anymore by core code.
|
||||
|
||||
|
||||
***** ChangeLog for 3.5.8 compared to 3.5.7 *****
|
||||
FIX: #4291 Correctly filter external calendar GETPOSTs
|
||||
FIX: bad calculation for stock value
|
||||
FIX: bad stock valo
|
||||
FIX: change order date on clone (as everywhere else)
|
||||
FIX: CVE CVE-2015-8685
|
||||
FIX: The hours of date filter aren't correct
|
||||
FIX: #3442 Remove useless syslog
|
||||
FIX: #3448 Pass expected date format
|
||||
FIX: #3471 3.5 Rounding issue when dispatching non-integer
|
||||
|
||||
***** ChangeLog for 3.5.7 compared to 3.5.6 *****
|
||||
Fix: Paypal link were broken due to SSL v3 closed.
|
||||
Fix: [ bug #1769 ] Error when installing to a PostgreSQL DB that contains numbers
|
||||
|
||||
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
@ -379,7 +379,7 @@ if ($nboftargetok) {
|
||||
|
||||
print 'Run git tag -a -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n";
|
||||
$ret=`git tag -a -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD" 2>&1`;
|
||||
if ($ret =~ /already exists/)
|
||||
if ($ret =~ /(already exists|existe déjà)/)
|
||||
{
|
||||
print "WARNING: Tag ".$MAJOR.'.'.$MINOR.'.'.$BUILD." already exists. Overwrite (y/N) ? ";
|
||||
$QUESTIONOVERWRITETAG=<STDIN>;
|
||||
|
||||
1141
composer.lock
generated
@ -10,6 +10,16 @@ Replace "& new" by "new"
|
||||
|
||||
|
||||
|
||||
CKEDITOR:
|
||||
---------
|
||||
* In ckeditor/ckeditor/contents.css
|
||||
Replace:
|
||||
margin: 20px;
|
||||
With
|
||||
margin: 5px;
|
||||
|
||||
|
||||
|
||||
NUSOAP:
|
||||
-------
|
||||
* In file nusoap.php, to avoid a warning,
|
||||
@ -38,15 +48,16 @@ with:
|
||||
}
|
||||
|
||||
|
||||
|
||||
TCPDF:
|
||||
------
|
||||
* Removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
|
||||
helvetica* (all other languages),
|
||||
zapfdingbats.php (for special chars like form checkboxes)
|
||||
* To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
* Removed useless directories (examples, tools)
|
||||
|
||||
* Fix
|
||||
// initialize subsetchars
|
||||
$subsetchars = array();
|
||||
@ -54,19 +65,18 @@ into
|
||||
// initialize subsetchars
|
||||
$subsetchars = array_fill(0, 256, true);
|
||||
|
||||
* Made freemono the default monotype font because we removed courier
|
||||
* Optionnaly, removed all fonts except
|
||||
dejavusans* (used by greek, arab, persan, romanian, turkish),
|
||||
freemono* (russian),
|
||||
cid*+msungstdlight+stsongstdlight+uni2cid* (chinese),
|
||||
helvetica* (all other languages),
|
||||
zapfdingbats.php (for special chars like form checkboxes)
|
||||
|
||||
* Optionnaly, made freemono the default monotype font because we removed courier
|
||||
In htdocs/includes/tcpdf/tcpdf.php
|
||||
- protected $default_monospaced_font = 'courier';
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
||||
* Renamed getmypid into dol_getmypid().
|
||||
|
||||
|
||||
To avoid to have QRcode changed because generated with a random mask, replace
|
||||
define('QR_FIND_FROM_RANDOM', 2);
|
||||
with
|
||||
define('QR_FIND_FROM_RANDOM', false);
|
||||
|
||||
|
||||
|
||||
TCPDI:
|
||||
@ -81,7 +91,6 @@ require_once(dirname(__FILE__).'/../tecnickcom/tcpdf/include/tcpdf_filters.php')
|
||||
|
||||
|
||||
|
||||
|
||||
JSGANTT:
|
||||
--------
|
||||
* Replace in function JSGantt.taskLink
|
||||
|
||||
@ -17,16 +17,16 @@ fi
|
||||
# To detec
|
||||
if [ "x$1" = "xlist" ]
|
||||
then
|
||||
find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF
|
||||
# find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep -v 'htdocs\/includes' | grep CRLF
|
||||
fi
|
||||
|
||||
# To convert
|
||||
if [ "x$1" = "xfix" ]
|
||||
then
|
||||
for fic in `find . \( -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
for fic in `find . \( -iname "functions" -o -iname "*.md" -o -iname "*.html" -o -iname "*.htm" -o -iname "*.php" -o -iname "*.sh" -o -iname "*.cml" -o -iname "*.css" -o -iname "*.js" -o -iname "*.lang" -o -iname "*.pl" -o -iname "*.txt" -o -iname "*.xml" \) -exec file "{}" + | grep CRLF | awk -F':' '{ print $1 }' `
|
||||
do
|
||||
echo "Fix file $fic"
|
||||
dos2unix $fic
|
||||
dos2unix "$fic"
|
||||
done;
|
||||
fi
|
||||
|
||||
@ -71,7 +71,6 @@ class Skeleton_Class extends CommonObject
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -249,7 +248,7 @@ class Skeleton_Class extends CommonObject
|
||||
$line->prop1 = $obj->field1;
|
||||
$line->prop2 = $obj->field2;
|
||||
|
||||
$this->lines[] = $line;
|
||||
$this->lines[$line->id] = $line;
|
||||
//...
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -43,7 +43,9 @@ if (! $res && file_exists("../../../dolibarr/htdocs/main.inc.php")) $res=@includ
|
||||
if (! $res && file_exists("../../../../dolibarr/htdocs/main.inc.php")) $res=@include '../../../../dolibarr/htdocs/main.inc.php'; // Used on dev env only
|
||||
if (! $res) die("Include of main fails");
|
||||
// Change this following line to use the correct relative path from htdocs
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
dol_include_once('/mymodule/class/skeleton_class.class.php');
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
@ -124,6 +126,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Put here all code to do according to value of "action" parameter
|
||||
********************************************************************/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -142,6 +147,19 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Action to delete
|
||||
if ($action == 'confirm_delete')
|
||||
{
|
||||
@ -217,7 +235,7 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
@ -266,6 +284,7 @@ if ($resql)
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
@ -297,8 +316,8 @@ if ($resql)
|
||||
|
||||
// Fields title
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($langs->trans('field1'),$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($langs->trans('field2'),$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.field1']['checked'])) print_liste_field_titre($arrayfields['t.field1']['label'],$_SERVER['PHP_SELF'],'t.field1','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.field2']['checked'])) print_liste_field_titre($arrayfields['t.field2']['label'],$_SERVER['PHP_SELF'],'t.field2','',$param,'',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -315,8 +334,8 @@ if ($resql)
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.datec']['checked'])) print_liste_field_titre($arrayfields['t.datec']['label'],$_SERVER["PHP_SELF"],"t.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'],$_SERVER["PHP_SELF"],"t.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['t.status']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"t.status","",$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print '</tr>'."\n";
|
||||
@ -335,12 +354,15 @@ if ($resql)
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
print '<input class="flat" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@ -376,7 +398,9 @@ if ($resql)
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$i = 0;
|
||||
$i=0;
|
||||
$var=true;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -384,8 +408,16 @@ if ($resql)
|
||||
{
|
||||
// You can use here results
|
||||
print '<tr>';
|
||||
if (! empty($arrayfields['t.field1']['checked'])) print '<td>'.$obj->field1.'</td>';
|
||||
if (! empty($arrayfields['t.field2']['checked'])) print '<td>'.$obj->field2.'</td>';
|
||||
if (! empty($arrayfields['t.field1']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->field1.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['t.field2']['checked']))
|
||||
{
|
||||
print '<td>'.$obj->field2.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -400,6 +432,7 @@ if ($resql)
|
||||
$tmpkey='options_'.$key;
|
||||
print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -413,6 +446,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date modification
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
@ -420,6 +454,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Status
|
||||
/*
|
||||
@ -428,9 +463,12 @@ if ($resql)
|
||||
$userstatic->statut=$obj->statut;
|
||||
print '<td align="center">'.$userstatic->getLibStatut(3).'</td>';
|
||||
}*/
|
||||
|
||||
// Action column
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 251 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 96 KiB |
@ -43,7 +43,9 @@ $search_pcgtype = GETPOST("search_pcgtype");
|
||||
$search_pcgsubtype = GETPOST("search_pcgsubtype");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin)
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->chartofaccount)
|
||||
accessforbidden();
|
||||
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -145,8 +147,8 @@ if ($result) {
|
||||
print '<br/>';
|
||||
|
||||
print '<a class="butAction" href="./card.php?action=create">' . $langs->trans("Addanaccount") . '</a>';
|
||||
print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
// print '<a class="butAction" href="./importaccounts.php">' . $langs->trans("ImportAccount") . '</a>';
|
||||
// print '<a class="butAction" href="./productaccount.php">' . $langs->trans("CheckProductAccountancyCode") . '</a>';
|
||||
print '<br/><br/>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -216,12 +216,8 @@ if ($action == 'create') {
|
||||
$head = accounting_prepare_head($object);
|
||||
|
||||
// Edit mode
|
||||
if ($action == 'update') {
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid) {
|
||||
$soc->fetch($object->socid);
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
{
|
||||
dol_fiche_head($head, 'card', $langs->trans('AccountAccounting'), 0, 'billr');
|
||||
|
||||
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/export.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \file htdocs/accountancy/admin/export.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -50,12 +50,14 @@ $main_option = array (
|
||||
|
||||
$model_option = array (
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||
'ACCOUNTING_EXPORT_DATE',
|
||||
'ACCOUNTING_EXPORT_DATE'
|
||||
/*
|
||||
'ACCOUNTING_EXPORT_PIECE',
|
||||
'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
|
||||
'ACCOUNTING_EXPORT_LABEL',
|
||||
'ACCOUNTING_EXPORT_AMOUNT',
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
'ACCOUNTING_EXPORT_DEVISE'
|
||||
*/
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/importaccounts.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page import accounting account
|
||||
* \file htdocs/accountancy/admin/importaccounts.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page import accounting account
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
@ -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 <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@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>
|
||||
@ -23,9 +23,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \file htdocs/accountancy/admin/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -38,6 +38,7 @@ $langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("admin");
|
||||
$langs->load("accountancy");
|
||||
$langs->load("salaries");
|
||||
|
||||
// Security check
|
||||
if (! $user->admin)
|
||||
@ -45,7 +46,7 @@ if (! $user->admin)
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
// Other parameters ACCOUNTING_*
|
||||
// Parameters ACCOUNTING_* and others
|
||||
$list = array (
|
||||
'ACCOUNTING_LIMIT_LIST_VENTILATION',
|
||||
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
|
||||
@ -63,8 +64,11 @@ $list_account = array (
|
||||
'ACCOUNTING_SERVICE_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_VAT_BUY_ACCOUNT',
|
||||
'ACCOUNTING_VAT_SOLD_ACCOUNT',
|
||||
'ACCOUNTING_VAT_PAY_ACCOUNT',
|
||||
'ACCOUNTING_ACCOUNT_SUSPENSE',
|
||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH'
|
||||
'ACCOUNTING_ACCOUNT_TRANSFER_CASH',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'DONATION_ACCOUNTINGACCOUNT'
|
||||
);
|
||||
|
||||
/*
|
||||
|
||||
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/journal.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Setup page to configure accounting expert module
|
||||
* \file htdocs/accountancy/admin/journal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Setup page to configure accounting expert module
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief To define accounting account on product / service
|
||||
* \file htdocs/accountancy/admin/productaccount.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief To define accounting account on product / service
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -184,7 +184,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Accounts"));
|
||||
llxHeader('', $langs->trans("InitAccountancy"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
@ -241,7 +241,7 @@ if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print_barre_liste($langs->trans("ProductAccountingAccountSelect"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
print_barre_liste($langs->trans("ModulesSystemTools"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("InitAccountancyDesc") . '<br>';
|
||||
@ -263,9 +263,9 @@ if ($result) {
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print '<br /><div align="right"><input type="submit" class="button" value="' . $langs->trans('Modify') . '" name="changetype"></div>';
|
||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
print "<br><br>\n";
|
||||
|
||||
if (! empty($msg)) {
|
||||
print $msg;
|
||||
|
||||
@ -166,7 +166,7 @@ else {
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "t.label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Balance by month
|
||||
* \file htdocs/accountancy/bookkeeping/balancebymonth.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Balance by month
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
@ -333,7 +333,7 @@ if ($action == 'create') {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
|
||||
print_liste_field_titre($langs->trans("Numerocompte"));
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"));
|
||||
print_liste_field_titre($langs->trans("Code_tiers"));
|
||||
print_liste_field_titre($langs->trans("Labelcompte"));
|
||||
print_liste_field_titre($langs->trans("Debit"), "", "", "", "", 'align="center"');
|
||||
|
||||
@ -380,12 +380,12 @@ else {
|
||||
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Numerocompte"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Labelcompte"), $_SERVER['PHP_SELF'], "bk_label_compte", "", $options, "", $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Debit"), $_SERVER['PHP_SELF'], "t.debit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Credit"), $_SERVER['PHP_SELF'], "t.credit", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
@ -396,7 +396,7 @@ else {
|
||||
print $langs->trans('From') . ': ';
|
||||
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
|
||||
print '<br>';
|
||||
print $langs->trans('To') . ': ';
|
||||
print $langs->trans('to') . ': ';
|
||||
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
|
||||
print '</td>';
|
||||
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
|
||||
@ -404,14 +404,14 @@ else {
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
|
||||
print '<br>';
|
||||
print $langs->trans('To');
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $langs->trans('From');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
|
||||
print '<br>';
|
||||
print $langs->trans('To');
|
||||
print $langs->trans('to');
|
||||
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
|
||||
print '</td>';
|
||||
|
||||
@ -450,7 +450,7 @@ else {
|
||||
print '<td>' . $line->label_compte . '</td>';
|
||||
print '<td align="right">' . price($line->debit) . '</td>';
|
||||
print '<td align="right">' . price($line->credit) . '</td>';
|
||||
print '<td align="right">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">' . $line->code_journal . '</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a> ';
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $options . '&page=' . $page . '">' . img_delete() . '</a>';
|
||||
|
||||
386
htdocs/accountancy/class/accountancycategory.class.php
Normal file
@ -0,0 +1,386 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancycategory.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage categories of an accounting account_category
|
||||
*/
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
/**
|
||||
* Class to manage categories of an accounting account
|
||||
*/
|
||||
class AccountancyCategory
|
||||
{
|
||||
private $db;
|
||||
public $error;
|
||||
public $errors = array();
|
||||
//public $element='accounting_category';
|
||||
//public $table_element='c_accounting_category';
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select all accounting accounts from an accounting category
|
||||
*
|
||||
* @param int $id Id
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function display($id)
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql.= " WHERE t.fk_accounting_category = " . $id;
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj[$i] = $this->db->fetch_object($resql);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
|
||||
return $obj;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to select accountiing category of an accounting account present in chart of accounts
|
||||
*
|
||||
* @param int $id Id category
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function getCptBK($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT t.numero_compte, t.label_compte, t.doc_ref";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||
$sql.= " WHERE t.numero_compte NOT IN (";
|
||||
$sql.= " SELECT t.account_number";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
|
||||
$sql.= " WHERE t.fk_accounting_category = " . $id .")";
|
||||
$sql.= " AND t.numero_compte IN (";
|
||||
$sql.= " SELECT DISTINCT aa.account_number";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql.= " AND aa.active = 1)";
|
||||
$sql.= " GROUP BY t.numero_compte";
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj[$i] = $this->db->fetch_object($resql);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
|
||||
return $obj;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to add an accounting account in an accounting category
|
||||
*
|
||||
* @param int $id_cat Id category
|
||||
* @param array $cpts list of accounts array
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function updateAccAcc($id_cat, $cpts = array())
|
||||
{
|
||||
global $conf;
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql.= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql.= " AND aa.active = 1";
|
||||
$sql.= " SET fk_accounting_category=" . $id_cat;
|
||||
$sql.= " WHERE aa.account_number IN (" . join(',',$cpts) .")";
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to delete an accounting account from an accounting category
|
||||
*
|
||||
* @param int $cpt_id Id of accounting account
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function deleteCptCat($cpt_id)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql.= " SET fk_accounting_category= 0";
|
||||
$sql.= " WHERE aa.rowid= " . $cpt_id;
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = "Error " . $this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
foreach ($this->errors as $errmsg) {
|
||||
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
|
||||
return -1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to know all category from accounting account
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getCatsCpts()
|
||||
{
|
||||
global $mysoc;
|
||||
$sql = "";
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id))
|
||||
{
|
||||
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt, cat.code, cat.position, cat.label as name_cat, cat.sens ";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_account as t, ".MAIN_DB_PREFIX."c_accounting_category as cat";
|
||||
$sql.= " WHERE t.fk_accounting_category IN ( SELECT c.rowid ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id.")";
|
||||
$sql.= " AND cat.rowid = t.fk_accounting_category";
|
||||
$sql.= " ORDER BY cat.position ASC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.account_category ";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array();
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$name_cat = $obj->name_cat;
|
||||
$data[$name_cat][$i] = array(
|
||||
'id' => $obj->rowid,
|
||||
'code' => $obj->code,
|
||||
'position' => $obj->position,
|
||||
'account_number' => $obj->account_number,
|
||||
'name_cpt' => $obj->name_cpt,
|
||||
'sens' => $obj->sens,
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to show result of an accounting account from the general ledger with a sens and a period
|
||||
*
|
||||
* @param int $cpt Id accounting account
|
||||
* @param string $month Specifig month - Can be empty
|
||||
* @param string $year Specific year
|
||||
* @param int $sens Sens of the account 0: credit - debit 1: debit - credit
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getResult($cpt, $month, $year, $sens)
|
||||
{
|
||||
$sql = "SELECT SUM(t.debit) as debit, SUM(t.credit) as credit";
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t";
|
||||
$sql.= " WHERE t.numero_compte = " . $cpt;
|
||||
$sql.= " AND YEAR(t.doc_date) = " . $year;
|
||||
|
||||
if(! empty($month)){
|
||||
$sql.= " AND MONTH(t.doc_date) = " . $month;
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$sdc = 0;
|
||||
if ($num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if($sens == 1){
|
||||
$sdc = $obj->debit - $obj->credit;
|
||||
}else{
|
||||
$sdc = $obj->credit - $obj->debit;
|
||||
}
|
||||
}
|
||||
return $sdc;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to call category from a specific country
|
||||
*
|
||||
* @return array Result in table
|
||||
*/
|
||||
public function getCatsCal()
|
||||
{
|
||||
global $db,$langs,$user,$mysoc;
|
||||
|
||||
if (empty($mysoc->country_id) && empty($mysoc->country_code))
|
||||
{
|
||||
dol_print_error('','Call to select_accounting_account with mysoc country not yet defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (! empty($mysoc->country_id))
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql.= " WHERE c.active = 1 AND c.account_category = 1 ";
|
||||
$sql.= " AND c.fk_country = ".$mysoc->country_id;
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c, ".MAIN_DB_PREFIX."c_country as co";
|
||||
$sql.= " WHERE c.active = 1 AND c.account_category = 1 AND c.fk_country = co.rowid";
|
||||
$sql.= " AND co.code = '".$mysoc->country_code."'";
|
||||
$sql.= " ORDER BY c.position ASC";
|
||||
}
|
||||
|
||||
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$obj = '';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$data = array();
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$position = $obj->position;
|
||||
$data[$position] = array(
|
||||
'code' => $obj->code,
|
||||
'label' => $obj->label,
|
||||
'formula' => $obj->formula
|
||||
);
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -35,12 +35,12 @@ class AccountancyExport
|
||||
/**
|
||||
* @var Type of export
|
||||
*/
|
||||
public static $EXPORT_TYPE_NORMAL = 1;
|
||||
public static $EXPORT_TYPE_CEGID = 2;
|
||||
public static $EXPORT_TYPE_COALA = 3;
|
||||
public static $EXPORT_TYPE_BOB50 = 4;
|
||||
public static $EXPORT_TYPE_CIEL = 5;
|
||||
public static $EXPORT_TYPE_QUADRATUS = 6;
|
||||
public static $EXPORT_TYPE_NORMAL = 1;
|
||||
public static $EXPORT_TYPE_CEGID = 2;
|
||||
public static $EXPORT_TYPE_COALA = 3;
|
||||
public static $EXPORT_TYPE_BOB50 = 4;
|
||||
public static $EXPORT_TYPE_CIEL = 5;
|
||||
public static $EXPORT_TYPE_QUADRATUS = 6;
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
@ -69,7 +69,6 @@ class AccountancyExport
|
||||
$this->db = &$db;
|
||||
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||
$this->end_line = "\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -277,7 +276,7 @@ class AccountancyExport
|
||||
/**
|
||||
*
|
||||
* @param unknown $str data
|
||||
* @param unknown $size data
|
||||
* @param integer $size data
|
||||
*/
|
||||
public static function trunc($str, $size)
|
||||
{
|
||||
|
||||
@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountancysystem.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief File of class to manage accountancy systems
|
||||
* \file htdocs/accountancy/class/accountancysystem.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage accountancy systems
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/accountingaccount.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Fichier de la classe des comptes comptable
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage accounting accounts
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -117,7 +117,7 @@ class AccountingAccount extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert line in accounting_account
|
||||
* Insert new accounting account in chart of accounts
|
||||
*
|
||||
* @param User $user Use making action
|
||||
* @param int $notrigger Disable triggers
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
/* Copyright (C) 2014-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2015-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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,21 +18,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file accountancy/bookkeeping.class.php
|
||||
* \ingroup accountancy
|
||||
* \brief This file is an example for a CRUD class file (Create/Read/Update/Delete)
|
||||
* Put some comments here
|
||||
* \file htdocs/accountancy/class/bookkeeping.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class to manage general ledger
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
// require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
// require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class Accountingbookkeeping
|
||||
*
|
||||
* Put here description of your class
|
||||
* Class to manage general ledger
|
||||
*/
|
||||
class BookKeeping extends CommonObject
|
||||
{
|
||||
@ -461,7 +455,7 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Ref
|
||||
*
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null) {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@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
|
||||
@ -19,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/class/html.formventilation.class.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief File of class with all html predefined components
|
||||
* \file htdocs/accountancy/class/html.formventilation.class.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief File of class with all html predefined components
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -29,18 +30,6 @@
|
||||
*/
|
||||
class FormVentilation extends Form
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return select filter with date of transaction
|
||||
*
|
||||
@ -49,38 +38,25 @@ class FormVentilation extends Form
|
||||
* @return string HTML edit field
|
||||
*/
|
||||
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
|
||||
$options = array();
|
||||
|
||||
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
|
||||
$sql .= ' ORDER BY import_key DESC';
|
||||
|
||||
$out = '<SELECT name="' . $htmlname . '">';
|
||||
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$selected = '';
|
||||
if ($selectedkey == $obj->import_key) {
|
||||
$selected = ' selected ';
|
||||
}
|
||||
|
||||
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key, 'dayhourtext') . '</OPTION>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
}
|
||||
|
||||
$out .= '</SELECT>';
|
||||
|
||||
return $out;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext');
|
||||
}
|
||||
|
||||
return Form::selectarray($htmlname, $options, $selectedkey);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,8 +76,8 @@ class FormVentilation extends Form
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$out = '';
|
||||
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
@ -110,49 +86,44 @@ class FormVentilation extends Form
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
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 = length_accountg($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 accounting_account 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 == $select_value_in) {
|
||||
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
|
||||
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
|
||||
} else {
|
||||
// $out .= '<option value="' . $obj->account_number . '">' . $label . '</option>';
|
||||
$out .= '<option value="' . $select_value_out . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$options = array();
|
||||
$selected = null;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account 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 == $select_value_in) {
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty);
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -170,44 +141,30 @@ class FormVentilation extends Form
|
||||
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " ORDER BY pcg_type";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->pcg_type;
|
||||
|
||||
if (($selectid != '') && $selectid == $obj->pcg_type) {
|
||||
$out .= '<option value="' . $obj->pcg_type . '" selected>' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->pcg_type . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$options[$obj->pcg_type] = $obj->pcg_type;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -225,44 +182,30 @@ class FormVentilation extends Form
|
||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_subtype ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " ORDER BY pcg_subtype";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->pcg_subtype;
|
||||
|
||||
if (($selectid != '') && $selectid == $obj->pcg_subtype) {
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '" selected>' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -278,68 +221,51 @@ class FormVentilation extends Form
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$aux_account = array ();
|
||||
|
||||
|
||||
$aux_account = array();
|
||||
|
||||
// Auxiliary customer account
|
||||
$sql = "SELECT DISTINCT code_compta, nom ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " ORDER BY code_compta";
|
||||
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
if (! empty($obj->code_compta)) {
|
||||
$aux_account[$obj->code_compta] = $obj->code_compta . ' (' . $obj->nom . ')';
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!empty($obj->code_compta)) {
|
||||
$aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
// Auxiliary supplier account
|
||||
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " ORDER BY code_compta";
|
||||
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
if (! empty($obj->code_compta_fournisseur)) {
|
||||
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur . ' (' . $obj->nom . ')';
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!empty($obj->code_compta_fournisseur)) {
|
||||
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
// Build select
|
||||
if (count($aux_account) > 0) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
foreach ( $aux_account as $key => $val ) {
|
||||
if (($selectid != '') && $selectid == $key) {
|
||||
$out .= '<option value="' . $key . '" selected>' . $val . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $key . '">' . $val . '</option>';
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -352,55 +278,29 @@ class FormVentilation extends Form
|
||||
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
|
||||
* @return string/array
|
||||
*/
|
||||
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') {
|
||||
$out = '';
|
||||
$out_array = array ();
|
||||
|
||||
if ($output_format == 'html') {
|
||||
$out .= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"' . $option . ' >';
|
||||
}
|
||||
if ($useempty) {
|
||||
$selected_html = '';
|
||||
if ($selected == '') {
|
||||
$selected_html = ' selected';
|
||||
}
|
||||
if ($output_format == 'html' || $output_format == 'options') {
|
||||
$out .= '<option value=""' . $selected_html . '> </option>';
|
||||
} elseif ($output_format == 'array') {
|
||||
$out_array[''] = '';
|
||||
}
|
||||
}
|
||||
|
||||
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
|
||||
{
|
||||
$out_array = array();
|
||||
|
||||
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " ORDER BY doc_date";
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
$selected_html = '';
|
||||
if ($selected > 0 && $obj->dtyear == $selected)
|
||||
$selected_html = ' selected';
|
||||
if ($output_format == 'html' || $output_format == 'options') {
|
||||
$out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>';
|
||||
} elseif ($output_format == 'array') {
|
||||
$out_array[$obj->dtyear] = $obj->dtyear;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$out_array[$obj->dtyear] = $obj->dtyear;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
if ($output_format == 'html') {
|
||||
$out .= "</select>\n";
|
||||
}
|
||||
|
||||
if ($output_format == 'html' || $output_format == 'options') {
|
||||
return $out;
|
||||
} elseif ($output_format == 'array') {
|
||||
return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
|
||||
} else {
|
||||
return $out_array;
|
||||
}
|
||||
}
|
||||
|
||||
0
htdocs/accountancy/customer/index.html
Normal file
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Home customer ventilation
|
||||
* \file htdocs/accountancy/customer/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home customer ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -44,7 +44,7 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
@ -95,7 +95,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -21,9 +21,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/customer/lines.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page of detail of the lines of ventilation of invoices customers
|
||||
* \file htdocs/accountancy/customer/lines.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page of detail of the lines of ventilation of invoices customers
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -31,6 +31,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.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 . '/core/lib/accounting.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("bills");
|
||||
@ -267,14 +268,14 @@ if ($result) {
|
||||
|
||||
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="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" 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" 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="5" name="search_vat" value="' . $search_vat . '"></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" align="center"><input type="text" class="flat" size="15" name="search_country" value="' . $search_country . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="15" name="search_tavintra" value="' . $search_tavintra . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_country" value="' . $search_country . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_tavintra" value="' . $search_tavintra . '"></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";
|
||||
@ -285,7 +286,7 @@ if ($result) {
|
||||
$var = True;
|
||||
while ( $objp = $db->fetch_object($result) ) {
|
||||
$var = ! $var;
|
||||
$codecompta = $objp->account_number . ' - ' . $objp->label_compte;
|
||||
$codecompta = length_accountg($objp->account_number) . ' - ' . $objp->label_compte;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
@ -309,7 +310,7 @@ if ($result) {
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
|
||||
print '<td>' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
print '<td align="right">' . $objp->country .'</td>';
|
||||
|
||||
@ -238,7 +238,7 @@ if ($result) {
|
||||
$paymentsalstatic->ref = $links[$key]['url_id'];
|
||||
$paymentsalstatic->label = $links[$key]['label'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2);
|
||||
$tabtp[$obj->rowid][$account_employee ] += $obj->amount;
|
||||
$tabtp[$obj->rowid][$account_employee] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'banktransfert') {
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer");
|
||||
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
|
||||
@ -418,12 +418,27 @@ if ($action == 'export_csv') {
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
$reflabel = $val["ref"];
|
||||
if ($reflabel == '(SupplierInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Supplier');
|
||||
}
|
||||
if ($reflabel == '(CustomerInvoicePayment)') {
|
||||
$reflabel = $langs->trans('Customer');
|
||||
}
|
||||
if ($reflabel == '(SocialContributionPayment)') {
|
||||
$reflabel = $langs->trans('SocialContribution');
|
||||
}
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
if ($reflabel == '(SubscriptionPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
|
||||
$companystatic->id = $tabcompany[$key]['id'];
|
||||
$companystatic->name = $tabcompany[$key]['name'];
|
||||
$companystatic->client = $tabcompany[$key]['code_client'];
|
||||
|
||||
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
@ -432,8 +447,12 @@ if ($action == 'export_csv') {
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'C' : 'D') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('Bank')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans("Bank") .' - '.utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
|
||||
@ -443,33 +462,45 @@ if ($action == 'export_csv') {
|
||||
if ($mt) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
if ($val["lib"] == '(SupplierInvoicePayment)') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
} else {
|
||||
if ($tabtype[$key] == 'payment') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
} else if ($tabtype[$key] == 'payment_supplier') {
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
} else {
|
||||
print length_accountg(html_entity_decode($k)) . $sep;
|
||||
print $sep;
|
||||
}
|
||||
print length_accounta(html_entity_decode($k)) . $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
print $val["type_payment"] . $sep;
|
||||
print utf8_decode($val["ref"]) . $sep;
|
||||
print "\n";
|
||||
print $date . $sep;
|
||||
print $journal . $sep;
|
||||
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
|
||||
print $sep;
|
||||
print ($mt < 0 ? 'D' : 'C') . $sep;
|
||||
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
|
||||
} else {
|
||||
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
|
||||
}
|
||||
print utf8_decode($reflabel) . $sep;
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Model Classic Export
|
||||
foreach ( $tabpay as $key => $val ) {
|
||||
@ -480,6 +511,7 @@ if ($action == 'export_csv') {
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
|
||||
@ -488,7 +520,6 @@ if ($action == 'export_csv') {
|
||||
} else {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
|
||||
}
|
||||
// print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
|
||||
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
|
||||
print "\n";
|
||||
@ -498,10 +529,10 @@ if ($action == 'export_csv') {
|
||||
if (is_array($tabtp[$key])) {
|
||||
foreach ( $tabtp[$key] as $k => $mt ) {
|
||||
if ($mt) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["type_payment"] . '"' . $sep;
|
||||
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
|
||||
// print '"' . $companystatic->name . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
@ -514,10 +545,10 @@ if ($action == 'export_csv') {
|
||||
}
|
||||
} else {
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
print '"' . $journal . '"' . $sep;
|
||||
print '"' . $date . '"' . $sep;
|
||||
print '"' . $val["ref"] . '"' . $sep;
|
||||
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
|
||||
// print '"' . $langs->trans("Bank") . '"' . $sep;
|
||||
if ($companystatic->name == '') {
|
||||
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
|
||||
} else {
|
||||
@ -599,6 +630,9 @@ else {
|
||||
if ($reflabel == '(DonationPayment)') {
|
||||
$reflabel = $langs->trans('Donation');
|
||||
}
|
||||
if ($reflabel == '(SubscriptionPayment)') {
|
||||
$reflabel = $langs->trans('SubscriptionPayment');
|
||||
}
|
||||
|
||||
// Bank
|
||||
foreach ( $tabbq[$key] as $k => $mt ) {
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/journal/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Index
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
$langs->load("bills");
|
||||
$langs->load("other");
|
||||
$langs->load("main");
|
||||
$langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
|
||||
llxHeader('', 'Journaux', '');
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/journal/purchasesjournal.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page with purchases journal
|
||||
* \file htdocs/accountancy/journal/purchasesjournal.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page with purchases journal
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
|
||||
0
htdocs/accountancy/report/index.html
Normal file
240
htdocs/accountancy/report/result.php
Normal file
@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/report/result.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page for accounting result
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Langs
|
||||
$langs->load("accountancy");
|
||||
$langs->load("compta");
|
||||
|
||||
$mesg = '';
|
||||
$action = GETPOST('action');
|
||||
$cat_id = GETPOST('account_category');
|
||||
$selectcpt = GETPOST('cpt_bk');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$cancel = GETPOST('cancel');
|
||||
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
|
||||
if($cat_id == 0){
|
||||
$cat_id = null;
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->comptarapport->lire)
|
||||
accessforbidden();
|
||||
|
||||
$AccCat = new AccountancyCategory($db);
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
llxheader('', $langs->trans('ReportInOut'));
|
||||
|
||||
$formaccounting = new FormAccounting($db);
|
||||
$form = new Form($db);
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans('ReportInOut') . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear);
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$months = array( $langs->trans("JanuaryMin"),
|
||||
$langs->trans("FebruaryMin"),
|
||||
$langs->trans("MarchMin"),
|
||||
$langs->trans("AprilMin"),
|
||||
$langs->trans("MayMin"),
|
||||
$langs->trans("JuneMin"),
|
||||
$langs->trans("JulyMin"),
|
||||
$langs->trans("AugustMin"),
|
||||
$langs->trans("SeptemberMin"),
|
||||
$langs->trans("OctoberMin"),
|
||||
$langs->trans("NovemberMin"),
|
||||
$langs->trans("DecemberMin"),
|
||||
);
|
||||
|
||||
print '<tr class="liste_titre"><th class="liste_titre">'.$langs->trans("Account").'</th>';
|
||||
print '<th class="liste_titre">'.$langs->trans("Description").'</th>';
|
||||
print '<th class="liste_titre" align="center">N-1</th>';
|
||||
print '<th class="liste_titre" align="center">'.$langs->trans("NReal").'</th>';
|
||||
foreach($months as $k => $v){
|
||||
print '<th class="liste_titre" align="center">'.$langs->trans($v).'</th>';
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$cats = $AccCat->getCatsCpts();
|
||||
$catsCalcule = $AccCat->getCatsCal();
|
||||
|
||||
$j=1;
|
||||
$sommes = array();
|
||||
|
||||
if(!empty($cats))
|
||||
{
|
||||
foreach ( $cats as $name_cat => $cpts )
|
||||
{
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="17">' . $name_cat . '</td>';
|
||||
print "</tr>\n";
|
||||
$position = -1;
|
||||
$code = -1;
|
||||
foreach($cpts as $i => $cpt){
|
||||
$var = ! $var;
|
||||
|
||||
$position = $cpt['position'];
|
||||
$code = $cpt['code'];
|
||||
|
||||
$resultNP = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
|
||||
$resultN = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
|
||||
$sommes[$code]['NP'] += $resultNP;
|
||||
$sommes[$code]['N'] += $resultN;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>' . $cpt['account_number'] . '</td>';
|
||||
print '<td>' . $cpt['name_cpt'] . '</td>';
|
||||
print '<td>' . price($resultNP) . '</td>';
|
||||
print '<td>' . price($resultN) . '</td>';
|
||||
|
||||
foreach($months as $k => $v){
|
||||
$resultM = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
|
||||
$sommes[$code]['M'][$k] += $resultM;
|
||||
print '<td align="right">' . price($resultM) . '</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
// If it's a calculated catgory
|
||||
$p = $position + 1;
|
||||
if(array_key_exists($p, $catsCalcule)){
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
|
||||
}
|
||||
$j++;
|
||||
}
|
||||
|
||||
// Others calculed category
|
||||
foreach($catsCalcule as $p => $catc)
|
||||
{
|
||||
$formula = $catsCalcule[$p]['formula'];
|
||||
|
||||
print "<tr class='liste_titre'>";
|
||||
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['NP'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$code = $catsCalcule[$p]['code']; // code categorie de calcule
|
||||
$sommes[$code]['NP'] += $result;
|
||||
|
||||
// Current fiscal year (N)
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['N'];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['N'] += $result;
|
||||
|
||||
// Detail by month
|
||||
foreach($months as $k => $v){
|
||||
foreach($sommes as $code => $det){
|
||||
$vars[$code] = $det['M'][$k];
|
||||
}
|
||||
$result = strtr($formula, $vars);
|
||||
eval( '$result = (' . $result . ');' );
|
||||
print '<td align="right">' . price($result) . '</td>';
|
||||
$sommes[$code]['M'][$k] += $result;
|
||||
}
|
||||
|
||||
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -19,9 +19,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/index.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Home supplier ventilation
|
||||
* \file htdocs/accountancy/supplier/index.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Home supplier ventilation
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -42,7 +42,7 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->ventilation->read)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
// Filter
|
||||
$year = $_GET["year"];
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
@ -91,7 +91,7 @@ if ($action == 'validatehistory') {
|
||||
$sql1 .= " SET fd.fk_code_ventilation = 0";
|
||||
$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN ';
|
||||
$sql1 .= ' (SELECT accnt.rowid ';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accountingaccount as accnt';
|
||||
$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt';
|
||||
$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst';
|
||||
$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@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) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -20,9 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/supplier/lines.php
|
||||
* \ingroup Accounting Expert
|
||||
* \brief Page of detail of the lines of ventilation of invoices suppliers
|
||||
* \file htdocs/accountancy/supplier/lines.php
|
||||
* \ingroup Advanced accountancy
|
||||
* \brief Page of detail of the lines of ventilation of invoices suppliers
|
||||
*/
|
||||
require '../../main.inc.php';
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -213,11 +214,11 @@ if ($result) {
|
||||
print "</tr>\n";
|
||||
|
||||
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="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" 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" 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="5" name="search_vat" value="' . $search_vat . '"></td>';
|
||||
print '<td class="liste_titre" align="center"><input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '">%</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"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
@ -233,7 +234,7 @@ if ($result) {
|
||||
while ( $i < min($num_lines, $limit) ) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
$codeCompta = $objp->account_number . ' - ' . $objp->label;
|
||||
$codeCompta = length_accountg($objp->account_number) . ' - ' . $objp->label;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
|
||||
@ -257,7 +258,7 @@ if ($result) {
|
||||
print '<td>' . nl2br(dol_trunc($objp->description, 32)) . '</td>';
|
||||
print '<td align="right">' . price($objp->total_ht) . '</td>';
|
||||
print '<td align="center">' . price($objp->tva_tx) . '</td>';
|
||||
print '<td align="center">' . $codeCompta . '</td>';
|
||||
print '<td>' . $codeCompta . '</td>';
|
||||
print '<td align="right">' . $objp->rowid . '</td>';
|
||||
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
|
||||
print img_edit();
|
||||
|
||||
@ -356,13 +356,8 @@ if (empty($reshook))
|
||||
}
|
||||
else
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($newfile, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($newfile, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
// Create thumbs
|
||||
$object->addThumbs($newfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,7 +128,9 @@ if ($result)
|
||||
if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')';
|
||||
|
||||
$param='';
|
||||
$param.="&statut=$statut&date_select=$date_select";
|
||||
if ($statut != '') $param.="&statut=".$statut;
|
||||
if ($date_select) $param.="&date_select=".$date_select;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_lastname) $param.="&search_lastname=".$search_lastname;
|
||||
if ($search_login) $param.="&search_login=".$search_login;
|
||||
if ($search_acount) $param.="&search_account=".$search_account;
|
||||
@ -214,7 +216,7 @@ if ($result)
|
||||
|
||||
$var=true;
|
||||
$total=0;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$total+=$objp->cotisation;
|
||||
|
||||
@ -153,6 +153,7 @@ if ($action == 'delete' && $user->rights->adherent->configurer)
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -236,7 +237,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tbody>';
|
||||
|
||||
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
|
||||
print $form->selectyesno("cotisation",1,1);
|
||||
@ -247,7 +248,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" cols="60" rows="3"></textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3"></textarea></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
@ -645,7 +646,7 @@ if ($rowid > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
|
||||
print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" class="centpercent" rows="3">'.$object->note.'</textarea></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
@ -92,10 +92,10 @@ print "</tr>\n";
|
||||
|
||||
$bankorder[0][0]=$langs->trans("BankOrderGlobal");
|
||||
$bankorder[0][1]=$langs->trans("BankOrderGlobalDesc");
|
||||
$bankorder[0][2]='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
$bankorder[0][2]='BankCode DeskCode BankAccountNumber BankAccountNumberKey';
|
||||
$bankorder[1][0]=$langs->trans("BankOrderES");
|
||||
$bankorder[1][1]=$langs->trans("BankOrderESDesc");
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
$bankorder[1][2]='BankCode DeskCode BankAccountNumberKey BankAccountNumber';
|
||||
|
||||
$var = true;
|
||||
$i=0;
|
||||
|
||||
@ -98,12 +98,14 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Create thumbs of logo (Note that PDF use original file and not thumbs)
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Create thumbs
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
if (preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1];
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbSmall);
|
||||
@ -111,9 +113,9 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$original_file, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
if (preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
|
||||
if (image_format_supported($imgThumbMini) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1];
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
@ -203,12 +205,14 @@ if ($action == 'addthumb')
|
||||
// Create thumbs of logo
|
||||
if ($isimage > 0)
|
||||
{
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Create thumbs
|
||||
//$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retreive value with get...
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthsmall, $maxheightsmall, '_small',$quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbSmall,$reg))
|
||||
{
|
||||
$imgThumbSmall = $reg[1];
|
||||
$imgThumbSmall = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$imgThumbSmall,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbSmall);
|
||||
@ -218,7 +222,7 @@ if ($action == 'addthumb')
|
||||
$imgThumbMini = vignette($conf->mycompany->dir_output.'/logos/'.$_GET["file"], $maxwidthmini, $maxheightmini, '_mini',$quality);
|
||||
if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i',$imgThumbMini,$reg))
|
||||
{
|
||||
$imgThumbMini = $reg[1];
|
||||
$imgThumbMini = $reg[1]; // Save only basename
|
||||
dolibarr_set_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$imgThumbMini,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
else dol_syslog($imgThumbMini);
|
||||
@ -727,7 +731,9 @@ else
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("CompanyCurrency").'</td><td>';
|
||||
print currency_name($conf->currency,1);
|
||||
print ' ('.$langs->getCurrencySymbol($conf->currency).')';
|
||||
print ' ('.$conf->currency;
|
||||
print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : '');
|
||||
print ')';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
|
||||
@ -189,7 +189,7 @@ $tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.new
|
||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30]= "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.fk_pays as country_id, c.code as country_code, c.label as country, s.label, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
|
||||
$tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
|
||||
@ -226,7 +226,7 @@ $tabsqlsort[28]="country ASC, code ASC";
|
||||
$tabsqlsort[29]="position ASC";
|
||||
$tabsqlsort[30]="code ASC";
|
||||
$tabsqlsort[31]="pcg_version ASC";
|
||||
$tabsqlsort[32]="code ASC, label ASC";
|
||||
$tabsqlsort[32]="position ASC";
|
||||
$tabsqlsort[33]="code ASC";
|
||||
$tabsqlsort[34]="code ASC";
|
||||
|
||||
@ -256,14 +256,14 @@ $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,position,topic,content";
|
||||
$tabfield[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27]= "code,libelle";
|
||||
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
|
||||
$tabfield[29]= "code,label,percent,position";
|
||||
$tabfield[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfield[31]= "pcg_version,country_id,country,label";
|
||||
$tabfield[32]= "code,label,range,position,country_id,country";
|
||||
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
|
||||
$tabfield[33]= "code,label";
|
||||
$tabfield[34]= "code,label";
|
||||
|
||||
@ -293,14 +293,14 @@ $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,position,topic,content";
|
||||
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
|
||||
$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27]= "code,libelle";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
|
||||
$tabfieldvalue[29]= "code,label,percent,position";
|
||||
$tabfieldvalue[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfieldvalue[31]= "pcg_version,country,label";
|
||||
$tabfieldvalue[32]= "code,label,range_account,position,country";
|
||||
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
|
||||
$tabfieldvalue[33]= "code,label";
|
||||
$tabfieldvalue[34]= "code,label";
|
||||
|
||||
@ -337,7 +337,7 @@ $tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
|
||||
$tabfieldinsert[29]= "code,label,percent,position";
|
||||
$tabfieldinsert[30]= "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
$tabfieldinsert[31]= "pcg_version,fk_pays,label";
|
||||
$tabfieldinsert[32]= "code,label,range_account,position,fk_country";
|
||||
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
|
||||
$tabfieldinsert[33]= "code,label";
|
||||
$tabfieldinsert[34]= "code,label";
|
||||
|
||||
@ -524,6 +524,7 @@ if ($id == 11)
|
||||
'propal' => $langs->trans('Proposal'),
|
||||
'commande' => $langs->trans('Order'),
|
||||
'facture' => $langs->trans('Bill'),
|
||||
'resource' => $langs->trans('Resource'),
|
||||
// 'facture_fourn' => $langs->trans('SupplierBill'),
|
||||
'fichinter' => $langs->trans('InterventionCard')
|
||||
);
|
||||
@ -585,6 +586,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($value == 'localtax1' && empty($_POST['localtax1_type'])) continue;
|
||||
if ($value == 'localtax2' && empty($_POST['localtax2_type'])) continue;
|
||||
if ($value == 'color' && empty($_POST['color'])) continue;
|
||||
if ($value == 'formula' && empty($_POST['formula'])) continue;
|
||||
if ((! isset($_POST[$value]) || $_POST[$value]=='')
|
||||
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy'))) // Fields that are not mandatory
|
||||
)
|
||||
@ -605,6 +607,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($fieldnamekey == 'unicode') $fieldnamekey = 'Unicode';
|
||||
if ($fieldnamekey == 'deductible') $fieldnamekey = 'Deductible';
|
||||
if ($fieldnamekey == 'sortorder') $fieldnamekey = 'SortOrder';
|
||||
if ($fieldnamekey == 'category_type') $fieldnamekey = 'Calculated';
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
@ -999,6 +1002,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
|
||||
if ($id == 2) // Special cas for state page
|
||||
{
|
||||
@ -1167,6 +1173,9 @@ if ($id)
|
||||
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
|
||||
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
|
||||
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
|
||||
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
|
||||
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
|
||||
if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
@ -1248,7 +1257,7 @@ if ($id)
|
||||
$valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country);
|
||||
}
|
||||
}
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible') {
|
||||
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
$valuetoshow=yn($valuetoshow);
|
||||
$align="center";
|
||||
}
|
||||
@ -1389,8 +1398,10 @@ if ($id)
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto';
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -1616,7 +1627,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
print 'user<input type="hidden" name="type" value="user">';
|
||||
print '</td>';
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible') {
|
||||
elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'fdm' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') {
|
||||
print '<td>';
|
||||
print $form->selectyesno($fieldlist[$field],(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''),1);
|
||||
print '</td>';
|
||||
@ -1690,13 +1701,13 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
|
||||
else
|
||||
{
|
||||
print '<td>';
|
||||
$size='';
|
||||
$size=''; $class='';
|
||||
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]=='sortorder') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
if ($fieldlist[$field]=='libelle') $size='centpercent';
|
||||
if ($fieldlist[$field]=='tracking') $class='centpercent';
|
||||
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
|
||||
print '<input type="text" '.$size.' class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,7 +189,19 @@ else
|
||||
show_skin(null,1);
|
||||
print '<br>'."\n";
|
||||
|
||||
print load_fiche_titre($langs->trans("TestSubmitForm"),'(mode='.$mode.')','');
|
||||
$listofmodes=array('dolibarr_mailings','dolibarr_notes','dolibarr_details','Full');
|
||||
$linkstomode='';
|
||||
foreach($listofmodes as $newmode)
|
||||
{
|
||||
if ($linkstomode) $linkstomode.=' - ';
|
||||
$linkstomode.='<a href="'.$_SERVER["PHP_SELF"].'?mode='.$newmode.'">';
|
||||
if ($mode == $newmode) $linkstomode.='<strong>';
|
||||
$linkstomode.=$newmode;
|
||||
if ($mode == $newmode) $linkstomode.='</strong>';
|
||||
$linkstomode.='</a>';
|
||||
}
|
||||
$linkstomode.='';
|
||||
print load_fiche_titre($langs->trans("TestSubmitForm"),$linkstomode,'');
|
||||
print '<input type="hidden" name="mode" value="'.dol_escape_htmltag($mode).'">';
|
||||
$uselocalbrowser=true;
|
||||
$readonly=($mode=='dolibarr_readonly'?1:0);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@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
|
||||
@ -26,6 +26,7 @@ require '../main.inc.php';
|
||||
|
||||
// Class
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("loan");
|
||||
@ -76,6 +77,7 @@ if ($action == 'update')
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans('ConfigLoan'),$linkback,'title_setup');
|
||||
@ -104,7 +106,14 @@ foreach ($list as $key)
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccountancy->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
@ -207,7 +207,7 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
|
||||
$msgishtml,
|
||||
$errors_to,
|
||||
'',
|
||||
$trackid
|
||||
$trackid
|
||||
);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
@ -259,6 +259,7 @@ $listofmethods=array();
|
||||
$listofmethods['mail']='PHP mail function';
|
||||
//$listofmethods['simplemail']='Simplemail class';
|
||||
$listofmethods['smtps']='SMTP/SMTPS socket library';
|
||||
$listofmethods['swiftmailer']='Swift Mailer socket library';
|
||||
|
||||
|
||||
if ($action == 'edit')
|
||||
@ -313,6 +314,20 @@ if ($action == 'edit')
|
||||
jQuery("#smtp_server_mess").hide();
|
||||
jQuery("#smtp_port_mess").hide();
|
||||
}
|
||||
if (jQuery("#MAIN_MAIL_SENDMODE").val()==\'swiftmailer\')
|
||||
{
|
||||
jQuery(".drag").show();
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").val('.$conf->global->MAIN_MAIL_EMAIL_TLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_TLS").removeAttr("disabled");
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS.');
|
||||
jQuery("#MAIN_MAIL_EMAIL_STARTTLS").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() {
|
||||
@ -436,7 +451,7 @@ if ($action == 'edit')
|
||||
print '</td></tr>';
|
||||
|
||||
// ID
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
$var=!$var;
|
||||
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:'');
|
||||
@ -456,7 +471,7 @@ if ($action == 'edit')
|
||||
}
|
||||
|
||||
// PW
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
$var=!$var;
|
||||
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
|
||||
@ -478,7 +493,7 @@ if ($action == 'edit')
|
||||
// TLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -492,7 +507,7 @@ if ($action == 'edit')
|
||||
// STARTTLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps'))
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -581,14 +596,14 @@ else
|
||||
|
||||
// SMTPS ID
|
||||
$var=!$var;
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.$conf->global->MAIN_MAIL_SMTPS_ID.'</td></tr>';
|
||||
}
|
||||
|
||||
// SMTPS PW
|
||||
$var=!$var;
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./','*',$conf->global->MAIN_MAIL_SMTPS_PW).'</td></tr>';
|
||||
}
|
||||
@ -596,7 +611,7 @@ else
|
||||
// TLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -610,7 +625,7 @@ else
|
||||
// STARTTLS
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && $conf->global->MAIN_MAIL_SENDMODE == 'smtps')
|
||||
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer')))
|
||||
{
|
||||
if (function_exists('openssl_open'))
|
||||
{
|
||||
@ -705,9 +720,6 @@ else
|
||||
{
|
||||
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
|
||||
|
||||
// If we use SSL/TLS
|
||||
if (! empty($conf->global->MAIN_MAIL_EMAIL_TLS) && function_exists('openssl_open')) $server='ssl://'.$server;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mail = new CMailFile('','','','');
|
||||
$result=$mail->check_server_port($server,$port);
|
||||
|
||||
@ -75,6 +75,7 @@ if ($action == 'update')
|
||||
$menu->perms=$_POST['perms'];
|
||||
$menu->target=$_POST['target'];
|
||||
$menu->user=$_POST['user'];
|
||||
$menu->fk_menu=$_POST['fk_menu'];
|
||||
$result=$menu->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -275,6 +276,8 @@ if ($action == 'create')
|
||||
print '<form action="./edit.php?action=add&menuId='.$_GET['menuId'].'" method="post" name="formmenucreate">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Id
|
||||
@ -368,8 +371,10 @@ if ($action == 'create')
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Boutons
|
||||
print '<br><div class="center">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
@ -387,6 +392,8 @@ elseif ($action == 'edit')
|
||||
print '<input type="hidden" name="handler_origine" value="'.$menu_handler.'">';
|
||||
print '<input type="hidden" name="menuId" value="'.$_GET['menuId'].'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$menu = new Menubase($db);
|
||||
@ -416,9 +423,9 @@ elseif ($action == 'edit')
|
||||
|
||||
// MenuId Parent
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('MenuIdParent').'</td>';
|
||||
print '<td><input type="text" name="fk_menu" value="'.$menu->fk_menu.'" size=10></td>';
|
||||
//$menu_handler
|
||||
//print '<td><input type="text" size="50" name="handler" value="all"></td>';
|
||||
print '<td>'.$menu->fk_menu.'</td>';
|
||||
print '<td>'.$langs->trans('DetailMenuIdParent').'</td></tr>';
|
||||
|
||||
// Niveau
|
||||
@ -454,8 +461,10 @@ elseif ($action == 'edit')
|
||||
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// Bouton
|
||||
print '<br><div class="center">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
@ -262,7 +262,7 @@ print '</form>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("TreeMenuPersonalized").'</td>';
|
||||
|
||||
@ -50,25 +50,11 @@ else if ($action == 'disable_hidemenu')
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'activate_layoutmenu')
|
||||
{
|
||||
dolibarr_set_const($db, "MAIN_MENU_USE_JQUERY_LAYOUT", '1','chaine',0,'',$conf->entity);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else if ($action == 'disable_layoutmenu')
|
||||
{
|
||||
dolibarr_del_const($db, "MAIN_MENU_USE_JQUERY_LAYOUT",$conf->entity);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
llxHeader('',$langs->trans("Setup"));
|
||||
|
||||
print load_fiche_titre($langs->trans("Menus"),'','title_setup');
|
||||
@ -119,25 +105,6 @@ else
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Use a flip-hide menu
|
||||
if (isset($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL > 1)
|
||||
{
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td colspan="3">'.$langs->trans("MenuUseLayout").'</td>';
|
||||
print '<td align="center">';
|
||||
if (empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=activate_layoutmenu">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=disable_layoutmenu">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ $page_y=GETPOST('page_y','int');
|
||||
$search_keyword=GETPOST('search_keyword','alpha');
|
||||
$search_status=GETPOST('search_status','alpha');
|
||||
$search_nature=GETPOST('search_nature','alpha');
|
||||
$search_version=GETPOST('search_version','alpha');
|
||||
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
@ -64,8 +65,9 @@ $familyinfo=array(
|
||||
|
||||
$param='';
|
||||
if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
|
||||
if ($search_status) $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_nature) $param.='&search_nature='.urlencode($search_nature);
|
||||
if ($search_status) $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_nature) $param.='&search_nature='.urlencode($search_nature);
|
||||
if ($search_version) $param.='&search_version='.urlencode($search_version);
|
||||
|
||||
|
||||
|
||||
@ -94,6 +96,7 @@ if (GETPOST('buttonreset'))
|
||||
$search_keyword='';
|
||||
$search_status='';
|
||||
$search_nature='';
|
||||
$search_version='';
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +112,7 @@ $_SESSION["mode"]=$mode;
|
||||
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
|
||||
llxHeader('',$langs->trans("Setup"),$help_url);
|
||||
|
||||
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
|
||||
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
@ -170,11 +174,30 @@ foreach ($modulesdir as $dir)
|
||||
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
|
||||
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
|
||||
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
|
||||
// We discard modules according to property disabled
|
||||
if (! empty($objMod->hidden)) $modulequalified=false;
|
||||
|
||||
// We discard modules according to property disabled
|
||||
if (! empty($objMod->hidden)) $modulequalified=0;
|
||||
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
$publisher=dol_escape_htmltag($objMod->getPublisher());
|
||||
$external=($objMod->isCoreOrExternalModule() == 'external');
|
||||
if ($external)
|
||||
{
|
||||
if ($publisher)
|
||||
{
|
||||
$arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher;
|
||||
}
|
||||
else
|
||||
{
|
||||
$arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers");
|
||||
}
|
||||
}
|
||||
ksort($arrayofnatures);
|
||||
}
|
||||
|
||||
// Define array $categ with categ with at least one qualified module
|
||||
if ($modulequalified)
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
$modules[$i] = $objMod;
|
||||
$filename[$i]= $modName;
|
||||
@ -199,6 +222,7 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
|
||||
$dirmod[$i] = $dir;
|
||||
//print $i.'-'.$dirmod[$i].'<br>';
|
||||
// Set categ[$i]
|
||||
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
|
||||
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
|
||||
@ -254,15 +278,15 @@ if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>
|
||||
$h = 0;
|
||||
|
||||
$categidx='common'; // Main
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
//if (! empty($categ[$categidx]))
|
||||
//{
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
$head[$h][1] = $langs->trans("AvailableModules");
|
||||
$head[$h][2] = 'common';
|
||||
$h++;
|
||||
}
|
||||
//}
|
||||
|
||||
$categidx='expdev';
|
||||
/*$categidx='expdev';
|
||||
if (! empty($categ[$categidx]))
|
||||
{
|
||||
$categidx='expdev';
|
||||
@ -270,7 +294,7 @@ if (! empty($categ[$categidx]))
|
||||
$head[$h][1] = $form->textwithpicto($langs->trans("ModuleFamilyExperimental"), $langs->trans('DoNotUseInProduction'), 1, 'warning', '', 0, 3);
|
||||
$head[$h][2] = 'expdev';
|
||||
$h++;
|
||||
}
|
||||
}*/
|
||||
|
||||
$categidx='marketplace';
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
|
||||
@ -299,10 +323,20 @@ if ($mode != 'marketplace')
|
||||
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
|
||||
$moreforfilter.= '</div>';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
|
||||
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1);
|
||||
$moreforfilter.= '</div>';
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
$array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated']=$langs->trans("Deprecated");
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental']=$langs->trans("Experimental");
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development']=$langs->trans("Development");
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Version') . ': '.$form->selectarray('search_version', $array_version, $search_version, 1);
|
||||
$moreforfilter.= '</div>';
|
||||
}
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
$moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', array('standard'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External")), $search_nature, 1);
|
||||
$moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
|
||||
$moreforfilter.= '</div>';
|
||||
$moreforfilter.=' ';
|
||||
$moreforfilter.='<div class="divsearchfield">';
|
||||
@ -337,7 +371,8 @@ if ($mode != 'marketplace')
|
||||
|
||||
$modName = $filename[$key];
|
||||
$objMod = $modules[$key];
|
||||
|
||||
$dirofmodule = $dirmod[$key];
|
||||
|
||||
$special = $objMod->special;
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->special.' - '.$objMod->version."<br>";
|
||||
@ -358,6 +393,8 @@ if ($mode != 'marketplace')
|
||||
$moduledesc=$objMod->getDesc();
|
||||
$moduledesclong=$objMod->getDescLong();
|
||||
$moduleauthor=$objMod->getPublisher();
|
||||
|
||||
// We discard showing according to filters
|
||||
if ($search_keyword)
|
||||
{
|
||||
$qualified=0;
|
||||
@ -375,8 +412,22 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
if ($search_nature)
|
||||
{
|
||||
if ($search_nature == 'external' && $objMod->isCoreOrExternalModule() != 'external') continue;
|
||||
if ($search_nature == 'standard' && $objMod->isCoreOrExternalModule() == 'external') continue;
|
||||
if (preg_match('/^external/',$search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue;
|
||||
if (preg_match('/^external_(.*)$/',$search_nature, $reg))
|
||||
{
|
||||
//print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
|
||||
$publisher=dol_escape_htmltag($objMod->getPublisher());
|
||||
if ($reg[1] && $reg[1] != $publisher) continue;
|
||||
if (! $reg[1] && ! empty($publisher)) continue;
|
||||
}
|
||||
if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
|
||||
}
|
||||
if ($search_version)
|
||||
{
|
||||
if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue;
|
||||
if ($objMod->version != 'development' && ($search_version == 'development')) continue;
|
||||
if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue;
|
||||
if (! preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue;
|
||||
}
|
||||
|
||||
// Load all lang files of module
|
||||
@ -394,7 +445,7 @@ if ($mode != 'marketplace')
|
||||
if ($familykey!=$oldfamily)
|
||||
{
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td colspan="5">';
|
||||
print '<td colspan="6">';
|
||||
$familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
|
||||
print $familytext;
|
||||
print "</td>\n";
|
||||
@ -442,18 +493,171 @@ if ($mode != 'marketplace')
|
||||
print nl2br($objMod->getDesc());
|
||||
print "</td>\n";
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
$version=$objMod->getVersion();
|
||||
$dirofmodule=$dirmod[$key];
|
||||
// Help
|
||||
print '<td align="center" valign="top" class="nowrap" style="width: 82px;">';
|
||||
$text='';
|
||||
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>'.$objMod->getDescLong().'<br>';
|
||||
else $text.=$objMod->getDesc().'<br>';
|
||||
|
||||
$textexternal='';
|
||||
if ($objMod->isCoreOrExternalModule() == 'external')
|
||||
{
|
||||
$text=$langs->trans("ExternalModule",$dirofmodule);
|
||||
if (! empty($objMod->editor_name) && $objMod->editor_name != 'dolibarr') $text.=' - '.$objMod->editor_name;
|
||||
if (! empty($objMod->editor_web) && $objMod->editor_web != 'www.dolibarr.org') $text.=' - '.$objMod->editor_web;
|
||||
print $form->textwithpicto($version, $text, 1, 'help');
|
||||
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
|
||||
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
|
||||
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
|
||||
$text.=$textexternal;
|
||||
$text.='<br>';
|
||||
}
|
||||
else print $version;
|
||||
else
|
||||
{
|
||||
$text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>';
|
||||
}
|
||||
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
|
||||
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->tabs as $val)
|
||||
{
|
||||
$tmp=explode(':',$val,3);
|
||||
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
|
||||
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->dictionaries['tablib'] as $val)
|
||||
{
|
||||
$text.=($i?', ':'').$val;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
|
||||
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->boxes as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddModels").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
|
||||
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->cronjobs as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val['label']);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
|
||||
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
|
||||
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->module_parts['hooks'] as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
|
||||
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->rights as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val[1]);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
|
||||
if (isset($objMod->menu) && is_array($objMod->menu) && $objMod->menu)
|
||||
{
|
||||
$text.=$langs->trans("Yes");
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
|
||||
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->export_label as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
|
||||
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
|
||||
{
|
||||
$i=0;
|
||||
foreach($objMod->import_label as $val)
|
||||
{
|
||||
$text.=($i?', ':'').($val);
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else $text.=$langs->trans("No");
|
||||
|
||||
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
|
||||
$text.=$langs->trans("DetectionNotPossible");
|
||||
|
||||
print $form->textwithpicto('', $text, 1, 'help', 'minheight20');
|
||||
|
||||
// Picto warning
|
||||
$version=$objMod->getVersion(0);
|
||||
$versiontrans=$objMod->getVersion(1);
|
||||
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: right"');
|
||||
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: right"');
|
||||
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: right"');
|
||||
|
||||
// Picto external
|
||||
if ($textexternal) print img_picto($langs->trans("ExternalModule",$dirofmodule), 'external', 'style="float: right"');
|
||||
|
||||
|
||||
print '</td>';
|
||||
|
||||
// Version
|
||||
print '<td align="center" valign="top" class="nowrap">';
|
||||
print $versiontrans;
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
@ -498,11 +702,11 @@ if ($mode != 'marketplace')
|
||||
{
|
||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs))
|
||||
{
|
||||
print '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>';
|
||||
print '<a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$urlpage.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a>';
|
||||
print '<a href="'.$urlpage.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -510,16 +714,16 @@ if ($mode != 'marketplace')
|
||||
}
|
||||
else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
|
||||
{
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup").'</a></td>';
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle"><a href="'.$objMod->config_page_url.'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').'</a></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp"').'</td>';
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
|
||||
}
|
||||
|
||||
}
|
||||
@ -542,7 +746,7 @@ if ($mode != 'marketplace')
|
||||
print "</a>\n";
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp"').'</td>';
|
||||
print '<td class="tdsetuppicto" align="right" valign="middle">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php';
|
||||
|
||||
|
||||
// Translations
|
||||
$langs->load("multicurrency");
|
||||
|
||||
@ -41,10 +42,11 @@ if (! $user->admin) {
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'alpha');
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
if (preg_match('/set_(.*)/',$action,$reg))
|
||||
{
|
||||
$code=$reg[1];
|
||||
@ -64,7 +66,7 @@ if (preg_match('/del_(.*)/',$action,$reg))
|
||||
$code=$reg[1];
|
||||
if (dolibarr_del_const($db, $code, 0) > 0)
|
||||
{
|
||||
Header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
@ -117,6 +119,21 @@ elseif ($action == 'update_currency')
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($action == 'synchronize')
|
||||
{
|
||||
$response = GETPOST('response');
|
||||
$response = json_decode($response);
|
||||
|
||||
if ($response->success)
|
||||
{
|
||||
MultiCurrency::syncRates($response);
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans('multicurrency_syncronize_error', $reponse->error->info), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$TCurrency = array();
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.$conf->entity;
|
||||
@ -136,7 +153,7 @@ if ($resql)
|
||||
* View
|
||||
*/
|
||||
|
||||
$page_name = "MultiCurrency";
|
||||
$page_name = "MultiCurrencySetup";
|
||||
|
||||
llxHeader('', $langs->trans($page_name));
|
||||
|
||||
@ -212,42 +229,72 @@ print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_MODIFY_RATE_APPLICATION">';
|
||||
print $form->selectarray('MULTICURRENCY_MODIFY_RATE_APPLICATION', array('PU_DOLIBARR' => 'PU_DOLIBARR', 'PU_CURRENCY' => 'PU_CURRENCY'));
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appId").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_CURRENCY_APP_ID">';
|
||||
print '<input type="text" name="CURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_currencyFromToRate").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_FROM_TO_RATE">';
|
||||
print '<input type="text" name="MULTICURRENCY_FROM_TO_RATE" value="'.$conf->global->MULTICURRENCY_FROM_TO_RATE.'" size="10" placeholder="USD-EUR-1" /> '; // CURRENCY_BASE - CURRENCY_ENTITY - ID_ENTITY
|
||||
print $form->selectarray('MULTICURRENCY_MODIFY_RATE_APPLICATION', array('PU_DOLIBARR' => 'PU_DOLIBARR', 'PU_CURRENCY' => 'PU_CURRENCY'), $conf->global->MULTICURRENCY_MODIFY_RATE_APPLICATION);
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br />';
|
||||
|
||||
$var=false;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("CurrencyLayerAccount").'</td>'."\n";
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="100">';
|
||||
print '<form id="form_sync" action="" method="POST">';
|
||||
print '<input type="hidden" name="action" value="synchronize" />';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print $langs->trans("Value").' <input type="button" id="bt_sync" class="button" onclick="javascript:getRates();" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a target="_blank" href="https://currencylayer.com">'.$langs->transnoentitiesnoconv("multicurrency_appId").'</a></td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_ID">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_ID" value="'.$conf->global->MULTICURRENCY_APP_ID.'" size="28" /> ';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
/* This property seems not used in code, so i comment it
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_APP_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_APP_SOURCE" value="'.$conf->global->MULTICURRENCY_APP_SOURCE.'" size="10" placeholder="USD" /> '; // Default: USD
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").'</td>';
|
||||
print '<td align="center" width="20"> </td>';
|
||||
print '<td align="right" width="400">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_MULTICURRENCY_ALTERNATE_SOURCE">';
|
||||
print '<input type="text" name="MULTICURRENCY_ALTERNATE_SOURCE" value="'.$conf->global->MULTICURRENCY_ALTERNATE_SOURCE.'" size="10" placeholder="EUR" /> '; // Example: EUR
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print '</table>';
|
||||
print '<br />';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -287,6 +334,26 @@ foreach ($TCurrency as &$currency)
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function getRates()
|
||||
{
|
||||
$("#bt_sync").attr("disabled", true);
|
||||
var url_sync = "http://apilayer.net/api/live?access_key='.$conf->global->MULTICURRENCY_APP_ID.'&format=1'.(!empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '&source='.$conf->global->MULTICURRENCY_APP_SOURCE : '').'";
|
||||
|
||||
$.ajax({
|
||||
url: url_sync,
|
||||
dataType: "jsonp"
|
||||
}).done(function(response) {
|
||||
$("#response").val(JSON.stringify(response));
|
||||
$("#form_sync").submit();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -114,9 +114,8 @@ llxHeader('',$langs->trans("Files"),$wikihelp);
|
||||
|
||||
print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
|
||||
|
||||
//print $langs->trans("FilesDesc")."<br>\n";
|
||||
//print "<br>\n";
|
||||
|
||||
print $langs->trans("SecurityFilesDesc")."<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
@ -40,7 +40,7 @@ $form = new Form($db);
|
||||
$title=$langs->trans("SystemToolsArea");
|
||||
if (GETPOST('leftmenu') == 'admintools') $title=$langs->trans("ModulesSystemTools");
|
||||
|
||||
llxHeader(array(),$title);
|
||||
llxHeader('', $title);
|
||||
|
||||
print load_fiche_titre($title,'','title_setup');
|
||||
|
||||
|
||||
@ -75,23 +75,23 @@ $tablib[1] = "Websites";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.shortname, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.entity, f.ref, f.description, f.status FROM ".MAIN_DB_PREFIX."website as f";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
$tabsqlsort[1] ="shortname ASC";
|
||||
$tabsqlsort[1] ="ref ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
$tabfield[1] = "shortname,description";
|
||||
$tabfield[1] = "ref,description";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
$tabfieldvalue[1] = "shortname,description";
|
||||
$tabfieldvalue[1] = "ref,description";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
$tabfieldinsert[1] = "shortname,description,entity";
|
||||
$tabfieldinsert[1] = "ref,description,entity";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
|
||||
@ -150,12 +150,30 @@ $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToM
|
||||
print load_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
|
||||
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
// Show message
|
||||
print '<br>';
|
||||
$message='';
|
||||
$url='<a href="'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword" target="_blank">'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword</a>';
|
||||
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
|
||||
$message.=img_picto('','object_globe.png').' '.$url;
|
||||
print $message;
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("ListOfAvailableAPIs").':<br>';
|
||||
foreach($listofapis['v1'] as $key => $val)
|
||||
{
|
||||
if ($key == 'login') continue;
|
||||
if ($key)
|
||||
{
|
||||
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n";
|
||||
$url=DOL_MAIN_URL_ROOT.'/api/index.php/'.$key;
|
||||
$url=$urlwithroot.'/api/index.php/'.$key;
|
||||
$url.='?api_key=token';
|
||||
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
||||
|
||||
}
|
||||
|
||||
@ -116,13 +116,13 @@ class DolibarrApiAccess implements iAuthenticate
|
||||
else
|
||||
{
|
||||
throw new RestException(401, "Failed to login to API. No parameter 'api_key' provided");
|
||||
//dol_syslog("Failed to login to API. No parameter key provided", LOG_DEBUG);
|
||||
//return false;
|
||||
}
|
||||
|
||||
$userClass::setCacheIdentifier(static::$role);
|
||||
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
|
||||
return in_array(static::$role, (array) static::$requires) || static::$role == 'admin';
|
||||
$userClass::setCacheIdentifier(static::$role);
|
||||
Resources::$accessControlFunction = 'DolibarrApiAccess::verifyAccess';
|
||||
$requirefortest = static::$requires;
|
||||
if (! is_array($requirefortest)) $requirefortest=explode(',',$requirefortest);
|
||||
return in_array(static::$role, (array) $requirefortest) || static::$role == 'admin';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -141,6 +141,8 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
// TODO If not found, redirect to explorer
|
||||
|
||||
|
||||
// Call API (we suppose we found it)
|
||||
$api->r->handle();
|
||||
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct'))
|
||||
{
|
||||
$producttmp->fetch(GETPOST('productid'));
|
||||
$forbarcode=$producttmp->barcode;
|
||||
$fk_barcode_type=$thirdpartytmp->barcode_type_code;
|
||||
$fk_barcode_type=$producttmp->barcode_type;
|
||||
|
||||
if (empty($fk_barcode_type) && ! empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE;
|
||||
|
||||
@ -384,7 +384,7 @@ print '</div>';
|
||||
print '<input id="fillfromthirdparty" type="radio" '.((GETPOST("selectorforbarcode")=='fillfromthirdparty')?'checked ':'').'name="selectorforbarcode" value="fillfromthirdparty" class="radiobarcodeselect"> '.$langs->trans("FillBarCodeTypeAndValueFromThirdParty").' ';
|
||||
print '<br>';
|
||||
print '<div class="showforthirdpartyselector">';
|
||||
print $form->select_company(GETPOST('socid'), 'socid', '', 1, 0, 0, array(), 0, 'minwidth300');
|
||||
print $form->select_company(GETPOST('socid'), 'socid', '', 'SelectThirdParty', 0, 0, array(), 0, 'minwidth300');
|
||||
print ' <input type="submit" id="submitthirdparty" name="submitthirdparty" class="button showforthirdpartyselector" value="'.(dol_escape_htmltag($langs->trans("GetBarCode"))).'">';
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
use Luracast\Restler\RestException;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
|
||||
/**
|
||||
* API class for category object
|
||||
@ -143,6 +144,88 @@ class CategoryApi extends DolibarrApi
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$category_static = new Categorie($db);
|
||||
if($category_static->fetch($obj->rowid)) {
|
||||
$obj_ret[] = parent::_cleanObjectDatas($category_static);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new RestException(503, 'Error when retrieve category list : '.$category_static->error);
|
||||
}
|
||||
if( ! count($obj_ret)) {
|
||||
throw new RestException(404, 'No category found');
|
||||
}
|
||||
return $obj_ret;
|
||||
}
|
||||
/**
|
||||
* List categories of an entity
|
||||
*
|
||||
* Get a list of categories
|
||||
*
|
||||
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact')
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param int $item Id of the item to get categories for
|
||||
* @return array Array of category objects
|
||||
*
|
||||
* @url GET /product/{item}/categories
|
||||
*/
|
||||
function getListForItem($type='product', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $item = 0) {
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->categorie->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
//if ($type == "") {
|
||||
//$type="product";
|
||||
//}
|
||||
$sub_type = $type;
|
||||
$subcol_name = "fk_".$type;
|
||||
if ($type=="customer" || $type=="supplier") {
|
||||
$sub_type="societe";
|
||||
$subcol_name="fk_soc";
|
||||
}
|
||||
$sql = "SELECT s.rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."categorie as s";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."categorie_".$sub_type." as sub ";
|
||||
$sql.= ' WHERE s.entity IN ('.getEntity('categorie', 1).')';
|
||||
$sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES);
|
||||
$sql.= ' AND s.rowid = sub.fk_categorie';
|
||||
$sql.= ' AND sub.'.$subcol_name.' = '.$item;
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
if ($limit) {
|
||||
if ($page < 0)
|
||||
{
|
||||
$page = 0;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -193,6 +276,56 @@ class CategoryApi extends DolibarrApi
|
||||
function getListCategoryCustomer($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
||||
return $this->getList('customer', $sortfield, $sortorder, $limit, $page);
|
||||
}
|
||||
/**
|
||||
* Get categories for a customer
|
||||
*
|
||||
* @param int $cusid Customer id filter
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @url GET /customer/{cusid}/categories
|
||||
*/
|
||||
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
||||
return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add category to customer
|
||||
*
|
||||
* @param int $cusid Id of customer
|
||||
* @param int $catid Id of category
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @url GET /customer/{cusid}/addCategory/{catid}
|
||||
*/
|
||||
function addCustomerCategory($cusid,$catid) {
|
||||
if(! DolibarrApiAccess::$user->rights->societe->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$customer = new Client($this->db);
|
||||
$customer->fetch($cusid);
|
||||
if( ! $customer ) {
|
||||
throw new RestException(404, 'customer not found');
|
||||
}
|
||||
$result = $this->category->fetch($catid);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'category not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('societe',$customer->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if( ! DolibarrApi::_checkAccessToResource('category',$this->category->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->category->add_type($customer,'customer');
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get supplier categories list
|
||||
|
||||
@ -1451,8 +1451,8 @@ class Categorie extends CommonObject
|
||||
|
||||
if (file_exists($originImage))
|
||||
{
|
||||
// Cree fichier en taille vignette
|
||||
$this->add_thumb($originImage);
|
||||
// Create thumbs
|
||||
$this->addThumbs($originImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1478,7 +1478,7 @@ class Categorie extends CommonObject
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle)) != false)
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
|
||||
{
|
||||
|
||||
@ -79,7 +79,7 @@ print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("Search").'</td>';
|
||||
print '</tr>';
|
||||
print '<tr '.$bc[0].'><td>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat" type="text" size="20" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
print $langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="'.$langs->trans("Search").'"></td></tr>';
|
||||
/*
|
||||
// faire une rech dans une sous categorie uniquement
|
||||
print '<tr '.$bc[0].'><td>';
|
||||
|
||||
@ -79,7 +79,7 @@ if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->
|
||||
|
||||
if ($action == 'addthumb' && $_GET["file"])
|
||||
{
|
||||
$object->add_thumb($upload_dir."/".$_GET["file"]);
|
||||
$object->addThumbs($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ if ($action == 'add')
|
||||
$db->begin();
|
||||
|
||||
// On cree l'action
|
||||
$idaction=$object->add($user);
|
||||
$idaction=$object->create($user);
|
||||
|
||||
if ($idaction > 0)
|
||||
{
|
||||
@ -649,14 +649,14 @@ if ($action == 'create')
|
||||
// Type of event
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
print '<tr><td width="30%"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
||||
print '<tr><td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans("Type").'</span></b></td><td>';
|
||||
$default=(empty($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT)?'':$conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT);
|
||||
$formactions->select_type_actions(GETPOST("actioncode")?GETPOST("actioncode"):($object->type_code?$object->type_code:$default), "actioncode", "systemauto", 0, -1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Title
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired titlefieldcreate"':'').'>'.$langs->trans("Title").'</td><td><input type="text" id="label" name="label" class="soixantepercent" value="'.GETPOST('label').'"></td></tr>';
|
||||
|
||||
// Full day
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td><input type="checkbox" id="fullday" name="fullday" '.(GETPOST('fullday')?' checked':'').'></td></tr>';
|
||||
@ -664,7 +664,7 @@ if ($action == 'create')
|
||||
// Date start
|
||||
$datep=($datep?$datep:$object->datep);
|
||||
if (GETPOST('datep','int',1)) $datep=dol_stringtotime(GETPOST('datep','int',1),0);
|
||||
print '<tr><td width="30%" class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td>';
|
||||
if (GETPOST("afaire") == 1) $form->select_date($datep,'ap',1,1,0,"action",1,1,0,0,'fulldayend');
|
||||
else if (GETPOST("afaire") == 2) $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldayend');
|
||||
else $form->select_date($datep,'ap',1,1,1,"action",1,1,0,0,'fulldaystart');
|
||||
@ -684,7 +684,7 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td width="10%">'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<tr><td>'.$langs->trans("Status").' / '.$langs->trans("Percentage").'</td>';
|
||||
print '<td>';
|
||||
$percent=-1;
|
||||
if (isset($_GET['status']) || isset($_POST['status'])) $percent=GETPOST('status');
|
||||
@ -743,7 +743,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Societe, contact
|
||||
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("ActionOnCompany").'</td><td>';
|
||||
if (GETPOST('socid','int') > 0)
|
||||
{
|
||||
$societe = new Societe($db);
|
||||
@ -834,7 +834,7 @@ if ($action == 'create')
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print "</form>";
|
||||
@ -937,7 +937,7 @@ if ($id > 0)
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
|
||||
|
||||
// Type of event
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
@ -951,7 +951,7 @@ if ($id > 0)
|
||||
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE)?' class="fieldrequired"':'').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" size="50" value="'.$object->label.'"></td></tr>';
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3"><input type="checkbox" id="fullday" name="fullday" '.($object->fulldayevent?' checked':'').'></td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td class="nowrap"><span class="fieldrequired">'.$langs->trans("DateActionStart").'</span></td><td colspan="3">';
|
||||
@ -1090,17 +1090,22 @@ if ($id > 0)
|
||||
// Thirdparty - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("ActionOnCompany").'</td>';
|
||||
print '<td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$events=array();
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
print $form->select_company($object->socid,'socid','',1,1,0,$events);
|
||||
print '</td>';
|
||||
$events[]=array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1',1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled'));
|
||||
print $form->select_company($object->socid, 'socid', '', 'SelectThirdParty', 1, 0, $events, 0);
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Contact
|
||||
print '<td>'.$langs->trans("Contact").'</td><td>';
|
||||
print '<tr><td>'.$langs->trans("Contact").'</td><td>';
|
||||
print '<div class="maxwidth200onsmartphone">';
|
||||
$form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
|
||||
print '</td></tr>';
|
||||
print '</div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
@ -1108,10 +1113,10 @@ if ($id > 0)
|
||||
{
|
||||
$formproject=new FormProjets($db);
|
||||
|
||||
$langs->load("project");
|
||||
$langs->load("projects");
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Project").'</td><td colspan="3">';
|
||||
$numprojet=$formproject->select_projects($object->socid, $object->fk_project, 'projectid');
|
||||
if ($numprojet==0)
|
||||
{
|
||||
print ' <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>';
|
||||
@ -1120,7 +1125,7 @@ if ($id > 0)
|
||||
}
|
||||
|
||||
// Priority
|
||||
print '<tr><td class="nowrap" width="30%">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefieldcreate nowrap">'.$langs->trans("Priority").'</td><td colspan="3">';
|
||||
print '<input type="text" name="priority" value="'.($object->priority?$object->priority:'').'" size="5">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1136,7 +1141,7 @@ if ($id > 0)
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
|
||||
// Editeur wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -1281,7 +1286,7 @@ if ($id > 0)
|
||||
// Third party - Contact
|
||||
if ($conf->societe->enabled)
|
||||
{
|
||||
print '<tr><td width="30%">'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
print '<tr><td>'.$langs->trans("ActionOnCompany").'</td><td>'.($object->thirdparty->id?$object->thirdparty->getNomUrl(1):$langs->trans("None"));
|
||||
if (is_object($object->thirdparty) && $object->thirdparty->id > 0 && $object->type_code == 'AC_TEL')
|
||||
{
|
||||
if ($object->thirdparty->fetch($object->thirdparty->id))
|
||||
|
||||
@ -173,7 +173,7 @@ class ActionComm extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
@ -189,7 +189,7 @@ class ActionComm extends CommonObject
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Id of created event, < 0 if KO
|
||||
*/
|
||||
function add($user,$notrigger=0)
|
||||
public function create(User $user, $notrigger = 0)
|
||||
{
|
||||
global $langs,$conf,$hookmanager;
|
||||
|
||||
@ -395,6 +395,20 @@ class ActionComm extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an action/event into database.
|
||||
* $this->type_id OR $this->type_code must be set.
|
||||
*
|
||||
* @param User $user Object user making action
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Id of created event, < 0 if KO
|
||||
* @deprecated Use create instead
|
||||
*/
|
||||
public function add(User $user, $notrigger = 0)
|
||||
{
|
||||
$this->create($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
@ -436,7 +450,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$result=$this->add($fuser);
|
||||
$result=$this->create($fuser);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -360,6 +360,7 @@ $showextcals=$listofextcals;
|
||||
|
||||
if (! empty($conf->use_javascript_ajax)) // If javascript on
|
||||
{
|
||||
$s.='<!-- Div to calendars selectors -->'."\n";
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.='jQuery("#check_birthday").click(function() { jQuery(".family_birthday").toggle(); });' . "\n";
|
||||
@ -373,7 +374,7 @@ if (! empty($conf->use_javascript_ajax)) // If javascript on
|
||||
$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").' </div>';
|
||||
$s.='<div class="nowrap clear float minheight20"><input type="checkbox" id="check_mytasks" name="check_mytasks" checked disabled> ' . $langs->trans("LocalAgenda").' </div>';
|
||||
|
||||
// External calendars
|
||||
if (is_array($showextcals) && count($showextcals) > 0)
|
||||
|
||||
@ -306,10 +306,11 @@ if ($resql)
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"c.libelle",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"a.datep",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("");
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
@ -329,9 +330,12 @@ if ($resql)
|
||||
print '<td class="liste_titre"></td>';
|
||||
//print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" 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>';
|
||||
print '<td></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$contactstatic = new Contact($db);
|
||||
@ -371,7 +375,7 @@ if ($resql)
|
||||
{
|
||||
$labeltype=$obj->type_code;
|
||||
if (! empty($arraylist[$labeltype])) $labeltype=$arraylist[$labeltype];
|
||||
print '<td>'.dol_trunc($labeltype,24).'</td>';
|
||||
print '<td>'.dol_trunc($labeltype,28).'</td>';
|
||||
}
|
||||
|
||||
// Start date
|
||||
@ -397,7 +401,7 @@ if ($resql)
|
||||
$societestatic->id=$obj->socid;
|
||||
$societestatic->client=$obj->client;
|
||||
$societestatic->name=$obj->societe;
|
||||
print $societestatic->getNomUrl(1,'',10);
|
||||
print $societestatic->getNomUrl(1,'',28);
|
||||
}
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
@ -409,7 +413,7 @@ if ($resql)
|
||||
$contactstatic->lastname=$obj->lastname;
|
||||
$contactstatic->firstname=$obj->firstname;
|
||||
$contactstatic->id=$obj->fk_contact;
|
||||
print $contactstatic->getNomUrl(1,'',10);
|
||||
print $contactstatic->getNomUrl(1,'',28);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -430,6 +434,8 @@ if ($resql)
|
||||
// Status/Percent
|
||||
print '<td align="right" class="nowrap">'.$actionstatic->LibStatut($obj->percent,6).'</td>';
|
||||
|
||||
print '<td></td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -420,7 +420,7 @@ if ($filtert > 0 || $usergroup > 0)
|
||||
$sql.= ' ORDER BY fk_user_action, datep'; //fk_user_action
|
||||
//print $sql;
|
||||
|
||||
dol_syslog("comm/action/index.php", LOG_DEBUG);
|
||||
dol_syslog("comm/action/peruser.php", LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -564,7 +564,7 @@ echo '</form>';
|
||||
//print "begin_d=".$begin_d." end_d=".$end_d;
|
||||
|
||||
|
||||
echo '<table width="100%" class="nocellnopadd cal_month">';
|
||||
echo '<table width="100%" class="noborder nocellnopadd cal_month">';
|
||||
|
||||
echo '<tr class="liste_titre">';
|
||||
echo '<td></td>';
|
||||
@ -703,7 +703,9 @@ foreach ($usernames as $username)
|
||||
{
|
||||
$var = ! $var;
|
||||
echo "<tr>";
|
||||
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">' . $username->getNomUrl(1). '</td>';
|
||||
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
|
||||
print $username->getNomUrl(-1,'',0,0,24,1,'');
|
||||
print '</td>';
|
||||
$tmpday = $sav;
|
||||
|
||||
// Lopp on each day of week
|
||||
|
||||
@ -112,7 +112,7 @@ if ($resql)
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_agenda', 0, '', '', $limit);
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -124,6 +124,14 @@ if (empty($reshook))
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id','int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
{
|
||||
@ -138,7 +146,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -147,7 +155,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -156,7 +164,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||
$result=$object->set_OutstandingBill($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
@ -239,8 +247,8 @@ if ($id > 0)
|
||||
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
||||
print ($object->prefix_comm?$object->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
print ($object->prefix_comm?$object->prefix_comm:' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
@ -431,6 +439,27 @@ if ($id > 0)
|
||||
print '</div></td></tr>';
|
||||
}
|
||||
|
||||
// Preferred shipping Method
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'shipping_method_id');
|
||||
}
|
||||
else
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->shipping_method_id,'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty( $conf->categorie->enabled ) && !empty( $user->rights->categorie->lire )) {
|
||||
print '<tr><td>' . $langs->trans( "Categories" ) . '</td>';
|
||||
@ -941,7 +970,7 @@ if ($id > 0)
|
||||
if (! empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status==1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status==1)
|
||||
|
||||
@ -87,6 +87,11 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$listofsearchfields['search_customer_order']=array('text'=>'CustomerOrder');
|
||||
}
|
||||
// Search supplier proposal
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
|
||||
}
|
||||
// Search supplier order
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
@ -100,12 +105,7 @@ if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
||||
// Search contract
|
||||
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
|
||||
{
|
||||
$listofsearchfields['search_contract']=array('text'=>'Contrat');
|
||||
}
|
||||
// Search supplier proposal
|
||||
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
|
||||
{
|
||||
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
|
||||
$listofsearchfields['search_contract']=array('text'=>'Contract');
|
||||
}
|
||||
|
||||
if (count($listofsearchfields))
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/comm/propal.php
|
||||
* \file htdocs/comm/propal/card.php
|
||||
* \ingroup propale
|
||||
* \brief Page of commercial proposals card and list
|
||||
*/
|
||||
require '../main.inc.php';
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formpropal.class.php';
|
||||
@ -911,6 +911,7 @@ if (empty($reshook))
|
||||
unset($_POST['type']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -1040,6 +1041,7 @@ if (empty($reshook))
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -1320,9 +1322,12 @@ if ($action == 'create')
|
||||
print $soc->getNomUrl(1);
|
||||
print '<input type="hidden" name="socid" value="' . $soc->id . '">';
|
||||
print '</td>';
|
||||
if (! empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && ! empty($soc->shipping_method_id)) {
|
||||
$shipping_method_id = $soc->shipping_method_id;
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="2">';
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 1);
|
||||
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty');
|
||||
// reload page to retrieve customer informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
|
||||
{
|
||||
@ -1462,7 +1467,7 @@ if ($action == 'create')
|
||||
print '<td>'.fieldLabel('Currency','multicurrency_code').'</td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
$currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code');
|
||||
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -1975,9 +1980,9 @@ if ($action == 'create')
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2057,7 +2062,7 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
@ -2421,10 +2426,7 @@ if ($action == 'create')
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='pro'.$object->id;
|
||||
}
|
||||
$formmail->trackid='pro'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
@ -247,16 +247,16 @@ class Propal extends CommonObject
|
||||
|
||||
$productdesc = $prod->description;
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$this->client,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->client,$prod->id);
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->client,$tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->client,$tva_npr);
|
||||
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr);
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level)
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
{
|
||||
$price = $prod->multiprices[$this->client->price_level];
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -547,7 +547,7 @@ class Propal extends CommonObject
|
||||
if (! empty($fk_parent_line)) $this->line_order(true,'DESC');
|
||||
|
||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||
$result=$this->update_price(1,'auto'); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
$result=$this->update_price(1,'auto',0,$mysoc); // This method is designed to add line from user input so total calculation must be done using 'auto' mode.
|
||||
if ($result > 0)
|
||||
{
|
||||
$this->db->commit();
|
||||
@ -1975,7 +1975,7 @@ class Propal extends CommonObject
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
@ -2037,9 +2037,10 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
global $user;
|
||||
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
return $this->classifyBilled();
|
||||
return $this->classifyBilled($user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2815,10 +2816,10 @@ class Propal extends CommonObject
|
||||
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
if ($option == '') {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'compta') { // deprecated
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id. $get_params .$linkclose;
|
||||
}
|
||||
if ($option == 'expedition') {
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id. $get_params .$linkclose;
|
||||
@ -2841,8 +2842,8 @@ class Propal extends CommonObject
|
||||
|
||||
/**
|
||||
* Retrieve an array of propal lines
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
{
|
||||
|
||||
@ -177,7 +177,7 @@ if ($object->id > 0)
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
|
||||
@ -59,7 +59,7 @@ $search_societe=GETPOST('search_societe','alpha');
|
||||
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||
$search_montant_vat=GETPOST('search_montant_vat','alpha');
|
||||
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
|
||||
$search_author=GETPOST('search_author','alpha');
|
||||
$search_login=GETPOST('search_login','alpha');
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
@ -90,9 +90,6 @@ if (! $sortorder) $sortorder='DESC';
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$contextpage='proposallist';
|
||||
|
||||
// Nombre de ligne pour choix de produit/service predefinis
|
||||
$NBLINES=4;
|
||||
|
||||
// Security check
|
||||
$module='propal';
|
||||
$dbtable='';
|
||||
@ -106,6 +103,7 @@ if (! empty($socid))
|
||||
}
|
||||
$result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
|
||||
$diroutputmassaction=$conf->propal->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('propallist'));
|
||||
@ -129,11 +127,11 @@ if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
|
||||
$checkedtypetiers=0;
|
||||
$arrayfields=array(
|
||||
'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
'p.ref_customer'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1),
|
||||
's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1),
|
||||
'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0),
|
||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||
'p.date'=>array('label'=>$langs->trans("Date"), 'checked'=>1),
|
||||
@ -160,6 +158,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -179,7 +179,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
$search_montant_ht='';
|
||||
$search_montant_vat='';
|
||||
$search_montant_ttc='';
|
||||
$search_author='';
|
||||
$search_login='';
|
||||
$search_product_category='';
|
||||
$search_town='';
|
||||
$search_zip="";
|
||||
@ -196,6 +196,25 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
||||
}
|
||||
if ($object_statut != '') $viewstatut=$object_statut;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Mass actions. Controls on number of lines checked
|
||||
$maxformassaction=1000;
|
||||
if (! empty($massaction) && count($toselect) < 1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NoLineChecked"), null, "warnings");
|
||||
}
|
||||
if (! $error && count($toselect) > $maxformassaction)
|
||||
{
|
||||
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -259,7 +278,7 @@ if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdp
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_author) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||
if ($search_login) $sql.= " AND u.login LIKE '%".$db->escape(trim($search_login))."%'";
|
||||
if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1);
|
||||
if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1);
|
||||
@ -297,7 +316,7 @@ foreach ($search_array_options as $key => $val)
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$typ=$extrafields->attribute_type[$tmpkey];
|
||||
$mode=0;
|
||||
if (in_array($typ, array('int'))) $mode=1; // Search on a numeric
|
||||
if (in_array($typ, array('int','double'))) $mode=1; // Search on a numeric
|
||||
if ($val && ( ($crit != '' && ! in_array($typ, array('select'))) || ! empty($crit)))
|
||||
{
|
||||
$sql .= natural_search('ef.'.$tmpkey, $crit, $mode);
|
||||
@ -344,7 +363,7 @@ if ($result)
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_author) $param.='&search_author='.$search_author;
|
||||
if ($search_login) $param.='&search_login='.$search_login;
|
||||
if ($search_town) $param.='&search_town='.$search_town;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
// Add $param from extra fields
|
||||
@ -355,6 +374,8 @@ if ($result)
|
||||
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
|
||||
//$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -417,20 +438,20 @@ if ($result)
|
||||
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.ref_customer']['checked'])) print_liste_field_titre($langs->trans('RefCustomer'),$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($langs->trans('Town'),$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($langs->trans('Zip'),$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($langs->trans("StateShort"),$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($langs->trans("Country"),$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($langs->trans("ThirdPartyType"),$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER["PHP_SELF"],'p.total_ttc','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($langs->trans('AmountVAT'),$_SERVER["PHP_SELF"],'p.total_vat','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'],$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'],$_SERVER["PHP_SELF"],'p.ref_client','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'],$_SERVER["PHP_SELF"],'p.datep','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'],$_SERVER["PHP_SELF"],'dfv','',$param, 'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'],$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'],$_SERVER["PHP_SELF"],'p.tva','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'],$_SERVER["PHP_SELF"],'p.total','',$param, 'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'],$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -447,9 +468,9 @@ if ($result)
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($langs->trans("DateCreationShort"),$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'],$_SERVER["PHP_SELF"],"p.fk_statut","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -460,7 +481,7 @@ if ($result)
|
||||
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.ref_customer']['checked']))
|
||||
if (! empty($arrayfields['p.ref_client']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
|
||||
@ -550,12 +571,15 @@ if ($result)
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$typeofextrafield=$extrafields->attribute_type[$key];
|
||||
print '<td class="liste_titre'.($align?' '.$align:'').'">';
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
print '<input class="flat" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')))
|
||||
{
|
||||
$crit=$val;
|
||||
$tmpkey=preg_replace('/search_options_/','',$key);
|
||||
$searchclass='';
|
||||
if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring';
|
||||
if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum';
|
||||
print '<input class="flat'.($searchclass?' '.$searchclass:'').'" size="4" type="text" name="search_options_'.$tmpkey.'" value="'.dol_escape_htmltag($search_array_options['search_options_'.$tmpkey]).'">';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
@ -584,20 +608,20 @@ if ($result)
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$now = dol_now();
|
||||
$i=0;
|
||||
$var=true;
|
||||
$totalarray=array();
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$now = dol_now();
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -635,7 +659,7 @@ if ($result)
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['p.ref_customer']['checked']))
|
||||
if (! empty($arrayfields['p.ref_client']['checked']))
|
||||
{
|
||||
// Customer ref
|
||||
print '<td class="nocellnopadd nowrap">';
|
||||
@ -646,11 +670,12 @@ if ($result)
|
||||
|
||||
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$obj->rowid;
|
||||
|
||||
// Company
|
||||
$companystatic->id=$obj->rowid;
|
||||
$companystatic->name=$obj->name;
|
||||
$companystatic->client=$obj->client;
|
||||
$companystatic->code_client=$obj->code_client;
|
||||
|
||||
// Thirdparty
|
||||
if (! empty($arrayfields['s.nom']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
@ -751,6 +776,7 @@ if ($result)
|
||||
|
||||
$userstatic->id=$obj->fk_user_author;
|
||||
$userstatic->login=$obj->login;
|
||||
|
||||
// Author
|
||||
if (! empty($arrayfields['u.login']['checked']))
|
||||
{
|
||||
|
||||
@ -99,10 +99,10 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
if ( is_null($object->client) )
|
||||
if ( is_null($object->thirdparty) )
|
||||
$object->fetch_thirdparty();
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Discounts
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
|
||||
@ -178,7 +178,7 @@ if (! $mesg)
|
||||
$px2->draw($filenameamount,$fileurlamount);
|
||||
}
|
||||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear, $filter);
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
$fileurl_avg='';
|
||||
if (!$user->rights->societe->client->voir || $user->societe_id)
|
||||
|
||||
@ -54,7 +54,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
if (! empty($conf->propal->enabled))
|
||||
{
|
||||
$var=false;
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal.php">';
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/card.php">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="noborder nohover" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
|
||||
@ -142,7 +142,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
$obj = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.'</a>';
|
||||
print '</td><td align="right">';
|
||||
print price($obj->price);
|
||||
print "</td></tr>";
|
||||
|
||||
@ -466,7 +466,7 @@ if (empty($reshook))
|
||||
|
||||
else if ($action == 'classifybilled' && $user->rights->commande->creer)
|
||||
{
|
||||
$ret=$object->classifyBilled();
|
||||
$ret=$object->classifyBilled($user);
|
||||
|
||||
if ($ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -833,6 +833,7 @@ if (empty($reshook))
|
||||
unset($_POST['type']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -963,6 +964,7 @@ if (empty($reshook))
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['remise_percent']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['multicurrency_price_ht']);
|
||||
unset($_POST['price_ttc']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['product_ref']);
|
||||
@ -1378,7 +1380,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
|
||||
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||
|
||||
$soc = $objectsrc->client;
|
||||
$soc = $objectsrc->thirdparty;
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
|
||||
@ -1953,7 +1955,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">' . $langs->trans('Ref') . '</td>';
|
||||
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print '</td>';
|
||||
@ -1993,7 +1995,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($action == 'editthirdparty') {
|
||||
$form->form_thirdparty($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, 'socid','client>0');
|
||||
} else {
|
||||
print ' ' . $soc->getNomUrl(1, 'compta');
|
||||
print $soc->getNomUrl(1, 'compta');
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
@ -2205,9 +2207,9 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="5">';
|
||||
if ($action == 'editmulticurrencyrate') {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'multicurrency_tx', $object->multicurrency_code);
|
||||
} else {
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none');
|
||||
$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -2585,12 +2587,8 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
// print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
// print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
// Documents
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
|
||||
$relativepath = $comref . '/' . $comref . '.pdf';
|
||||
@ -2609,14 +2607,12 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
// print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'order', $socid);
|
||||
|
||||
// print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
@ -2672,10 +2668,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$formmail->fromid = $user->id;
|
||||
$formmail->fromname = $user->getFullName($langs);
|
||||
$formmail->frommail = $user->email;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 1)) // If bit 1 is set
|
||||
{
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
}
|
||||
$formmail->trackid='ord'.$object->id;
|
||||
if (! empty($conf->global->MAIN_EMAIL_ADD_TRACK_ID) && ($conf->global->MAIN_EMAIL_ADD_TRACK_ID & 2)) // If bit 2 is set
|
||||
{
|
||||
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
@ -102,16 +102,17 @@ class CommandeApi extends DolibarrApi
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $societe Societe filter field
|
||||
*
|
||||
* @url GET /order/list
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
function getList($mode=0, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
|
||||
function getList($mode=0, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $societe = 0) {
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
|
||||
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : '';
|
||||
// case of external user, $societe param is ignored and replaced by user's socid
|
||||
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe;
|
||||
|
||||
// If the internal user must only see his customers, force searching by him
|
||||
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
|
||||
@ -178,6 +179,22 @@ class CommandeApi extends DolibarrApi
|
||||
}
|
||||
return $obj_ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* List orders for specific thirdparty
|
||||
*
|
||||
* Get a list of orders
|
||||
*
|
||||
* @param int $socid Id of customer
|
||||
*
|
||||
* @url GET /customer/{socid}/order/list
|
||||
* @url GET /thirdparty/{socid}/order/list
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
function getListForSoc($socid = 0) {
|
||||
return getList(0,"s.rowid","ASC",0,0,$socid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create order object
|
||||
@ -190,24 +207,208 @@ class CommandeApi extends DolibarrApi
|
||||
*/
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
if (isset($request_data["lines"])) {
|
||||
$lines = array();
|
||||
foreach ($request_data["lines"] as $line) {
|
||||
array_push($lines, (object) $line);
|
||||
}
|
||||
$this->commande->lines = $lines;
|
||||
}
|
||||
if(! $this->commande->create(DolibarrApiAccess::$user) ) {
|
||||
throw new RestException(401);
|
||||
throw new RestException(500, "Error while creating order");
|
||||
}
|
||||
|
||||
return $this->commande->ref;
|
||||
return $this->commande->id;
|
||||
}
|
||||
/**
|
||||
* Get lines of an order
|
||||
*
|
||||
*
|
||||
* @param int $id Id of order
|
||||
*
|
||||
* @url GET order/{id}/line/list
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getLines($id) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commande not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->commande->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->commande->lines as $line) {
|
||||
array_push($result,$this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Add a line to given order
|
||||
*
|
||||
*
|
||||
* @param int $id Id of commande to update
|
||||
* @param array $request_data Orderline data
|
||||
*
|
||||
* @url POST order/{id}/line
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function postLine($id, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commande not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->commande->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
$request_data->info_bits,
|
||||
$request_data->fk_remise_except,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$this->element,
|
||||
$request_data->id
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
return $this->get($id)->line->rowid;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Update a line to given order
|
||||
*
|
||||
*
|
||||
* @param int $id Id of commande to update
|
||||
* @param int $lineid Id of line to update
|
||||
* @param array $request_data Orderline data
|
||||
*
|
||||
* @url PUT order/{id}/line/{lineid}
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
function putLine($id, $lineid, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commande not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->commande->updateline(
|
||||
$lineid,
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->remise_percent,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
'HT',
|
||||
$request_data->info_bits,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->product_type,
|
||||
$request_data->fk_parent_line,
|
||||
0,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->special_code,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Delete a line to given order
|
||||
*
|
||||
*
|
||||
* @param int $id Id of commande to update
|
||||
* @param int $lineid Id of line to delete
|
||||
*
|
||||
* @url DELETE order/{id}/line/{lineid}
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function delLine($id, $lineid) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Commande not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->commande->deleteline($lineid);
|
||||
if ($updateRes == 1) {
|
||||
return $this->get($id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update order
|
||||
* Update order general fields (won't touch lines of order)
|
||||
*
|
||||
* @param int $id Id of commande to update
|
||||
* @param array $request_data Datas
|
||||
@ -216,11 +417,10 @@ class CommandeApi extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function put($id, $request_data = NULL)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
function put($id, $request_data = NULL) {
|
||||
if(! DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
if( ! $result ) {
|
||||
@ -230,13 +430,12 @@ class CommandeApi extends DolibarrApi
|
||||
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
foreach($request_data as $field => $value) {
|
||||
$this->commande->$field = $value;
|
||||
}
|
||||
|
||||
if($this->commande->update($id, DolibarrApiAccess::$user,1,'','','update'))
|
||||
return $this->get ($id);
|
||||
return $this->get($id);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -329,6 +528,7 @@ class CommandeApi extends DolibarrApi
|
||||
if (!isset($data[$field]))
|
||||
throw new RestException(400, "$field field missing");
|
||||
$commande[$field] = $data[$field];
|
||||
|
||||
}
|
||||
return $commande;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -1010,6 +1011,7 @@ class Commande extends CommonOrder
|
||||
$this->user_author_id = $user->id;
|
||||
$this->user_valid = '';
|
||||
$this->date = dol_now();
|
||||
$this->date_commande = dol_now();
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
@ -1281,6 +1283,7 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -1420,15 +1423,16 @@ class Commande extends CommonOrder
|
||||
$prod=new Product($this->db);
|
||||
$prod->fetch($idproduct);
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$this->client,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->client,$prod->id);
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->client,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->client,$mysoc,$tva_npr);
|
||||
|
||||
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr);
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level)
|
||||
$price = $prod->multiprices[$this->client->price_level];
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
else
|
||||
$price = $prod->price;
|
||||
|
||||
@ -1844,13 +1848,13 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||
*
|
||||
* Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order
|
||||
*
|
||||
* @param int $filtre_statut Filter on status
|
||||
* @param int $fk_product Filter on a product
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*
|
||||
* TODO deprecate, move to Shipping class
|
||||
*/
|
||||
function loadExpeditions($filtre_statut=-1)
|
||||
function loadExpeditions($filtre_statut=-1, $fk_product=0)
|
||||
{
|
||||
$this->expeditions = array();
|
||||
|
||||
@ -1863,6 +1867,7 @@ class Commande extends CommonOrder
|
||||
if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND';
|
||||
$sql.= ' ed.fk_origin_line = cd.rowid';
|
||||
$sql.= ' AND cd.fk_commande =' .$this->id;
|
||||
if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product;
|
||||
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut;
|
||||
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
|
||||
//print $sql;
|
||||
@ -2420,9 +2425,10 @@ class Commande extends CommonOrder
|
||||
/**
|
||||
* Classify the order as invoiced
|
||||
*
|
||||
* @return int <0 if ko, >0 if ok
|
||||
* @param User $user Object user making the change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function classifyBilled()
|
||||
function classifyBilled(User $user)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
@ -2476,9 +2482,10 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function classer_facturee()
|
||||
{
|
||||
global $user;
|
||||
dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING);
|
||||
|
||||
return $this->classifyBilled();
|
||||
return $this->classifyBilled($user);
|
||||
}
|
||||
|
||||
|
||||
@ -2510,7 +2517,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
global $conf, $mysoc, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -2546,6 +2553,7 @@ class Commande extends CommonOrder
|
||||
$txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate.
|
||||
|
||||
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx);
|
||||
|
||||
$total_ht = $tabprice[0];
|
||||
$total_tva = $tabprice[1];
|
||||
$total_ttc = $tabprice[2];
|
||||
@ -2578,6 +2586,26 @@ class Commande extends CommonOrder
|
||||
$line = new OrderLine($this->db);
|
||||
$line->fetch($rowid);
|
||||
|
||||
if (!empty($line->fk_product))
|
||||
{
|
||||
$product=new Product($this->db);
|
||||
$result=$product->fetch($line->fk_product);
|
||||
$product_type=$product->type;
|
||||
|
||||
if (! empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER) && $product_type == 0 && $product->stock_reel < $qty)
|
||||
{
|
||||
$this->error=$langs->trans('ErrorStockIsNotEnough');
|
||||
dol_syslog(get_class($this)."::addline error=Product ".$product->ref.": ".$this->error, LOG_ERR);
|
||||
$this->db->rollback();
|
||||
unset($_POST['productid']);
|
||||
unset($_POST['tva_tx']);
|
||||
unset($_POST['price_ht']);
|
||||
unset($_POST['qty']);
|
||||
unset($_POST['buying_price']);
|
||||
return self::STOCK_NOT_ENOUGH_FOR_ORDER;
|
||||
}
|
||||
}
|
||||
|
||||
$staticline = clone $line;
|
||||
|
||||
$line->oldline = $staticline;
|
||||
@ -2999,7 +3027,7 @@ class Commande extends CommonOrder
|
||||
function LibStatut($statut,$billed,$mode,$donotshowbilled=0)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed?' - '.$langs->trans("Billed"):'');
|
||||
|
||||
@ -3301,86 +3329,6 @@ class Commande extends CommonOrder
|
||||
function getLinesArray()
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
/*
|
||||
$lines = array();
|
||||
|
||||
$sql = 'SELECT l.rowid, l.fk_product, l.product_type, l.label as custom_label, l.description, l.price, l.qty, l.tva_tx, ';
|
||||
$sql.= ' l.fk_remise_except, l.remise_percent, l.subprice, l.info_bits, l.rang, l.special_code, l.fk_parent_line,';
|
||||
$sql.= ' l.total_ht, l.total_tva, l.total_ttc, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.localtax1_tx, l.localtax2_tx,';
|
||||
$sql.= ' l.date_start, l.date_end,';
|
||||
$sql.= ' l.fk_unit,';
|
||||
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, ';
|
||||
$sql.= ' p.description as product_desc, p.stock as stock_reel,';
|
||||
$sql.= ' p.entity';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commandedet as l';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product=p.rowid';
|
||||
$sql.= ' WHERE l.fk_commande = '.$this->id;
|
||||
$sql.= ' ORDER BY l.rang ASC, l.rowid';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->lines[$i] = new OrderLine($this->db);
|
||||
$this->lines[$i]->id = $obj->rowid;
|
||||
$this->lines[$i]->label = $obj->custom_label;
|
||||
$this->lines[$i]->description = $obj->description;
|
||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||
$this->lines[$i]->ref = $obj->ref;
|
||||
$this->lines[$i]->entity = $obj->entity; // Product entity
|
||||
$this->lines[$i]->product_label = $obj->product_label;
|
||||
$this->lines[$i]->product_desc = $obj->product_desc;
|
||||
$this->lines[$i]->fk_product_type = $obj->fk_product_type;
|
||||
$this->lines[$i]->product_type = $obj->product_type;
|
||||
$this->lines[$i]->qty = $obj->qty;
|
||||
$this->lines[$i]->subprice = $obj->subprice;
|
||||
$this->lines[$i]->fk_remise_except = $obj->fk_remise_except;
|
||||
$this->lines[$i]->remise_percent = $obj->remise_percent;
|
||||
$this->lines[$i]->tva_tx = $obj->tva_tx;
|
||||
$this->lines[$i]->info_bits = $obj->info_bits;
|
||||
$this->lines[$i]->total_ht = $obj->total_ht;
|
||||
$this->lines[$i]->total_tva = $obj->total_tva;
|
||||
$this->lines[$i]->total_ttc = $obj->total_ttc;
|
||||
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
|
||||
$this->lines[$i]->special_code = $obj->special_code;
|
||||
$this->lines[$i]->stock = $obj->stock_reel;
|
||||
$this->lines[$i]->rang = $obj->rang;
|
||||
$this->lines[$i]->date_start = $this->db->jdate($obj->date_start);
|
||||
$this->lines[$i]->date_end = $this->db->jdate($obj->date_end);
|
||||
$this->lines[$i]->fk_fournprice = $obj->fk_fournprice;
|
||||
$marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht);
|
||||
$this->lines[$i]->pa_ht = $marginInfos[0];
|
||||
$this->lines[$i]->marge_tx = $marginInfos[1];
|
||||
$this->lines[$i]->marque_tx = $marginInfos[2];
|
||||
$this->lines[$i]->fk_unit = $obj->fk_unit;
|
||||
|
||||
// Multicurrency
|
||||
$this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency;
|
||||
$this->lines[$i]->multicurrency_code = $obj->multicurrency_code;
|
||||
$this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice;
|
||||
$this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht;
|
||||
$this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva;
|
||||
$this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -155,7 +155,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="18%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
|
||||
print "</td></tr>";
|
||||
|
||||
@ -171,10 +171,10 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
if (is_null($object->client)) $object->fetch_thirdparty();
|
||||
if (is_null($object->thirdparty)) $object->fetch_thirdparty();
|
||||
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
|
||||
@ -220,7 +220,7 @@ if (($action == 'create' || $action == 'add') && !$error)
|
||||
{
|
||||
if ($closeOrders)
|
||||
{
|
||||
$objectsrc->classifyBilled();
|
||||
$objectsrc->classifyBilled($user);
|
||||
$objectsrc->setStatut(3);
|
||||
}
|
||||
$lines = $objectsrc->lines;
|
||||
|
||||
@ -3,8 +3,9 @@
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@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,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.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/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
@ -276,7 +277,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
|
||||
|
||||
// Label
|
||||
@ -360,7 +361,7 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Sold
|
||||
print '<tr><td width="25%">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("Date").'</td>';
|
||||
@ -382,70 +383,33 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
$bickey="BICNumber";
|
||||
@ -482,14 +446,14 @@ if ($action == 'create')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
@ -497,14 +461,14 @@ if ($action == 'create')
|
||||
{
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td>';
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number', 'alpha'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
}
|
||||
@ -566,7 +530,7 @@ else
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
|
||||
print '</td></tr>';
|
||||
@ -646,68 +610,24 @@ else
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<tr><td valign="top" class="titlefield">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td colspan="3">'.$content.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
@ -754,8 +674,14 @@ else
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
print '<tr><td width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">'.length_accountg($account->account_number).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3">';
|
||||
if (! empty($conf->accounting->enabled)) {
|
||||
print length_accountg($account->account_number).'</td></tr>';
|
||||
} else {
|
||||
print $account->account_number;
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
@ -831,7 +757,7 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td class="fieldrequired titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.(isset($_POST["ref"])?$_POST["ref"]:$account->ref).'"></td></tr>';
|
||||
|
||||
// Label
|
||||
@ -932,70 +858,33 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
foreach ($account->getFieldsToShow() as $val) {
|
||||
if ($val == 'BankCode') {
|
||||
$name = 'code_banque';
|
||||
$size = 8;
|
||||
$content = $account->code_banque;
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$name = 'code_guichet';
|
||||
$size = 8;
|
||||
$content = $account->code_guichet;
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$name = 'number';
|
||||
$size = 18;
|
||||
$content = $account->number;
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$name = 'cle_rib';
|
||||
$size = 3;
|
||||
$content = $account->cle_rib;
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<tr><td>'.$langs->trans($val).'</td>';
|
||||
print '<td><input size="'.$size.'" type="text" class="flat" name="'.$name.'" value="'.$content.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$ibankey = FormBank::getIBANLabel($account);
|
||||
@ -1030,14 +919,14 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Accountancy code
|
||||
$tdextra = '';
|
||||
$tdextra = ' class="titlefieldcreate"';
|
||||
|
||||
if (!empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED)) {
|
||||
$tdextra = ' class="fieldrequired"';
|
||||
$tdextra = ' class="fieldrequired titlefieldcreate"';
|
||||
}
|
||||
|
||||
print '<tr><td'.$tdextra.'>'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"'.$tdextra.'>';
|
||||
print '<td colspan="3">';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
print $formaccountancy->select_account($account->account_number, 'account_number', 1, '', 1, 1);
|
||||
} else {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* 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
|
||||
@ -238,6 +239,31 @@ class Account extends CommonObject
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the account number in the appropiate format
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$string = '';
|
||||
|
||||
foreach ($this->getFieldsToShow() as $val) {
|
||||
|
||||
if ($val == 'BankCode') {
|
||||
$string .= $this->code_banque.' ';
|
||||
} elseif ($val == 'BankAccountNumber') {
|
||||
$string .= $this->number.' ';
|
||||
} elseif ($val == 'DeskCode') {
|
||||
$string .= $this->code_guichet.' ';
|
||||
} elseif ($val == 'BankAccountNumberKey') {
|
||||
$string .= $this->cle_rib.' ';
|
||||
}
|
||||
}
|
||||
|
||||
return trim($string);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if a bank account need to be conciliated
|
||||
@ -563,7 +589,7 @@ class Account extends CommonObject
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_account");
|
||||
|
||||
$result=$this->update();
|
||||
$result=$this->update($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$accline = new AccountLine($this->db);
|
||||
@ -1075,15 +1101,19 @@ class Account extends CommonObject
|
||||
*/
|
||||
public static function countAccountToReconcile()
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
|
||||
if ($user->societe_id) return 0; // protection pour eviter appel par utilisateur externe
|
||||
global $db, $conf, $user;
|
||||
|
||||
//Protection against external users
|
||||
if ($user->societe_id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$nb=0;
|
||||
|
||||
$sql = "SELECT COUNT(ba.rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= " WHERE ba.rappro > 0 and ba.clos = 0";
|
||||
$sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")";
|
||||
if (empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) $sql.= " AND ba.courant != 2";
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -1230,6 +1260,83 @@ class Account extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the fields in order that this bank account should show to the user
|
||||
* Will return an array with the following values:
|
||||
* - BankAccountNumber
|
||||
* - BankCode
|
||||
* - BankAccountNumberKey
|
||||
* - DeskCode
|
||||
*
|
||||
* Some countries show less or more bank account properties to the user
|
||||
*
|
||||
* @return array
|
||||
* @see useDetailedBBAN
|
||||
*/
|
||||
public function getFieldsToShow()
|
||||
{
|
||||
//Get the required properties depending on the country
|
||||
$detailedBBAN = $this->useDetailedBBAN();
|
||||
|
||||
if ($detailedBBAN == 0) {
|
||||
return array(
|
||||
'BankAccountNumber'
|
||||
);
|
||||
} elseif ($detailedBBAN == 2) {
|
||||
return array(
|
||||
'BankCode',
|
||||
'BankAccountNumber'
|
||||
);
|
||||
}
|
||||
|
||||
//Get the order the properties are shown
|
||||
return self::getAccountNumberOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the components of the bank account in order.
|
||||
* Will return an array with the following values:
|
||||
* - BankAccountNumber
|
||||
* - BankCode
|
||||
* - BankAccountNumberKey
|
||||
* - DeskCode
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getAccountNumberOrder()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$fieldlists = array(
|
||||
'BankCode',
|
||||
'DeskCode',
|
||||
'BankAccountNumber',
|
||||
'BankAccountNumberKey'
|
||||
);
|
||||
|
||||
if (!empty($conf->global->BANK_SHOW_ORDER_OPTION)) {
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION)) {
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') {
|
||||
$fieldlists = array(
|
||||
'BankCode',
|
||||
'DeskCode',
|
||||
'BankAccountNumberKey',
|
||||
'BankAccountNumber'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
//Replace the old AccountNumber key with the new BankAccountNumber key
|
||||
$fieldlists = explode(
|
||||
' ',
|
||||
preg_replace('/ ?[^Bank]AccountNumber ?/', 'BankAccountNumber',
|
||||
$conf->global->BANK_SHOW_ORDER_OPTION)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $fieldlists;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
|
||||
@ -92,18 +92,10 @@ if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
$upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']),
|
||||
0, 0, $_FILES['userfile']['error']);
|
||||
if (is_numeric($resupload) && $resupload > 0) {
|
||||
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name'])
|
||||
== 1) {
|
||||
// Create small thumbs for image (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($upload_dir . "/" . $_FILES['userfile']['name'],
|
||||
$maxwidthsmall, $maxheightsmall, '_small', $quality,
|
||||
"thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($upload_dir . "/" . $_FILES['userfile']['name'],
|
||||
$maxwidthmini, $maxheightmini, '_mini', $quality,
|
||||
"thumbs");
|
||||
if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1)
|
||||
{
|
||||
// Create thumbs
|
||||
$object->addThumbs($upload_dir . "/" . $_FILES['userfile']['name']);
|
||||
}
|
||||
$mesg = '<div class="ok">' . $langs->trans("FileTransferComplete") . '</div>';
|
||||
}
|
||||
@ -172,14 +164,14 @@ if ($id > 0 || !empty($ref)) {
|
||||
$totalsize+=$file['size'];
|
||||
}
|
||||
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print '<table class="border"width="100%">';
|
||||
|
||||
// Ref
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">' . $langs->trans("Ref") . '</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($object, 'ref', '', 1, 'ref');
|
||||
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
|
||||
@ -143,7 +143,7 @@ $now=dol_now();
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type as type";
|
||||
$sql.= ", b.fk_bordereau";
|
||||
$sql.= ", bc.number";
|
||||
$sql.= ", bc.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bordereau_cheque as bc ON bc.rowid=b.fk_bordereau';
|
||||
$sql.= " WHERE rappro=0 AND fk_account=".$acct->id;
|
||||
|
||||
@ -325,7 +325,7 @@ else
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
|
||||
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
|
||||
$sql.= " b.fk_bordereau,";
|
||||
$sql.= " bc.number,";
|
||||
$sql.= " bc.ref,";
|
||||
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
|
||||
@ -376,7 +376,7 @@ else
|
||||
$link='';
|
||||
if ($objp->fk_bordereau>0) {
|
||||
$remisestatic->id = $objp->fk_bordereau;
|
||||
$remisestatic->ref = $objp->number;
|
||||
$remisestatic->ref = $objp->ref;
|
||||
$link = ' '.$remisestatic->getNomUrl(1);
|
||||
}
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.'</td>';
|
||||
|
||||
@ -223,7 +223,7 @@ if ($resql)
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8);
|
||||
$form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" name="req_nb" value="'.dol_escape_htmltag($search_req_nb).'" size="2"></td>';
|
||||
print '<td class="liste_titre">';
|
||||
|
||||