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

This commit is contained in:
fappels
2016-03-14 16:19:49 +01:00
871 changed files with 5950 additions and 4148 deletions

119
ChangeLog
View File

@@ -12,6 +12,22 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade.
***** ChangeLog for 4.0 compared to 3.9.* *****
For users:
For developers:
WARNING:
Dolibarr 4.0 should be compatible with PHP 7 but more feedbacks are still expected to confirm that.
Following changes may create regression for some external modules, but were necessary to make
Dolibarr better:
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
***** ChangeLog for 3.9.0 compared to 3.8.* *****
For users:
NEW: A new and more modern look for "eldy" theme.
@@ -171,6 +187,109 @@ This is list of hooks modified:
***** ChangeLog for 3.8.4 compared to 3.8.3 *****
FIX: #3694
FIX: #3798 #2519 Cron jobs would never be executed
FIX: #4155 Search Categories error
FIX: #4239
FIX: #4272 Error when trying to print the page "Linked objects" of a Thirdparty
FIX: #4291 Correctly filter bank card GETPOSTs
FIX: #4291 Correctly filter external calendar GETPOSTs
FIX: #4341
FIX: #4394 Untranslated label in list of expense reports
FIX: #4414 Supplier invoices use FAC_FORCE_DATE_VALIDATION client invoices property
FIX: #4418
FIX: #4425 Missing "VAT" translation in supplier order popup
FIX: #4434 Weird behaviour when enabling multiprices
FIX: #4440 Wrong price is filled by Product::fetch into multiprices arrays
FIX: #4453 SEPA Direct Debit generated XML shows a trailing comma in RmtInf field
FIX: #4528
FIX: #4556 desiredstock and seuil_stock_alerte cleared on modify product card
FIX: #4580
FIX: #4583 Incorrect call of Categories::containing throws a DoliDB error
FIX: #4649 Wrong parameters order
FIX: #4768
FIX: #4785
FIX: Add a test to show bugged module with a bad declaration of dictionaries to avoid to see clean module to be breaked.
FIX: add Croatia into list of country in EEC
FIX: add missing global def for ttc column
FIX: ajax error with multicompany module
FIX: Avoid errors when batch stock is negative
FIX: bad field in select
FIX: bad path
FIX: bad transaction level due to code of situation invoices
FIX: best sql request
FIX: bookmark's user change after update if the user hasn't superadmin right
FIX: call trigger LINEBILL_SUPPLIER_CREATE
FIX: Can not disabled an opened service line in a contract
FIX: can't clone event
FIX: can't send mail to thirdparty contact if no mail defined on thirdparty card
FIX: Check stock of batch on shippment
FIX: code corrupting database
FIX: compatibility with multicompany transversal mode
FIX: compatibility with multicompany transversal mode and more security issue
FIX: Contrat card don't consider user permissions to show active/unactive service button
FIX: CVE CVE-2015-8685
FIX: Deadlock situation. Can't edit anymore contract. FIX: List of automatic events was not visible.
FIX: disable main.inc.php hooks
FIX: do not show warning if account defined
FIX: don't see the sales representative of anothers entities
FIX: duration format
FIX: Correct problem of rights beetween tax and salaries module
FIX: Email templates not compatible with Multicompany
FIX: $fileparams is not defined
FIX: filter by socid if from customer card
FIX: for avoid conflict with "global $m" in memory.lib.php
FIX: for avoid division by 0
FIX: hover css
FIX: If option to hide automatic ECM is on, dont show menu.
FIX: if we dont use SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE the hour is displayed on pdf
FIX: Introduce hidden option to disable feature than hangs when too much data
FIX: ISSUE #4506 : make working the PROPAL_CLONE_ON_CREATE_PAGE hidden constant
FIX: issue when bank module is disabled FIX: missing entity filter for lines of payment
FIX: list of leave request was not showing label correctly.
FIX: MAIN_THIRDPARTY_CREATION_INDIVIDUAL syntax error in name
FIX: markRate can be 100
FIX: minor css error (pixel size must have "px"). Compatibility with old behaviour.
FIX: missing field "label"
FIX: missing signature and uniformize code between card and script
FIX: missing traduction
FIX: missing translation
FIX: missing translation key
FIX: nblignes not calculated after hook and hook can't modify this value. Usefull for modules
FIX: no database structure change is allowed into minor versions
FIX: no transaction in this place
FIX: Noway to validate a leave request for some uer even if they have permission for.
FIX: Option to disable meteo was not set correctly in edit mode
FIX: $outputlangs is not defined (dolibarr 3.7, 3.8, 3.9)
FIX: path to copyrighted files
FIX: php unit to work both with old and new setup
FIX: Purge of temp files was broken
FIX: Relative discount decimals are not saved
FIX: Removed a bugged list. Fixed another one to not count data of previous year.
FIX: retrieve correct pu_ttc (set by printObjectLine function) like in 3.7
FIX: search product in customer product prices doesn't work
FIX: Some filters are lost when paging
FIX: sql injection #4341
FIX: sql injection even when code is on several lines
FIX: sql request and total for time spen for current month
FIX: Sql syntax error in doc_generic_task_odt
FIX: Status filter don't work
FIX: Strict Standards: Only variables should be passed by reference
FIX: The part added with hidden option MAIN_DOC_USE_TIMING was included with a . instead of -. This make os think it is part of extension instead of file name.
FIX: The third dashboard don't consider user permissions
FIX: the view my task must show only task you are assigned to
FIX: to allow phpunit of migration process for 3.4 to 3.5
FIX: to allow phpunit of migration process for 3.5 to 3.6
FIX: userlocaltax
FIX: view of product image when using old path
FIX: size of image uploaded on user.
FIX: We must ue the "small" size of imge to show on card pages.
FIX: When we make a direct assignement on a task to a user, we must check he is also assigned to project (and if not assign it)
FIX: wrong fk_parent_line in credit note with invoiceAvoirWithLines option
FIX: wrong modelpdf var name
FIX: wrong object name
***** ChangeLog for 3.8.3 compared to 3.8.2 *****
FIX: #3805
FIX: #3231 [Members] Public subscription page displays GeoIP error

View File

@@ -1108,6 +1108,14 @@ if ($nboftargetok) {
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
"$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM'
);
%filestoscanstableasso=(
"$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',
"$DESTI/standard/$FILENAMETGZ.zip"=>'standard'
);
use POSIX qw/strftime/;
foreach my $file (sort keys %filestoscansf)
{
@@ -1150,8 +1158,10 @@ if ($nboftargetok) {
if ($target eq 'SF') {
$destFolder="$NEWPUBLISH/$filestoscan{$file}/".$MAJOR.'.'.$MINOR.'.'.$BUILD;
print "Publish file ".$file." to $NEWPUBLISH/".$filestoscan{$file}."/".$MAJOR.'.'.$MINOR.'.'.$BUILD."\n";
}
elsif ($target eq 'ASSO' && $NEWPUBLISH =~ /stable/) {
$destFolder="$NEWPUBLISH/$filestoscanstableasso{$file}";
}
else
{
$dirnameonly=$file;
@@ -1159,8 +1169,8 @@ if ($nboftargetok) {
$filenameonly=$file;
$filenameonly =~ s/.*\/[^\/]+\/([^\/])+$/$1/;
$destFolder="$NEWPUBLISH/$dirnameonly";
print "Publish file ".$file." to $NEWPUBLISH/".$dirnameonly."\n";
}
print "Publish file ".$file." to ".$destFolder."\n";
# mkdir
#my $ssh = Net::SSH::Perl->new("frs.sourceforge.net");

View File

@@ -90,7 +90,7 @@ $result=0;
while ($i < GEN_NUMBER_FACTURE && $result >= 0)
{
$i++;
$socid = rand(1, $num_socs);
$socid = mt_rand(1, $num_socs);
print "Invoice ".$i." for socid ".$socid;
@@ -105,14 +105,14 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
$result=$facture->validate($user);
if ($result)
{
$nbp = rand(2, 5);
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$facture->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
$result=$facture->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
if ($result < 0)
{
dol_print_error($db,$propal->error);

View File

@@ -165,7 +165,7 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$com = new Commande($db);
$com->socid = 4;
$com->date_commande = $dates[rand(1, count($dates)-1)];
$com->date_commande = $dates[mt_rand(1, count($dates)-1)];
$com->note = 'A comment';
$com->source = 1;
$com->fk_project = 0;
@@ -179,14 +179,14 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++)
$result=$com->valid($user);
if ($result > 0)
{
$nbp = rand(2, 5);
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$com->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
$result=$com->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0, 0, 0, $product->price_base_type, $product->price_ttc, '', '', $product->type);
if ($result < 0)
{
dol_print_error($db,$propal->error);

View File

@@ -85,12 +85,12 @@ for ($s = 0 ; $s < GEN_NUMBER_PRODUIT ; $s++)
{
print "Product ".$s;
$produit = new Product($db);
$produit->type = rand(0,1);
$produit->type = mt_rand(0,1);
$produit->status = 1;
$produit->ref = ($produit->type?'S':'P').time().$s;
$produit->label = 'Label '.time().$s;
$produit->description = 'Description '.time().$s;
$produit->price = rand(1,1000);
$produit->price = mt_rand(1,1000);
$produit->tva_tx = "19.6";
$ret=$produit->create($user);
if ($ret < 0) print "Error $ret - ".$produit->error."\n";

View File

@@ -117,7 +117,7 @@ $result=0;
while ($i < GEN_NUMBER_PROPAL && $result >= 0)
{
$i++;
$socid = rand(1, $num_socs);
$socid = mt_rand(1, $num_socs);
print "Proposal ".$i." for socid ".$socid;
$soc = new Societe($db);
@@ -140,14 +140,14 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
$result=$propal->create($user);
if ($result >= 0)
{
$nbp = rand(2, 5);
$nbp = mt_rand(2, 5);
$xnbp = 0;
while ($xnbp < $nbp)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$propal->addline($product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
$result=$propal->addline($product->description, $product->price, mt_rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
if ($result < 0)
{
dol_print_error($db,$propal->error);

View File

@@ -90,30 +90,30 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
print "Company $s\n";
$soc = new Societe($db);
$soc->name = "Company num ".time()."$s";
$soc->town = $listoftown[rand(0, count($listoftown)-1)];
$soc->client = rand(1,2); // Une societe sur 2 est prospect, l'autre client
$soc->fournisseur = rand(0,1); // Une societe sur 2 est fournisseur
$soc->town = $listoftown[mt_rand(0, count($listoftown)-1)];
$soc->client = mt_rand(1,2); // Une societe sur 2 est prospect, l'autre client
$soc->fournisseur = mt_rand(0,1); // Une societe sur 2 est fournisseur
$soc->code_client='CU'.time()."$s";
$soc->code_fournisseur='SU'.time()."$s";
$soc->tva_assuj=1;
$soc->country_id=1;
$soc->country_code='FR';
// Un client sur 3 a une remise de 5%
$user_remise=rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
$user_remise=mt_rand(1,3); if ($user_remise==3) $soc->remise_percent=5;
print "> client=".$soc->client.", fournisseur=".$soc->fournisseur.", remise=".$soc->remise_percent."\n";
$soc->note_private = 'Company created by the script generate-societe.php';
$socid = $soc->create();
if ($socid >= 0)
{
$rand = rand(1,4);
$rand = mt_rand(1,4);
print "> Generates $rand contact(s)\n";
for ($c = 0 ; $c < $rand ; $c++)
{
$contact = new Contact($db);
$contact->socid = $soc->id;
$contact->lastname = "Lastname".$c;
$contact->firstname = $listoflastname[rand(0, count($listoflastname)-1)];
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
if ( $contact->create($user) )
{

View File

@@ -171,6 +171,8 @@ then
fi
#echo "mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile"
#mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
#echo "drop old table"
echo "drop table llx_accounting_account;" | mysql -P$port -u$admin $passwd $base
echo "mysql -P$port -u$admin -p***** $base < $mydir/$dumpfile"
mysql -P$port -u$admin $passwd $base < $mydir/$dumpfile
export res=$?

View File

@@ -322,10 +322,22 @@ if ($resql)
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked'])) print '<td class="liste_titre"></td>';
}
foreach($extrafields->attribute_label as $key => $val)
{
if (! empty($arrayfields["ef.".$key]['checked']))
{
$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]).'">';
}
print '</td>';
}
}
}
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);

View File

@@ -198,7 +198,8 @@ if (! $conf->use_javascript_ajax) {
$listmodelcsv = array (
'1' => $langs->trans("Modelcsv_normal"),
'2' => $langs->trans("Modelcsv_CEGID"),
'3' => $langs->trans("Modelcsv_COALA")
'3' => $langs->trans("Modelcsv_COALA"),
'4' => $langs->trans("Modelcsv_bob50")
);
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2015 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
@@ -106,81 +106,38 @@ if (! empty($search_accountancy_code_end)) {
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
$result = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
foreach ( $object->lines as $line ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
// Model Cegid Expert Export
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accountg($line->numero_compte) . $sep;
print ' ' . $sep;
print $line->sens . $sep;
print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep;
/*print $line->piece_num . $sep;
print length_accounta($line->code_tiers) . $sep;
print . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;*/
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep;
print $line->doc_ref . $sep;
print length_accounta($line->numero_compte) . $sep;
print length_accountg($line->code_tiers) . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
/*print $line->piece_num . $sep;
print $line->label_compte . $sep;
print price($line->montant) . $sep;
print $line->sens . $sep;*/
print $line->code_journal . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
// Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
print $line->code_journal . $sep;
print length_accounta($line->numero_compte) . $sep;
print $line->piece_num . $sep;
print $line->doc_ref . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print 'E' . $sep;
print length_accountg($line->code_tiers) . $sep;
print "\n";
}
print length_accountg($line->numero_compte) . $sep;
print $line->debit . $sep;
print $line->credit . $sep;
print $line->debit . $sep;
print $line->credit - $line->debit . $sep;
print "\n";
}
}
}
else {
$title_page = $langs->trans("AccountBalance") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
llxHeader('', $title_page);
/*
* List
*/
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter);
@@ -188,27 +145,27 @@ else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAllBalance($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
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);
@@ -217,7 +174,7 @@ else {
print_liste_field_titre($langs->trans("Solde"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td>';
print $langs->trans('From');
@@ -226,32 +183,32 @@ else {
print $langs->trans('To');
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$var = True;
$total_debit = 0;
$total_credit = 0;
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
print "<tr $bc[$var]>";
print '<td>' . length_accountg($line->numero_compte) . '</td>';
print '<td align="right">' . price($line->debit) . '</td>';
print '<td align="right">' . price($line->credit) . '</td>';
@@ -260,7 +217,7 @@ else {
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td></td>';
print '<td align="right">';
@@ -272,10 +229,10 @@ else {
print '<td align="right">' . price($total_credit - $total_debit) . '</td>';
print '<td align="right"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
}
$db->close();

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-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
@@ -182,9 +182,9 @@ if (! empty($search_mvt_num)) {
* Action
*/
if ($action == 'delbookkeeping') {
$import_key = GETPOST('importkey', 'alpha');
if (! empty($import_key)) {
$result = $object->deleteByImportkey($import_key);
if ($result < 0) {
@@ -194,9 +194,9 @@ if ($action == 'delbookkeeping') {
exit();
}
} elseif ($action == 'delbookkeepingyearconfirm') {
$delyear = GETPOST('delyear', 'int');
if (! empty($delyear)) {
$result = $object->deleteByYear($delyear);
if ($result < 0) {
@@ -206,34 +206,30 @@ if ($action == 'delbookkeeping') {
exit();
}
} elseif ($action == 'delmouvconfirm') {
$mvt_num = GETPOST('mvt_num', 'int');
if (! empty($mvt_num)) {
$result = $object->deleteMvtNum($mvt_num);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
// if (!empty($options)) {
// Header("Location: list.php?".urldecode($options));
// } else {
Header("Location: list.php");
// }
exit();
}
} elseif ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = 'bookkepping';
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
foreach ( $object->lines as $line ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
// Model Cegid Expert Export
@@ -246,16 +242,9 @@ if ($action == 'delbookkeeping') {
print price($line->montant) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print $line->doc_ref . $sep;
/*print $line->piece_num . $sep;
print length_accounta($line->code_tiers) . $sep;
print . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;*/
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Std export
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
print $date . $sep;
@@ -264,15 +253,10 @@ if ($action == 'delbookkeeping') {
print length_accounta($line->code_tiers) . $sep;
print price($line->debit) . $sep;
print price($line->credit) . $sep;
/*print $line->piece_num . $sep;
print $line->label_compte . $sep;
print price($line->montant) . $sep;
print $line->sens . $sep;*/
print $line->code_journal . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 3) {
// Coala export
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
@@ -285,23 +269,48 @@ if ($action == 'delbookkeeping') {
print 'E' . $sep;
print length_accountg($line->code_tiers) . $sep;
print "\n";
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 4) {
// Bob50
print $line->piece_num . $sep;
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $sep;
if (empty($line->code_tiers)) {
print 'G' . $sep;
print length_accounta($line->numero_compte) . $sep;
} else {
if (substr($line->numero_compte,0,3)=='411') {
print 'C' . $sep;
}
if (substr($line->numero_compte,0,3)=='401') {
print 'F' . $sep;
}
print length_accountg($line->code_tiers) . $sep;
}
print price($line->debit) . $sep;
print price($line->credit) . $sep;
print dol_trunc($line->label_compte, 32) . $sep;
print "\n";
}
}
}
}
/*
* View
*/
else {
$title_page = $langs->trans("Bookkeeping") . ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end);
llxHeader('', $title_page);
/*
* List
*/
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter);
@@ -309,78 +318,48 @@ else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'delmouv') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1);
print $formconfirm;
}
if ($action == 'delbookkeepingyear') {
$form_question = array ();
$delyear = GETPOST('delyear');
if (empty($delyear)) {
$delyear = dol_print_date(dol_now(), '%Y');
}
$year_array = $formventilation->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
$form_question['delyear'] = array (
'name' => 'delyear',
'type' => 'select',
'label' => $langs->trans('DelYear'),
'values' => $year_array,
'default' => $delyear
'default' => $delyear
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delbookkeepingyearconfirm', $form_question, 0, 1);
print $formconfirm;
}
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $nbtotalofrecords);
/*print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="delbookkeeping">';
print $formventilation->select_bookkeeping_importkey('importkey', GETPOST('importkey'));
print '<div class="inline-block divButAction"><input type="submit" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '</form>';*/
print '<form method="GET" id="searchFormList" action="' . $_SERVER["PHP_SELF"] . '">';
print '<div class="tabsAction">' . "\n";
print '<div class="inline-block divButAction"><input type="submit" name="button_delmvt" class="butAction" value="' . $langs->trans("DelBookKeeping") . '" /></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="./card.php?action=create">' . $langs->trans("NewAccountingMvt") . '</a></div>';
// print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=export_csv">' . $langs->trans("Export") . '</a>';
print '<div class="inline-block divButAction"><input type="submit" name="button_export_csv" class="butAction" value="' . $langs->trans("Export") . '" /></div>';
print '</div>';
/*print '<div class="liste_titre">';
print $langs->trans('DateStart') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
print $langs->trans('DateEnd') . ': ';
print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array (), 1, 1, '');
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
print '</div>';*/
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder);
@@ -391,12 +370,10 @@ else {
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("Amount"), $_SERVER['PHP_SELF'], "t.montant", "", $options, 'align="center"', $sortfield, $sortorder);
// print_liste_field_titre($langs->trans("Sens"), $_SERVER['PHP_SELF'], "t.sens", "", $options, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Codejournal"), $_SERVER['PHP_SELF'], "t.code_journal", "", $options, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Action"), $_SERVER["PHP_SELF"], "", $options, "", 'width="60" align="center"', $sortfield, $sortorder);
print "</tr>\n";
print '<tr class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>';
@@ -404,61 +381,52 @@ 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 $form->select_date($search_doc_date, 'doc_date', 0, 0, 1);
print '</td>';
print '<td><input type="text" name="search_doc_ref" size="8" value="' . $search_doc_ref . '"></td>';
print '<td>';
// print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $langs->trans('From');
print $formventilation->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '');
// print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
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><input type="text" name="search_accountancy_code" size="8" value="' . $search_accountancy_code . '"></td>';
print '<td>';
// print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $langs->trans('From');
print $formventilation->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
// print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
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>';
// print '<td><input type="text" name="search_accountancy_aux_code" size="8" value="' . $search_accountancy_aux_code . '"></td>';
print '<td class="liste_titre">';
print '<input type="text" size=6 class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/>';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
// print '<td>&nbsp;</td>';
// print '<td>&nbsp;</td>';
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$var = True;
$total_debit = 0;
$total_credit = 0;
foreach ( $object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit;
$total_credit += $line->credit;
print "<tr $bc[$var]>";
print '<td><a href="./card.php?piece_num=' . $line->piece_num . '">' . $line->piece_num . '</a></td>';
print '<td align="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
print '<td>' . $line->doc_ref . '</td>';
@@ -467,8 +435,6 @@ 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">' . price($line->montant) . '</td>';
// print '<td align="center">' . $line->sens . '</td>';
print '<td align="right">' . $line->code_journal . '</td>';
print '<td align="center">';
print '<a href="./card.php?piece_num=' . $line->piece_num . '">' . img_edit() . '</a>&nbsp;';
@@ -476,7 +442,7 @@ else {
print '</td>';
print "</tr>\n";
}
print '<tr class="liste_total">';
print '<td colspan="6"></td>';
print '<td align="right">';
@@ -487,10 +453,10 @@ else {
print '</td>';
print '<td colspan="2"></td>';
print '</tr>';
print "</table>";
print '</form>';
llxFooter();
}

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
*
* This program is free software; you can redistribute it and/or modify
@@ -74,7 +74,6 @@ if (empty($search_date_start)) {
$search_date_start = dol_mktime(0, 0, 0, 1, 1, dol_print_date(dol_now(), '%Y'));
$search_date_end = dol_mktime(0, 0, 0, 12, 31, dol_print_date(dol_now(), '%Y'));
}
if ($sortorder == "")
$sortorder = "ASC";
if ($sortfield == "")
@@ -184,13 +183,13 @@ print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_numero_compte_start, 'search_numero_compte_start', 1, array (), 1, 1, '');
print $langs->trans('to') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $langs->trans('To') . ' ' . $langs->trans('AccountAccounting') . ': ';
print $formventilation->select_account($search_numero_compte_end, 'search_numero_compte_end', 1, array (), 1, 1, '');
print '</div>';
print '<div class="liste_titre">';
print $langs->trans('From') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_code_tiers_start, 'search_code_tiers_start', 1);
print $langs->trans('to') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $langs->trans('To') . ' ' . $langs->trans('ThirdPartyAccount') . ': ';
print $formventilation->select_auxaccount($search_code_tiers_end, 'searchcode_tiers_end', 1);
print '</div>';
print "<table class=\"noborder\" width=\"100%\">";
@@ -257,9 +256,10 @@ print '<td class="liste_titre" align="center">';
print '<input type="text" size=3 class="flat" name="search_code_journal" value="' . $search_code_journal . '"/>';
print '</td>';
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '<td align="right" colspan="2" class="liste_titre">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print "</tr>\n";
@@ -268,7 +268,7 @@ $var = True;
foreach ( $object->lines as $line ) {
$var = ! $var;
print "<tr $bc[$var]>";
print '<td>' . $line->piece_num . '</td>' . "\n";
print '<td>' . $line->doc_type . '</td>' . "\n";

View File

@@ -1,7 +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-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -1064,6 +1064,7 @@ class BookKeeping extends CommonObject
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum;
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
@@ -1118,7 +1119,7 @@ class BookKeeping extends CommonObject
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE piece_num = " . $piecenum;
dol_syslog(get_class($this) . "fetch_all_per_mvt sql=" . $sql, LOG_DEBUG);
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
@@ -1147,7 +1148,7 @@ class BookKeeping extends CommonObject
}
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(get_class($this) . "::fetch_all_per_mvt " . $this->error, LOG_ERR);
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
return - 1;
}

View File

@@ -48,6 +48,8 @@ $search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha');
$search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Getpost Order and column and limit page
$sortfield = GETPOST('sortfield', 'alpha');
@@ -68,7 +70,7 @@ if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$offset = $limit * $page;
if (! $sortfield)
$sortfield = "f.datef, f.facnumber, l.rowid";
$sortfield = "f.datef, f.facnumber, fd.rowid";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
@@ -94,6 +96,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_amount = '';
$search_account = '';
$search_vat = '';
$search_country = '';
$search_tvaintra = '';
}
if (is_array($changeaccount) && count($changeaccount) > 0) {
@@ -150,14 +154,27 @@ print '<script type="text/javascript">
/*
* Customer Invoice lines
*/
$sql = "SELECT l.rowid , f.facnumber, f.rowid as facid, l.fk_product, l.description, l.total_ht, l.qty, l.tva_tx, l.fk_code_ventilation, aa.label, aa.account_number,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " , " . MAIN_DB_PREFIX . "facturedet as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql .= " WHERE f.rowid = l.fk_facture AND f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND aa.rowid = l.fk_code_ventilation";
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc,";
$sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
$sql .= " fd.situation_percent, co.label as country, s.tva_intra";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql .= " WHERE fd.fk_code_ventilation > 0 ";
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
}
$sql .= " AND f.fk_statut > 0";
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_STANDARD . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
}
if (strlen(trim($search_invoice))) {
$sql .= " AND f.facnumber like '%" . $search_invoice . "%'";
}
@@ -168,16 +185,22 @@ if (strlen(trim($search_label))) {
$sql .= " AND p.label like '%" . $search_label . "%'";
}
if (strlen(trim($search_desc))) {
$sql .= " AND l.description like '%" . $search_desc . "%'";
$sql .= " AND fd.description like '%" . $search_desc . "%'";
}
if (strlen(trim($search_amount))) {
$sql .= " AND l.total_ht like '%" . $search_amount . "%'";
$sql .= " AND fd.total_ht like '%" . $search_amount . "%'";
}
if (strlen(trim($search_account))) {
$sql .= " AND aa.account_number like '%" . $search_account . "%'";
}
if (strlen(trim($search_vat))) {
$sql .= " AND (l.tva_tx like '" . $search_vat . "%')";
$sql .= " AND (fd.tva_tx like '" . $search_vat . "%')";
}
if (strlen(trim($search_country))) {
$sql .= " AND (co.label like'" . $search_country . "%')";
}
if (strlen(trim($search_tvaintra))) {
$sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')";
}
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture", 1) . ")";
@@ -201,8 +224,8 @@ if ($result) {
$i = 0;
$param = "";
if ($search_facture)
$param .= "&search_facture=" . $search_facture;
if ($search_invoice)
$param .= "&search_invoice=" . $search_invoice;
if ($search_ref)
$param .= "&search_ref=" . $search_ref;
if ($search_label)
@@ -211,8 +234,13 @@ if ($result) {
$param .= "&search_desc=" . $search_desc;
if ($search_account)
$param .= "&search_account=" . $search_account;
if ($filter)
$param .= "&filter=" . $filter;
if ($search_vat)
$param .= "&search_vat=" . $search_vat;
if ($search_country)
$param .= "&search_country=" . $search_country;
if ($search_tvaintra)
$param .= "&search_tvaintra=" . $search_tvaintra;
print_barre_liste($langs->trans("InvoiceLinesDone"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num_lines, $nbtotalofrecords);
print '<td align="left"><b>' . $langs->trans("DescVentilDoneCustomer") . '</b></td>';
@@ -228,12 +256,12 @@ if ($result) {
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Description"), $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "fd.total_ht", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre('');
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print "</tr>\n";
@@ -243,14 +271,13 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" 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">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
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="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";
$facture_static = new Facture($db);
$product_static = new Product($db);
@@ -258,7 +285,7 @@ if ($result) {
$var = True;
while ( $objp = $db->fetch_object($result) ) {
$var = ! $var;
$codecompta = $objp->account_number . ' ' . $objp->label;
$codecompta = $objp->account_number . ' - ' . $objp->label_compte;
print "<tr $bc[$var]>";
@@ -282,13 +309,12 @@ 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 align="right">' . $objp->rowid . '</td>';
print '<td align="left"><a href="./card.php?id=' . $objp->rowid . '">';
print '<td align="center">' . $codecompta . '<a href="./card.php?id=' . $objp->fdid . '">';
print img_edit();
print '</a></td>';
print '<td align="center"><input type="checkbox" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
print '<td align="right">' . $objp->country .'</td>';
print '<td align="center">' . $objp->tva_intra . '</td>';
print '<td align="center"><input type="checkbox" name="changeaccount[]" value="' . $objp->fdid . '"/></td>';
print "</tr>";
$i ++;

View File

@@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2013-2014 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) 2014 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2013-2014 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) 2014 Juanjo Menent <jmenent@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
@@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/customer/list.php
* \ingroup Accountancy
* \brief Ventilation page from customers invoices
* \file htdocs/accountancy/customer/list.php
* \ingroup Advanced accountancy
* \brief Ventilation page from customers invoices
*/
require '../../main.inc.php';
@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
@@ -105,7 +106,6 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
/*
* View
*/
llxHeader('', $langs->trans("Ventilation"));
print '<script type="text/javascript">
@@ -123,36 +123,38 @@ print '<script type="text/javascript">
});
});
});
</script>';
</script>';
/*
* Action
*/
if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if (! empty($codeventil) && ! empty($mesCasesCochees)) {
print '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$mesCodesVentilChoisis = $codeventil;
$cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) {
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet";
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
}
$cpt ++;
}
} else {
@@ -164,7 +166,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
/*
* Customer Invoice lines
*/
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
@@ -224,16 +225,13 @@ $result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print_liste_field_titre($langs->trans("Date"), $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder);
print '&nbsp;&nbsp;';
print_liste_field_titre($langs->trans("RowId"), $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
@@ -247,40 +245,39 @@ if ($result) {
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print '</tr>';
// We add search filter
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" 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="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" 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="3" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td align="right" class="liste_titre" colspan="4">';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '&nbsp;';
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$facture_static = new Facture($db);
$product_static = new Product($db);
$form = new Form($db);
$var = true;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$objp->code_sell_l = '';
$objp->code_sell_p = '';
$objp->aarowid_suggest = '';
$code_sell_p_l_differ = '';
$code_sell_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if (! empty($objp->code_sell)) {
$objp->code_sell_p = $objp->code_sell;
} else {
@@ -304,9 +301,9 @@ if ($result) {
}
if ($objp->code_sell_l != $objp->code_sell_p)
$code_sell_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref Invoice
$facture_static->ref = $objp->facnumber;
$facture_static->id = $objp->facid;
@@ -316,14 +313,14 @@ if ($result) {
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
print '<td>';
if ($product_static->id)
print $product_static->getNomUrl(1);
else
print '&nbsp;';
print '</td>';
print '<td style="' . $code_sell_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
@@ -339,10 +336,10 @@ if ($result) {
if ($objp->code_sell_l == $objp->code_sell_p) {
print $objp->code_sell_l;
} else {
print $langs->trans("Purchase") . ' = ' . $objp->code_sell_l . '<br />' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p;
print $langs->trans("Buy") . ' = ' . $objp->code_sell_l . '<br />' . $langs->trans("Sell") . ' = ' . $objp->code_sell_p;
}
print '</td>';
print '<td align="center">';
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
print '</td>';
@@ -353,7 +350,7 @@ if ($result) {
print '</tr>';
$i ++;
}
print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil"></div>';
print '</form>';

View File

@@ -71,7 +71,7 @@ $now = dol_now();
// Security check
if ($user->societe_id > 0 && empty($id_bank_account))
accessforbidden();
/*
* View
*/
@@ -122,7 +122,7 @@ $paymentsalstatic = new PaymentSalary($db);
// Get code of finance journal
$bank_code_journal = new Account($db);
$result = $bank_code_journal->fetch($id_bank_account);
$journal = $bank_code_journal->ref;
$journal = $bank_code_journal->accountancy_journal;
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
$result = $db->query($sql);
@@ -148,7 +148,7 @@ if ($result) {
$tabcompany[$obj->rowid] = array (
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
'code_client' => $obj->code_compta
);
// Controls
@@ -251,7 +251,7 @@ if ($result) {
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$i ++;
}
} else {
@@ -312,14 +312,13 @@ if ($action == 'writebookkeeping') {
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->doc_ref = $objmid->ref_supplier . ' (' . $objmid->ref . ')';
;
}
}
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
// Third party
@@ -388,7 +387,7 @@ if ($action == 'writebookkeeping') {
$bookkeeping->code_tiers = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
} else {
$bookkeeping->doc_ref = $k;
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
}
@@ -396,7 +395,7 @@ if ($action == 'writebookkeeping') {
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
@@ -414,7 +413,7 @@ if ($action == 'export_csv') {
$companystatic = new Client($db);
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
$sep = ";";
@@ -436,7 +435,7 @@ if ($action == 'export_csv') {
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print utf8_decode($val["ref"]) . $sep;
print "\n";
}
@@ -455,7 +454,7 @@ if ($action == 'export_csv') {
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print utf8_decode($val["ref"]) . $sep;
print "\n";
}
}
@@ -468,7 +467,7 @@ if ($action == 'export_csv') {
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $val["type_payment"] . $sep;
print $val["ref"] . $sep;
print utf8_decode($val["ref"]) . $sep;
print "\n";
}
}
@@ -486,7 +485,12 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Bank") . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('Bank') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
} 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";
@@ -499,7 +503,12 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $companystatic->name . '"' . $sep;
// print '"' . $companystatic->name . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
} else {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@@ -510,7 +519,12 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . $langs->trans("Bank") . '"' . $sep;
// print '"' . $langs->trans("Bank") . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep;
} else {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@@ -523,7 +537,7 @@ else {
$form = new Form($db);
llxHeader('', $langs->trans("FinanceJournal"));
$nom = $langs->trans("FinanceJournal") . ' - ' . $bank_code_journal->getNomUrl(1);
$builddate = time();
$description = $langs->trans("DescFinanceJournal") . '<br>';
@@ -531,7 +545,7 @@ else {
$varlink = 'id_account=' . $id_bank_account;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
'action' => ''
), '', $varlink);
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
@@ -573,7 +587,7 @@ else {
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
if ($val["lib"] == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('SupplierInvoicePayment');
}
@@ -587,7 +601,12 @@ else {
print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $langs->trans('Bank') . "</td>";
// print "<td>" . $langs->trans('Bank') . "</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('Bank') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("Bank") . " - " . $val['soclib'] . "</td>";
}
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
@@ -601,8 +620,18 @@ else {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $val["soclib"] . "</td>";
// print "<td>" . length_accounta($k) . "</td>";
if (length_accounta($k) == '') {
print "<td>" . length_accounta($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) . "</td>";
} else {
print "<td>" . length_accounta($k) . "</td>";
print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>";
}
// print "<td>" . $langs->trans('ThirdParty') . " (" . $val['soclib'] . ")</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "</td>";
}
print "<td>" . $val["type_payment"] . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
@@ -615,7 +644,12 @@ else {
print "<td>" . $date . "</td>";
print "<td>" . $reflabel . "</td>";
print "<td>" . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . "</td>";
print "<td>" . $langs->trans('ThirdParty') . "</td>";
// print "<td>" . $langs->trans('ThirdParty') . "</td>";
if ($val['soclib'] == '') {
print "<td>" . $langs->trans('ThirdParty') . " - " . $val["ref"] . "</td>";
} else {
print "<td>" . $langs->trans("ThirdParty") . ' - ' . $val['soclib'] . "</td>";
}
print "<td>&nbsp;</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";

View File

@@ -112,14 +112,14 @@ if ($result) {
$num = $db->num_rows($result);
// les variables
$cptfour = (! empty($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER)) ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : $langs->trans("CodeNotDef");
$tabfac = array ();
$tabht = array ();
$tabtva = array ();
$tabttc = array ();
$tabcompany = array ();
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($result);
@@ -133,9 +133,13 @@ if ($result) {
$compta_prod = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef");
}
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
$tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->ref_supplier . ' (' . $obj->ref . ')';
$tabfac[$obj->rowid]["refsologest"] = $obj->ref ;
$tabfac[$obj->rowid]["refsuppliersologest"] = $obj->ref_supplier ;
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->description;
$tabfac[$obj->rowid]["fk_facturefourndet"] = $obj->fdid;
@@ -145,9 +149,9 @@ if ($result) {
$tabcompany[$obj->rowid] = array (
'id' => $obj->socid,
'name' => $obj->name,
'code_fournisseur' => $obj->code_compta_fournisseur
'code_fournisseur' => $obj->code_compta_fournisseur
);
$i ++;
}
} else {
@@ -158,11 +162,11 @@ if ($result) {
if ($action == 'writebookkeeping') {
$now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) {
// get compte id and label
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"];
@@ -179,14 +183,14 @@ if ($action == 'writebookkeeping') {
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
@@ -209,16 +213,16 @@ if ($action == 'writebookkeeping') {
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
@@ -240,16 +244,16 @@ if ($action == 'writebookkeeping') {
$bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
if (empty($error)) {
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
}
@@ -265,23 +269,23 @@ $companystatic = new Fournisseur($db);
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y');
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
@@ -294,7 +298,7 @@ if ($action == 'export_csv') {
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
@@ -309,7 +313,7 @@ if ($action == 'export_csv') {
print "\n";
}
}
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
@@ -325,12 +329,20 @@ if ($action == 'export_csv') {
} else {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day');
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
@@ -339,7 +351,8 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . utf8_decode(dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
@@ -351,19 +364,21 @@ if ($action == 'export_csv') {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("VAT") . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
}
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
}
@@ -371,11 +386,11 @@ if ($action == 'export_csv') {
}
}
} else {
llxHeader('', $langs->trans("PurchasesJournal"));
$form = new Form($db);
$nom = $langs->trans("PurchasesJournal");
$nomlink = '';
$periodlink = '';
@@ -387,16 +402,16 @@ if ($action == 'export_csv') {
} else {
$description .= $langs->trans("DepositsAreIncluded");
}
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '
<script type="text/javascript">
function launch_export() {
@@ -410,12 +425,12 @@ if ($action == 'export_csv') {
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
/*
* Show result array
*/
print '<br><br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@@ -425,31 +440,39 @@ if ($action == 'export_csv') {
print "<td>" . $langs->trans("Account") . "</td>";
print "<t><td>" . $langs->trans("Type") . "</td><td align='right'>" . $langs->trans("Debit") . "</td><td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
$invoicestatic = new FactureFournisseur($db);
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->ref = $val["refsologest"];
$invoicestatic->refsupplier = $val["refsuppliersologest"];
$invoicestatic->type = $val["type"];
$invoicestatic->description = html_entity_decode(dol_trunc($val["description"], 32));
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print "<tr " . $bc[$var] . " >";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $accountingaccount->label . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - ' .$invoicestatic->refsupplier .' - '. $accountingaccount->label . "</td>";
//print "<td>" . $accountingaccount->label . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
@@ -461,34 +484,36 @@ if ($action == 'export_csv') {
print "<tr " . $bc[$var] . " >";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td><td>" . $langs->trans("VAT") . "</td>";
print "<td>" . length_accountg($k) . "</td>" ;
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("VAT") . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td align="right">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
}
print "<tr " . $bc[$var] . ">";
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
print "<td>" . length_accounta($k);
print "</td><td>" . $langs->trans("ThirdParty");
print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
print "</td>";
print "<td>" . length_accounta($k)."</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16). ' - '.$invoicestatic->refsupplier .' - '. $langs->trans("Code_tiers")."</td>";
//print "</td><td>" . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'supplier', 16) . ')';
//print "</td>";
print '<td align="right">' . ($mt < 0 ? - price(- $mt) : '') . "</td>";
print '<td align="right">' . ($mt >= 0 ? price($mt) : '') . "</td>";
}
print "</tr>";
$var = ! $var;
}
print "</table>";
// End of page
llxFooter();
}

View File

@@ -40,10 +40,10 @@ require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
// Langs
$langs->load("commercial");
$langs->load("compta");
$langs->load("bills");
$langs->load("other");
$langs->load("main");
$langs->load("accountancy");
$date_startmonth = GETPOST('date_startmonth');
@@ -119,16 +119,16 @@ if ($result) {
$tabtva = array ();
$tabttc = array ();
$tabcompany = array ();
$num = $db->num_rows($result);
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($result);
// les variables
$cptcli = (! empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER)) ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : $langs->trans("CodeNotDef");
$compta_soc = (! empty($obj->code_compta)) ? $obj->code_compta : $cptcli;
$compta_prod = $obj->compte;
if (empty($compta_prod)) {
if ($obj->product_type == 0)
@@ -138,22 +138,23 @@ if ($result) {
}
$cpttva = (! empty($conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_VAT_SOLD_ACCOUNT : $langs->trans("CodeNotDef");
$compta_tva = (! empty($obj->account_tva) ? $obj->account_tva : $cpttva);
// Situation invoices handling
$line = new FactureLigne($db);
$line->fetch($obj->rowid);
$prev_progress = $line->get_prev_progress();
$line->fetch($obj->fdid); // id of line
$prev_progress = 0;
if ($obj->type == Facture::TYPE_SITUATION) {
// Avoid divide by 0
// Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
$prev_progress = $line->get_prev_progress($obj->rowid); // id of invoice
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
$situation_ratio = 1;
}
// Invoice lines
$tabfac[$obj->rowid]["date"] = $obj->df;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
@@ -172,9 +173,9 @@ if ($result) {
$tabcompany[$obj->rowid] = array (
'id' => $obj->socid,
'name' => $obj->name,
'code_client' => $obj->code_compta
'code_client' => $obj->code_compta
);
$i ++;
}
} else {
@@ -190,7 +191,7 @@ if ($result) {
if ($action == 'writebookkeeping') {
$now = dol_now();
$error = 0;
foreach ( $tabfac as $key => $val ) {
foreach ( $tabttc[$key] as $k => $mt ) {
$bookkeeping = new BookKeeping($db);
@@ -209,14 +210,14 @@ if ($action == 'writebookkeeping') {
$bookkeeping->credit = ($mt < 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
if ($mt) {
@@ -239,16 +240,16 @@ if ($action == 'writebookkeeping') {
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// VAT
// var_dump($tabtva);
foreach ( $tabtva[$key] as $k => $mt ) {
@@ -269,16 +270,16 @@ if ($action == 'writebookkeeping') {
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
$bookkeeping->fk_user_author = $user->id;
$result = $bookkeeping->create($user);
if ($result < 0) {
$error ++;
setEventMessages($object->error, $object->errors, 'errors');
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
if (empty($error)) {
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
}
@@ -288,23 +289,23 @@ if ($action == 'writebookkeeping') {
if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Client($db);
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2)
{
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$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');
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $sell_journal . $sep;
@@ -316,7 +317,7 @@ if ($action == 'export_csv') {
print $val["ref"];
print "\n";
}
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount_static = new AccountingAccount($db);
@@ -332,7 +333,7 @@ if ($action == 'export_csv') {
print "\n";
}
}
// TVA
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
@@ -354,42 +355,45 @@ if ($action == 'export_csv') {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$date = dol_print_date($db->jdate($val["date"]), 'day');
foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - ' . $companystatic->ref_client . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
//print '"' . utf8_decode($companystatic->name) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. utf8_decode ( dol_trunc($accountingaccount->label, 32)) . '"' . $sep;
//print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode(dol_trunc($companystatic->name,16)).' - '. $langs->trans("VAT") . '"' . $sep;
//print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
@@ -398,11 +402,11 @@ if ($action == 'export_csv') {
}
}
} else {
$form = new Form($db);
llxHeader('', $langs->trans("SellsJournal"));
$nom = $langs->trans("SellsJournal");
$nomlink = '';
$periodlink = '';
@@ -415,13 +419,13 @@ if ($action == 'export_csv') {
$description .= $langs->trans("DepositsAreIncluded");
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1);
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
'action' => ''
));
print '<input type="button" class="button" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
print '<input type="button" class="button" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '
<script type="text/javascript">
function launch_export() {
@@ -435,12 +439,12 @@ if ($action == 'export_csv') {
$("div.fiche div.tabBar form input[name=\"action\"]").val("");
}
</script>';
/*
* Show result array
*/
print '<br><br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@@ -451,20 +455,20 @@ if ($action == 'export_csv') {
print "<td align='right'>" . $langs->trans("Debit") . "</td>";
print "<td align='right'>" . $langs->trans("Credit") . "</td>";
print "</tr>\n";
$var = true;
$r = '';
$invoicestatic = new Facture($db);
$companystatic = new Client($db);
foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$invoicestatic->type = $val["type"];
$date = dol_print_date($db->jdate($val["date"]), 'day');
// Third party
foreach ( $tabttc[$key] as $k => $mt ) {
print "<tr " . $bc[$var] . ">";
@@ -474,30 +478,32 @@ if ($action == 'export_csv') {
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
print "<td>" . length_accounta($k);
print "</td><td>" . $langs->trans("ThirdParty");
print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
//print "</td><td>" . $langs->trans("ThirdParty");
//print ' (' . $companystatic->getNomUrl(0, 'customer', 16) . ')';
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref_client . ' - ' . $langs->trans("Code_tiers"). "</td>";
print "</td><td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
}
print "</tr>";
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k);
if ($mt) {
print "<tr " . $bc[$var] . ">";
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $accountingaccount->label . "</td>";
//print "<td>" . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client . ' - ' . utf8_decode ( utf8_decode ( $accountingaccount->label)) . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
@@ -505,18 +511,19 @@ if ($action == 'export_csv') {
print "<td>" . $date . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . length_accountg($k) . "</td>";
print "<td>" . $langs->trans("VAT") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16). ' - ' . $invoicestatic->ref_client .' - '. $langs->trans("VAT") . "</td>";
//print "<td>" . $langs->trans("VAT") . "</td>";
print "<td align='right'>" . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "<td align='right'>" . ($mt >= 0 ? price($mt) : '') . "</td>";
print "</tr>";
}
}
$var = ! $var;
}
print "</table>";
// End of page
llxFooter();
}

View File

@@ -217,7 +217,7 @@ if ($result) {
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="15" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" 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">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
@@ -233,7 +233,7 @@ if ($result) {
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
$codeCompta = $objp->account_number . ' ' . $objp->label;
$codeCompta = $objp->account_number . ' - ' . $objp->label;
print "<tr $bc[$var]>";

View File

@@ -20,9 +20,9 @@
*/
/**
* \file htdocs/accountancy/supplier/list.php
* \ingroup Accountancy
* \brief Ventilation page from suppliers invoices
* \file htdocs/accountancy/supplier/list.php
* \ingroup Advanced accountancy
* \brief Ventilation page from suppliers invoices
*/
require '../../main.inc.php';
@@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
// Langs
$langs->load("compta");
@@ -128,36 +129,39 @@ print '<script type="text/javascript">
});
});
});
</script>';
</script>';
/*
* Action
*/
if ($action == 'ventil' && ! empty($btn_ventil)) {
print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>';
if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) {
print '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>';
$mesCodesVentilChoisis = $codeventil;
$cpt = 0;
foreach ( $mesCasesCochees as $maLigneCochee ) {
// print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>";
$maLigneCourante = explode("_", $maLigneCochee);
$monId = $maLigneCourante[0];
$monNumLigne = $maLigneCourante[1];
$monCompte = $mesCodesVentilChoisis[$monNumLigne];
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " SET fk_code_ventilation = " . $monCompte;
$sql .= " WHERE rowid = " . $monId;
$accountventilated = new AccountingAccount($db);
$accountventilated->fetch($monCompte, '');
dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG);
if ($db->query($sql)) {
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '</font></div>';
print '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>';
} else {
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $monCompte . '<br/> <pre>' . $sql . '</pre></font></div>';
print '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>';
}
$cpt ++;
}
} else {
@@ -169,7 +173,6 @@ if ($action == 'ventil' && ! empty($btn_ventil)) {
/*
* Supplier Invoice Lines
*/
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)) {
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
} else if ($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION <= 0) {
@@ -226,15 +229,15 @@ $result = $db->query($sql);
if ($result) {
$num_lines = $db->num_rows($result);
$i = 0;
// TODO : print_barre_liste always use $conf->liste_limit and do not care about custom limit in list...
print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines);
print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n";
print '<input type="hidden" name="action" value="ventil">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
@@ -248,14 +251,14 @@ if ($result) {
print_liste_field_titre('');
print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"');
print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_invoice" 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="20" name="search_label" value="' . $search_label . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" 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="3" name="search_vat" value="' . $search_vat . '">%</td>';
print '<td class="liste_titre" align="center">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right" colspan="2" class="liste_titre">';
@@ -264,16 +267,16 @@ if ($result) {
print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
$facturefourn_static = new FactureFournisseur($db);
$productfourn_static = new ProductFournisseur($db);
$form = new Form($db);
$var = True;
while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result);
$var = ! $var;
// product_type: 0 = service ? 1 = product
// if product does not exist we use the value of product_type provided in facturedet to define if this is a product or service
// issue : if we change product_type value in product DB it should differ from the value stored in facturedet DB !
@@ -281,9 +284,9 @@ if ($result) {
$objp->code_buy_p = '';
$objp->aarowid_suggest = '';
$code_buy_p_l_differ = '';
$code_buy_p_notset = '';
$objp->aarowid_suggest = $objp->aarowid;
if (! empty($objp->code_buy)) {
$objp->code_buy_p = $objp->code_buy;
@@ -297,7 +300,7 @@ if ($result) {
$objp->code_buy_p = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
}
}
if ($objp->type_l == 1) {
$objp->code_buy_l = (! empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
if ($objp->aarowid == '')
@@ -307,17 +310,17 @@ if ($result) {
if ($objp->aarowid == '')
$objp->aarowid_suggest = $aarowid_p;
}
if ($objp->code_buy_l != $objp->code_buy_p)
$code_buy_p_l_differ = 'color:red';
print "<tr $bc[$var]>";
// Ref Invoice
$facturefourn_static->ref = $objp->ref;
$facturefourn_static->id = $objp->facid;
print '<td>' . $facturefourn_static->getNomUrl(1) . '</td>';
// Ref Supplier Invoice
$productfourn_static->ref = $objp->product_ref;
$productfourn_static->id = $objp->product_id;
@@ -328,23 +331,23 @@ if ($result) {
else
print '&nbsp;';
print '</td>';
print '<td style="' . $code_buy_p_l_differ . '">' . dol_trunc($objp->product_label, 24) . '</td>';
// TODO: we should set a user defined value to adjust user square / wide screen size
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32;
print '<td style="' . $code_buy_p_l_differ . '">' . nl2br(dol_trunc($objp->description, $trunclength)) . '</td>';
print '<td align="right">';
print price($objp->price);
print '</td>';
if ($objp->vat_tx_l != $objp->vat_tx_p)
$code_vat_differ = 'font-weight:bold; text-decoration:blink; color:red';
print '<td style="' . $code_vat_differ . '" align="center">';
print price($objp->tva_tx_line);
print '</td>';
print '<td align="center" style="' . $code_buy_p_notset . '">';
// if not same kind of product_type stored in product & facturedt we display both account and let user choose
if ($objp->code_buy_l == $objp->code_buy_p) {
@@ -353,7 +356,7 @@ if ($result) {
print 'lines=' . $objp->code_buy_l . '<br />product=' . $objp->code_buy_p;
}
print '</td>';
// Colonne choix du compte
print '<td align="center">';
print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1);
@@ -363,11 +366,11 @@ if ($result) {
print '<td align="center">';
print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>';
print '</td>';
print "</tr>";
$i ++;
}
print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '" name="ventil" ></div>';
print '</form>';

View File

@@ -141,7 +141,7 @@ if (count($listofsearchfields))
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr '.$bc[false].'>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;

View File

@@ -405,7 +405,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array();
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newByMonth'=>$langs->trans("NbAddedAutomatically"));
@@ -493,7 +493,7 @@ if ($id == 11)
}
if ($id == 25)
{
// We save list of template type Dolibarr can manage. This list can found by a grep into code on "->param['models']"
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array();
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
@@ -1017,8 +1017,18 @@ if ($id)
}
print '</td>';
print "</tr>";
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
$tmp=$formmail->getAvailableSubstitKey('form');
print join(', ', $tmp);
print '</td></tr>';
}
$colspan=count($fieldlist)+2;
$colspan=count($fieldlist)+3;
if ($id == 4) $colspan++;
if (! empty($alabelisused) && $id != 25) // If there is one label among fields, we show legend of *
@@ -1583,7 +1593,9 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, true, ROWS_5, '90%');
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';

View File

@@ -102,7 +102,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$listofsearchfields['search_contract']=array('text'=>'Contrat');
}
// Search contract
// Search supplier proposal
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
{
$listofsearchfields['search_supplier_proposal']=array('text'=>'SupplierProposalShort');
@@ -118,8 +118,8 @@ if (count($listofsearchfields))
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr '.$bc[false].'>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td class="noborderbottom" rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button "></td>';
print '</tr>';
$i++;
}

View File

@@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("mails");
@@ -55,27 +56,7 @@ $extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
$hookmanager->initHooks(array('mailingcard','globalcard'));
// Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
$object->substitutionarray=array(
'__ID__' => 'IdRecord',
'__EMAIL__' => 'EMail',
'__LASTNAME__' => 'Lastname',
'__FIRSTNAME__' => 'Firstname',
'__MAILTOEMAIL__' => 'TagMailtoEmail',
'__OTHER1__' => 'Other1',
'__OTHER2__' => 'Other2',
'__OTHER3__' => 'Other3',
'__OTHER4__' => 'Other4',
'__OTHER5__' => 'Other5',
'__SIGNATURE__' => 'TagSignature',
'__CHECK_READ__' => 'TagCheckMail',
'__UNSUBSCRIBE__' => 'TagUnsubscribe'
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet
);
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$object->substitutionarray['__SECUREKEYPAYPAL__']='SecureKeyPaypal';
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $object->substitutionarray['__SECUREKEYPAYPAL_MEMBER__']='SecureKeyPaypalUniquePerMember';
}
$object->substitutionarray=FormMail::getAvailableSubstitKey('emailing');
$object->substitutionarrayfortest=array(
'__ID__' => 'TESTIdRecord',
@@ -243,8 +224,18 @@ if (empty($reshook))
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$substitutionarray['__SECUREKEYPAYPAL__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_MEMBER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $obj->source_id, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_ORDER__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'order' . $obj->source_id, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_INVOICE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'invoice' . $obj->source_id, 2);
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
else $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__']=dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'contractline' . $obj->source_id, 2);
}
$substitutionisok=true;
complete_substitutions_array($substitutionarray, $langs);

View File

@@ -1044,6 +1044,19 @@ if (empty($reshook))
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else {
$db->rollback();
@@ -2432,13 +2445,8 @@ if ($action == 'create')
$formmail->withcancel = 1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit['__PROPREF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit['__CONTACTCIVNAME__'] = '';
// Find the good contact adress
$custcontact = '';

View File

@@ -182,7 +182,7 @@ class Propal extends CommonObject
*/
const STATUS_NOTSIGNED = 3;
/**
* Billed quote
* Billed or processed quote
*/
const STATUS_BILLED = 4;
@@ -2565,7 +2565,7 @@ class Propal extends CommonObject
if ($mode == 'signed') {
$delay_warning=$conf->propal->facturation->warning_delay;
$statut = self::STATUS_SIGNED;
$label = $langs->trans("PropalsToBill");
$label = $langs->trans("PropalsToBill"); // We set here bill but may be billed or ordered
}
$response = new WorkboardResponse();
@@ -2675,7 +2675,7 @@ class Propal extends CommonObject
$line->remise_percent=00;
}
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;

View File

@@ -969,6 +969,19 @@ if (empty($reshook))
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -1308,6 +1321,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$projectid = 0;
$remise_absolue = 0;
$currency_code = $conf->currency;
if (! empty($origin) && ! empty($originid)) {
@@ -1320,7 +1334,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($element == 'project') {
$projectid = $originid;
if (!$cond_reglement_id) {
$cond_reglement_id = $soc->cond_reglement_id;
}
@@ -1656,7 +1670,7 @@ if ($action == 'create' && $user->rights->commande->creer)
default:
$newclassname = $classname;
}
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
@@ -1918,7 +1932,7 @@ if ($action == 'create' && $user->rights->commande->creer)
/*
* Commande
*/
*/
$nbrow = 9;
if (! empty($conf->projet->enabled))
$nbrow ++;
@@ -2037,6 +2051,9 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</form>';
} else {
print $object->date ? dol_print_date($object->date, 'daytext') : '&nbsp;';
if ($object->hasDelay() && empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
print '</td>';
print '</tr>';
@@ -2059,6 +2076,9 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</form>';
} else {
print $object->date_livraison ? dol_print_date($object->date_livraison, 'daytext') : '&nbsp;';
if ($object->hasDelay() && ! empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
}
print '</td>';
print '</tr>';
@@ -2586,6 +2606,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+');
$file = $fileparams['fullname'];
// Define output language
@@ -2654,13 +2675,8 @@ if ($action == 'create' && $user->rights->commande->creer)
$formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit ['__ORDERREF__'] = $object->ref;
$formmail->substit ['__SIGNATURE__'] = $user->signature;
$formmail->substit ['__REFCLIENT__'] = $object->ref_client;
$formmail->substit ['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit ['__PERSONALIZED__'] = '';
$formmail->substit ['__CONTACTCIVNAME__'] = '';
$custcontact = '';
$contactarr = array();

View File

@@ -140,10 +140,6 @@ class Commande extends CommonOrder
*/
var $lines = array();
// Pour board
var $nbtodo;
var $nbtodolate;
// Multicurrency
var $fk_multicurrency;
var $multicurrency_code;
@@ -3224,7 +3220,7 @@ class Commande extends CommonOrder
$line->total_tva=19.6;
$line->remise_percent=0;
}
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
@@ -3436,6 +3432,22 @@ class Commande extends CommonOrder
return max($this->date_commande, $this->date_livraison) < ($now - $conf->commande->client->warning_delay);
}
/**
* Show the customer delayed info
*
* @return string Show delayed information
*/
public function showDelay()
{
global $conf, $langs;
if (empty($this->date_livraison)) $text=$langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day');
else $text=$text=$langs->trans("DeliveryDate").' '.dol_print_date($this->date_livraison, 'day');
$text.=' '.($conf->commande->client->warning_delay>0?'+':'-').' '.round(abs($conf->commande->client->warning_delay)/3600/24,1).' '.$langs->trans("days").' < '.$langs->trans("Today");
return $text;
}
}

View File

@@ -554,7 +554,7 @@ if ($resql)
// Warning late icon
print '<td class="nobordernopadding nowrap">';
if ($generic_commande->hasDelay()) {
print img_picto($langs->trans("Late"), "warning");
print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
}
if(!empty($objp->note_private))
{

View File

@@ -622,8 +622,10 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
//SEARCH BUTTON
print '<td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
//ALL/NONE
print '<td align="center" class="liste_titre">';
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall">'.$langs->trans("All").'</a> / <a href="#" id="checknone">'.$langs->trans("None").'</a>';
print '</td>';
@@ -697,7 +699,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error)
/*
* Boutons actions
*/
print '<br><div class="center"><input type="checkbox" checked name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
print '<br><div class="center"><input type="checkbox" '.(empty($conf->global->INVOICE_CLOSE_ORDERS_OFF_BY_DEFAULT_FORMASSINVOICE)?' checked="checked"':'').' name="autocloseorders"> '.$langs->trans("CloseProcessedOrdersAutomatically");
print '<div align="right">';
print '<input type="hidden" name="socid" value="'.$socid.'">';
print '<input type="hidden" name="action" value="create">';

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2011-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
*
@@ -209,29 +209,13 @@ if ($id > 0 || ! empty($ref))
$result=$object->fetch($id, $ref);
// Chargement des categories bancaires dans $options
$nbcategories=0;
// Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
$options = array();
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY label";
$result = $db->query($sql);
if ($result)
{
$var=True;
$num = $db->num_rows($result);
$i = 0;
$options = '<option value="0" selected>&nbsp;</option>';
while ($i < $num)
{
$obj = $db->fetch_object($result);
$options.= '<option value="'.$obj->rowid.'">'.$obj->label.'</option>'."\n";
$nbcategories++;
$i++;
}
$db->free($result);
foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
// Definition de sql_rech et param
@@ -397,15 +381,11 @@ if ($id > 0 || ! empty($ref))
}
}
if ($object->type != 2 && $object->rappro)
{
if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline ? '&amp;vline='.$vline : '').'">'.$langs->trans("Conciliate").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}
@@ -489,14 +469,14 @@ if ($id > 0 || ! empty($ref))
$form->select_date($dateop,'op',0,0,0,'transaction');
print '</td>';
print '<td class="nowrap">';
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == 2 ? 'LIQ' : '')),'operation','1,2',2,1);
$form->select_types_paiements((GETPOST('operation')?GETPOST('operation'):($object->courant == Account::TYPE_CASH ? 'LIQ' : '')),'operation','1,2',2,1);
print '</td><td>';
print '<input name="num_chq" class="flat" type="text" size="4" value="'.GETPOST("num_chq").'"></td>';
print '<td colspan="2">';
print '<input name="label" class="flat" type="text" size="24" value="'.GETPOST("label").'">';
if ($nbcategories)
{
print '<br>'.$langs->trans("Rubrique").': <select class="flat" name="cat1">'.$options.'</select>';
if ($options) {
print '<br>'.$langs->trans("Rubrique").': ';
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
}
print '</td>';
print '<td align=right><input name="debit" class="flat" type="text" size="4" value="'.GETPOST("debit").'"></td>';
@@ -529,8 +509,11 @@ if ($id > 0 || ! empty($ref))
print '<td align="right">'.$langs->trans("Credit").'</td>';
print '<td align="right" width="80">'.$langs->trans("BankBalance").'</td>';
print '<td align="center" width="60">';
if ($object->type != 2 && $object->rappro) print $langs->trans("AccountStatementShort");
else print '&nbsp;';
if ($object->canBeConciliated() > 0) {
print $langs->trans("AccountStatementShort");
} else {
print '&nbsp;';
}
print '</td></tr>';
print '<form action="'.$_SERVER["PHP_SELF"].'?'.$param.'" name="search" method="POST">';

View File

@@ -286,13 +286,13 @@ if ($action == 'create')
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">';
$formbank->select_type_comptes_financiers(isset($_POST["type"])?$_POST["type"]:1,"type");
$formbank->selectTypeOfBankAccount(isset($_POST["type"])?$_POST["type"]:1,"type");
print '</td></tr>';
// Currency
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
$selectedcode=$account->currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
@@ -302,7 +302,7 @@ if ($action == 'create')
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>';
// Country
@@ -369,10 +369,10 @@ if ($action == 'create')
print '</td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalAllowed").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->account_min_allowed).'"></td></tr>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_allowed" value="'.($_POST["account_min_allowed"]?$_POST["account_min_allowed"]:$account->min_allowed).'"></td></tr>';
print '<tr><td>'.$langs->trans("BalanceMinimalDesired").'</td>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>';
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->min_desired).'"></td></tr>';
print '</table>';
print '<br>';
@@ -583,7 +583,7 @@ else
// Currency
print '<tr><td>'.$langs->trans("Currency").'</td>';
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
$selectedcode=$account->currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
print $langs->trans("Currency".$selectedcode);
print '</td></tr>';
@@ -643,7 +643,7 @@ else
print '<br>';
if ($account->type == 0 || $account->type == 1)
if ($account->type == Account::TYPE_SAVINGS || $account->type == Account::TYPE_CURRENT)
{
print '<table class="border" width="100%">';
@@ -843,7 +843,7 @@ else
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("AccountType").'</td>';
print '<td colspan="3">';
$formbank->select_type_comptes_financiers((isset($_POST["type"])?$_POST["type"]:$account->type),"type");
$formbank->selectTypeOfBankAccount((isset($_POST["type"])?$_POST["type"]:$account->type),"type");
print '</td></tr>';
// Currency
@@ -851,7 +851,7 @@ else
print '<input type="hidden" value="'.$account->currency_code.'">';
print '</td>';
print '<td colspan="3">';
$selectedcode=$account->account_currency_code;
$selectedcode=$account->currency_code;
if (! $selectedcode) $selectedcode=$conf->currency;
print $form->selectCurrency((isset($_POST["account_currency_code"])?$_POST["account_currency_code"]:$selectedcode), 'account_currency_code');
//print $langs->trans("Currency".$conf->currency);
@@ -861,7 +861,7 @@ else
// Status
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td>';
print '<td colspan="3">';
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print $form->selectarray("clos", $account->status,(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
print '</td></tr>';
// Country
@@ -895,7 +895,7 @@ else
$conciliate=$account->canBeConciliated();
if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')';
else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')';
else print '<input type="checkbox" class="flat" name="norappro"'.($account->rappro?'':' checked').'"> '.$langs->trans("DisableConciliation");
else print '<input type="checkbox" class="flat" name="norappro"'.(($conciliate > 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation");
print '</td></tr>';
// Balance

View File

@@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
* 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
@@ -27,6 +28,7 @@
require('../../main.inc.php');
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$langs->load("banks");
$langs->load("categories");
@@ -36,70 +38,39 @@ $action=GETPOST('action');
if (!$user->rights->banque->configurer)
accessforbidden();
$bankcateg = new BankCateg($db);
$categid = GETPOST('categid');
$label = GETPOST("label");
/*
* Add category
*/
if (GETPOST('add'))
{
if (GETPOST("label"))
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ (";
$sql.= "label";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= "'".$db->escape(GETPOST("label"))."'";
$sql.= ", ".$conf->entity;
$sql.= ")";
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
if ($label) {
$bankcateg = new BankCateg($db);
$bankcateg->label = GETPOST('label');
$bankcateg->create($user);
}
}
/*
* Update category
*/
if (GETPOST('update'))
{
if (GETPOST("label"))
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ ";
$sql.= "set label='".$db->escape(GETPOST("label"))."'";
$sql.= " WHERE rowid = '".GETPOST('categid')."'";
$sql.= " AND entity = ".$conf->entity;
if ($categid) {
$bankcateg = new BankCateg($db);
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
if ($bankcateg->fetch($categid) > 0) {
//Update category
if (GETPOST('update') && $label) {
$bankcateg->label = $label;
$bankcateg->update($user);
}
//Delete category
if ($action == 'delete') {
$bankcateg->delete($user);
}
}
}
/*
* Action suppression catégorie
*/
if ($action == 'delete')
{
if (GETPOST('categid'))
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE rowid = '".GETPOST('categid')."'";
$sql.= " AND entity = ".$conf->entity;
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
}
/*
* View
@@ -174,5 +145,3 @@ if ($action != 'edit')
print '</table></form>';
llxFooter();
$db->close();

View File

@@ -139,7 +139,19 @@ class Account extends CommonObject
public $state_code;
public $state;
public $type_lib=array();
/**
* Variable containing all account types with their respective translated label.
* Defined in __construct
* @var array
*/
public $type_lib = array();
/**
* Variable containing all account statuses with their respective translated label.
* Defined in __construct
* @var array
*/
public $status = array();
/**
* Accountancy code
@@ -154,6 +166,13 @@ class Account extends CommonObject
*/
public $currency_code;
/**
* Currency code
* @var string
* @deprecated Use currency_code instead
*/
public $account_currency_code;
/**
* Authorized minimum balance
* @var float
@@ -205,7 +224,6 @@ class Account extends CommonObject
$this->db = $db;
$this->clos = 0;
$this->solde = 0;
$this->type_lib = array(
@@ -231,7 +249,7 @@ class Account extends CommonObject
global $conf;
if (empty($this->rappro)) return -1;
if ($this->courant == 2 && empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) return -2;
if ($this->courant == Account::TYPE_CASH && empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) return -2;
if ($this->clos) return -3;
return 1;
}
@@ -347,7 +365,7 @@ class Account extends CommonObject
* @param string $banque Bank of cheque writer
* @return int Rowid of added entry, <0 if KO
*/
function addline($date, $oper, $label, $amount, $num_chq, $categorie, $user, $emetteur='',$banque='')
function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='')
{
// Deprecatîon warning
if (is_numeric($oper)) {
@@ -388,7 +406,7 @@ class Account extends CommonObject
$this->error="this->rowid not defined";
return -2;
}
if ($this->courant == 2 && $oper != 'LIQ')
if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ')
{
$this->error="ErrorCashAccountAcceptsOnlyCashMoney";
return -3;
@@ -398,63 +416,55 @@ class Account extends CommonObject
$datev = $date;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (";
$sql.= "datec";
$sql.= ", dateo";
$sql.= ", datev";
$sql.= ", label";
$sql.= ", amount";
$sql.= ", fk_user_author";
$sql.= ", num_chq";
$sql.= ", fk_account";
$sql.= ", fk_type";
$sql.= ",emetteur,banque";
$sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."'";
$sql.= ", '".$this->db->idate($date)."'";
$sql.= ", '".$this->db->idate($datev)."'";
$sql.= ", '".$this->db->escape($label)."'";
$sql.= ", ".price2num($amount);
$sql.= ", '".$user->id."'";
$sql.= ", ".($num_chq?"'".$num_chq."'":"null");
$sql.= ", '".$this->rowid."'";
$sql.= ", '".$oper."'";
$sql.= ", ".($emetteur?"'".$this->db->escape($emetteur)."'":"null");
$sql.= ", ".($banque?"'".$this->db->escape($banque)."'":"null");
$sql.= ")";
$accline = new AccountLine($this->db);
$accline->datec = $now;
$accline->dateo = $date;
$accline->datev = $datev;
$accline->label = $label;
$accline->amount = $amount;
$accline->fk_user_author = $user->id;
$accline->fk_account = $this->rowid;
$accline->fk_type = $oper;
dol_syslog(get_class($this)."::addline", LOG_DEBUG);
if ($this->db->query($sql))
{
$rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank");
if ($categorie)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (";
$sql.= "lineid";
$sql.= ", fk_categ";
$sql.= ") VALUES (";
$sql.= "'".$rowid."'";
$sql.= ", '".$categorie."'";
$sql.= ")";
if ($num_chq) {
$accline->num_chq = $num_chq;
}
$result = $this->db->query($sql);
if (! $result)
{
$this->db->rollback();
$this->error=$this->db->error();
return -3;
}
}
$this->db->commit();
return $rowid;
}
else
{
$this->error=$this->db->lasterror();
$this->db->rollback();
return -2;
}
}
if ($emetteur) {
$accline->emetteur = $emetteur;
}
if ($banque) {
$accline->bank_chq = $banque;
}
if ($accline->insert() > 0) {
if ($categorie) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (";
$sql .= "lineid";
$sql .= ", fk_categ";
$sql .= ") VALUES (";
$sql .= "'".$accline->id."'";
$sql .= ", '".$categorie."'";
$sql .= ")";
$result = $this->db->query($sql);
if (!$result) {
$this->db->rollback();
$this->error = $this->db->error();
return -3;
}
}
$this->db->commit();
return $accline->id;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return -2;
}
}
/**
* Create bank account into database
@@ -462,7 +472,7 @@ class Account extends CommonObject
* @param User $user Object user making creation
* @return int < 0 if KO, > 0 if OK
*/
function create($user='')
function create(User $user = null)
{
global $langs,$conf, $hookmanager;
@@ -556,32 +566,18 @@ class Account extends CommonObject
$result=$this->update();
if ($result > 0)
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (";
$sql.= "datec";
$sql.= ", label";
$sql.= ", amount";
$sql.= ", fk_account";
$sql.= ", datev";
$sql.= ", dateo";
$sql.= ", fk_type";
$sql.= ", rappro";
$sql.= ") VALUES (";
$sql.= "'".$this->db->idate($now)."'";
$sql.= ", '(".$langs->trans("InitialBankBalance").")'";
$sql.= ", ".price2num($this->solde);
$sql.= ", '".$this->id."'";
$sql.= ", '".$this->db->idate($this->date_solde)."'";
$sql.= ", '".$this->db->idate($this->date_solde)."'";
$sql.= ", 'SOLD'";
$sql.= ", 0"; // Not conciliated by default
$sql.= ")";
$accline = new AccountLine($this->db);
$accline->datec = $this->db->idate($now);
$accline->label = '('.$langs->trans("InitialBankBalance").')';
$accline->amount = price2num($this->solde);
$accline->fk_account = $this->id;
$accline->datev = $this->db->idate($this->date_solde);
$accline->dateo = $this->db->idate($this->date_solde);
$accline->fk_type = 'SOLD';
$resql=$this->db->query($sql);
if (! $resql)
{
$this->error=$this->db->lasterror();
return -3;
}
if ($accline->insert() < 0) {
return -3;
}
// Actions on extra fields (by external module or standard code)
$hookmanager->initHooks(array('bankdao'));
@@ -622,7 +618,7 @@ class Account extends CommonObject
* @param User $user Object user making action
* @return int <0 si ko, >0 si ok
*/
function update($user='')
function update(User $user = null)
{
global $langs,$conf, $hookmanager;
@@ -720,7 +716,7 @@ class Account extends CommonObject
* @param User $user Object user making update
* @return int <0 if KO, >0 if OK
*/
function update_bban($user='')
function update_bban(User $user = null)
{
global $conf,$langs;
@@ -812,7 +808,7 @@ class Account extends CommonObject
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->rowid = $obj->rowid; // deprecated
$this->rowid = $obj->rowid;
$this->ref = $obj->ref;
$this->label = $obj->label;
$this->type = $obj->courant;
@@ -878,7 +874,7 @@ class Account extends CommonObject
* @param User $user User deleting
* @return int <0 if KO, >0 if OK
*/
function delete($user='')
function delete(User $user = null)
{
global $conf;
@@ -928,42 +924,32 @@ class Account extends CommonObject
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/
function LibStatut($statut,$mode=0)
{
global $langs;
$langs->load('banks');
function LibStatut($statut, $mode = 0)
{
global $langs;
$langs->load('banks');
if ($mode == 0)
{
if ($statut==0) return $langs->trans("StatusAccountOpened");
if ($statut==1) return $langs->trans("StatusAccountClosed");
}
if ($mode == 1)
{
if ($statut==0) return $langs->trans("StatusAccountOpened");
if ($statut==1) return $langs->trans("StatusAccountClosed");
}
if ($mode == 2)
{
if ($statut==0) return img_picto($langs->trans("StatusAccountOpened"),'statut4').' '.$langs->trans("StatusAccountOpened");
if ($statut==1) return img_picto($langs->trans("StatusAccountClosed"),'statut5').' '.$langs->trans("StatusAccountClosed");
}
if ($mode == 3)
{
if ($statut==0) return img_picto($langs->trans("StatusAccountOpened"),'statut4');
if ($statut==1) return img_picto($langs->trans("StatusAccountClosed"),'statut5');
}
if ($mode == 4)
{
if ($statut==0) return img_picto($langs->trans("StatusAccountOpened"),'statut4').' '.$langs->trans("StatusAccountOpened");
if ($statut==1) return img_picto($langs->trans("StatusAccountClosed"),'statut5').' '.$langs->trans("StatusAccountClosed");
}
if ($mode == 5)
{
if ($statut==0) return $langs->trans("StatusAccountOpened").' '.img_picto($langs->trans("StatusAccountOpened"),'statut4');
if ($statut==1) return $langs->trans("StatusAccountClosed").' '.img_picto($langs->trans("StatusAccountClosed"),'statut5');
}
}
if ($statut == self::STATUS_OPEN) {
$label = $langs->trans("StatusAccountOpened");
$picto = img_picto($label, 'statut4');
} else {
$label = $langs->trans("StatusAccountClosed");
$picto = img_picto($label, 'statut5');
}
if ($mode == 2) {
return $picto.' '.$label;
} elseif ($mode == 3) {
return $picto;
} elseif ($mode == 4) {
return $picto.' '.$label;
} elseif ($mode == 5) {
return $label.' '.$picto;
}
//There is no short mode for this label
return $label;
}
/**
@@ -1034,7 +1020,7 @@ class Account extends CommonObject
* @param int $filteraccountid To get info for a particular account id
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
*/
function load_board($user,$filteraccountid=0)
function load_board(User $user, $filteraccountid = 0)
{
global $conf, $langs;
@@ -1082,6 +1068,34 @@ class Account extends CommonObject
}
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
* @return int Nb of account we can reconciliate
*/
public static function countAccountToReconcile()
{
global $db, $conf, $langs;
if ($user->societe_id) return 0; // protection pour eviter appel par utilisateur externe
$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";
if (empty($conf->global->BANK_CAN_RECONCILIATE_CASHACCOUNT)) $sql.= " AND ba.courant != 2";
$resql=$db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($resql);
$nb = $obj->nb;
}
else dol_print_error($db);
return $nb;
}
/**
* Return clicable name (with picto eventually)
*
@@ -1229,8 +1243,8 @@ class Account extends CommonObject
$this->ref = 'MBA';
$this->label = 'My Bank account';
$this->bank = 'MyBank';
$this->courant = 1;
$this->clos = 0;
$this->courant = Account::TYPE_CURRENT;
$this->clos = Account::STATUS_OPEN;
$this->code_banque = '123';
$this->code_guichet = '456';
$this->number = 'ABC12345';
@@ -1280,13 +1294,14 @@ class AccountLine extends CommonObject
var $fk_account; // Id of bank account
var $bank_account_label; // Label of bank account
public $emetteur;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
function __construct(DoliDB $db)
{
$this->db = $db;
}
@@ -1348,7 +1363,7 @@ class AccountLine extends CommonObject
$this->num_releve = $obj->num_releve;
$this->num_chq = $obj->num_chq;
$this->bank_chq = $obj->bank_chq;
$this->bank_chq = $obj->banque;
$this->fk_bordereau = $obj->fk_bordereau;
$this->fk_account = $obj->fk_account;
@@ -1366,6 +1381,52 @@ class AccountLine extends CommonObject
}
}
/**
* Inserts a transaction to a bank account
*
* @return int <0 if KO, rowid of the line if OK
*/
public function insert()
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (";
$sql .= "datec";
$sql .= ", dateo";
$sql .= ", datev";
$sql .= ", label";
$sql .= ", amount";
$sql .= ", fk_user_author";
$sql .= ", num_chq";
$sql .= ", fk_account";
$sql .= ", fk_type";
$sql .= ",emetteur,banque";
$sql .= ", rappro";
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->datec)."'";
$sql .= ", '".$this->db->idate($this->dateo)."'";
$sql .= ", '".$this->db->idate($this->datev)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".price2num($this->amount);
$sql .= ", '".$this->fk_user_author."'";
$sql .= ", ".($this->num_chq ? "'".$this->num_chq."'" : "null");
$sql .= ", '".$this->fk_account."'";
$sql .= ", '".$this->db->escape($this->fk_type)."'";
$sql .= ", ".($this->emetteur ? "'".$this->db->escape($this->emetteur)."'" : "null");
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
$sql .= ", ".(int) $this->rappro;
$sql .= ")";
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$this->error = $this->db->lasterror();
return -1;
}
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'bank');
return $this->id;
}
/**
* Delete transaction bank line record
@@ -1373,7 +1434,7 @@ class AccountLine extends CommonObject
* @param User $user User object that delete
* @return int <0 if KO, >0 if OK
*/
function delete($user=null)
function delete(User $user = null)
{
$nbko=0;
@@ -1422,7 +1483,7 @@ class AccountLine extends CommonObject
* @param User $user User object that delete
* @return int <0 if KO, >0 if OK
*/
function delete_urls($user=null)
function delete_urls(User $user = null)
{
$nbko=0;
@@ -1460,7 +1521,7 @@ class AccountLine extends CommonObject
* @param int $notrigger 0=Disable all triggers
* @return int <0 if KO, >0 if OK
*/
function update($user,$notrigger=0)
function update(User $user, $notrigger = 0)
{
$this->db->begin();
@@ -1493,7 +1554,7 @@ class AccountLine extends CommonObject
* @param int $cat Category id
* @return int <0 if KO, >0 if OK
*/
function update_conciliation($user,$cat)
function update_conciliation(User $user, $cat)
{
$this->db->begin();

View File

@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.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
@@ -17,346 +18,294 @@
*/
/**
* \file compta/bank/class/bankcateg.class.php
* \ingroup banque
* \brief This file is CRUD class file (Create/Read/Update/Delete) for bank categories
* \author Laurent Destailleur
* \file compta/bank/class/bankcateg.class.php
* \ingroup bank
* \brief This file is CRUD class file (Create/Read/Update/Delete) for bank categories
*/
// Put here all includes required by your class file
//require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
//require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
//require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
/**
* Class to manage bank categories
* Class to manage bank categories
*/
class BankCateg // extends CommonObject
{
//public $element='bank_categ'; //!< Id that identify managed objects
//public $table_element='bank_categ'; //!< Name of table without prefix where object is stored
//public $element='bank_categ'; //!< Id that identify managed objects
//public $table_element='bank_categ'; //!< Name of table without prefix where object is stored
var $id;
var $label;
public $id;
public $label;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
return 1;
}
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db)
{
$this->db = $db;
}
/**
* Create in database
*
* @param User $user User that create
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
function create($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
/**
* Create in database
*
* @param User $user User that create
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, Id of created object if OK
*/
public function create(User $user, $notrigger = 0)
{
global $conf;
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
$error = 0;
// Check parameters
// Put here code to add control on parameters values
// Clean parameters
if (isset($this->label)) {
$this->label = trim($this->label);
}
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ (";
$sql.= "label";
$sql.= ", entity";
$sql.= ") VALUES (";
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'")."";
$sql.= ", ".$conf->entity;
$sql.= ")";
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ (";
$sql .= "label";
$sql .= ", entity";
$sql .= ") VALUES (";
$sql .= " ".(!isset($this->label) ? 'NULL' : "'".$this->db->escape($this->label)."'")."";
$sql .= ", ".$conf->entity;
$sql .= ")";
$this->db->begin();
$this->db->begin();
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
if (! $error)
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_categ");
if (!$error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_categ");
}
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return $this->id;
}
}
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Load object in memory from database
*
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
{
global $langs,$conf;
/**
* Load object in memory from database
*
* @param int $id Id object
* @return int <0 if KO, >0 if OK
*/
public function fetch($id)
{
global $conf;
$sql = "SELECT";
$sql.= " t.rowid,";
$sql.= " t.label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ as t";
$sql.= " WHERE t.rowid = ".$id;
$sql.= " AND t.entity = ".$conf->entity;
$sql = "SELECT";
$sql .= " t.rowid,";
$sql .= " t.label";
$sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as t";
$sql .= " WHERE t.rowid = ".$id;
$sql .= " AND t.entity = ".$conf->entity;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
if ($this->db->num_rows($resql))
{
$obj = $this->db->fetch_object($resql);
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->label = $obj->label;
}
$this->db->free($resql);
$this->id = $obj->rowid;
$this->label = $obj->label;
}
$this->db->free($resql);
return 1;
}
else
{
$this->error="Error ".$this->db->lasterror();
return -1;
}
}
return 1;
} else {
$this->error = "Error ".$this->db->lasterror();
return -1;
}
}
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function update(User $user = null, $notrigger = 0)
{
global $conf;
$error = 0;
/**
* Update database
*
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user=null, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Clean parameters
if (isset($this->label)) {
$this->label = trim($this->label);
}
// Clean parameters
if (isset($this->label)) $this->label=trim($this->label);
// Check parameters
// Put here code to add control on parameters values
// Check parameters
// Put here code to add control on parameters values
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET";
$sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null")."";
$sql .= " WHERE rowid=".$this->id;
$sql .= " AND entity = ".$conf->entity;
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET";
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null")."";
$sql.= " WHERE rowid=".$this->id;
$sql.= " AND entity = ".$conf->entity;
$this->db->begin();
$this->db->begin();
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
dol_syslog(get_class($this)."::update", 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(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->db->commit();
return 1;
}
}
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
public function delete(User $user, $notrigger = 0)
{
global $conf;
$error = 0;
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql .= " WHERE rowid=".$this->id;
$sql .= " AND entity = ".$conf->entity;
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
$this->db->begin();
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
$this->errors[] = "Error ".$this->db->lasterror();
}
/**
* Delete object in database
*
* @param User $user User that delete
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger=0)
{
global $conf, $langs;
$error=0;
// Commit or rollback
if ($error) {
foreach ($this->errors as $errmsg) {
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error .= ($this->error ? ', '.$errmsg : $errmsg);
}
$this->db->rollback();
return -1 * $error;
} else {
$this->db->commit();
return 1;
}
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " WHERE rowid=".$this->id;
$sql.= " AND entity = ".$conf->entity;
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
public function createFromClone($fromid)
{
global $user;
$this->db->begin();
$error = 0;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $error)
{
if (! $notrigger)
{
// Uncomment this and change MYOBJECT to your own tag if you
// want this action call a trigger.
//// Call triggers
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
//$interface=new Interfaces($this->db);
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
//// End call triggers
}
}
// Commit or rollback
if ($error)
{
foreach($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
$this->error.=($this->error?', '.$errmsg:$errmsg);
}
$this->db->rollback();
return -1*$error;
}
else
{
$this->db->commit();
return 1;
}
}
/**
* Load an object from its id and create a new one in database
*
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
function createFromClone($fromid)
{
global $user,$langs;
$error=0;
$object=new BankCateg($this->db);
$object = new BankCateg($this->db);
$object->context['createfromclone'] = 'createfromclone';
$this->db->begin();
// Load source object
$object->fetch($fromid);
$object->id=0;
$object->statut=0;
// Load source object
$object->fetch($fromid);
$object->id = 0;
$object->statut = 0;
// Clear fields
// ...
// Create clone
$result = $object->create($user);
// Create clone
$result=$object->create($user);
// Other options
if ($result < 0) {
$this->error = $object->error;
$error++;
}
// Other options
if ($result < 0)
{
$this->error=$object->error;
$error++;
}
unset($object->context['createfromclone']);
if (! $error)
{
// End
if (!$error) {
$this->db->commit();
return $object->id;
} else {
$this->db->rollback();
return -1;
}
}
/**
* Returns all bank categories
*
* @return BankCateg[]
*/
public function fetchAll()
{
global $conf;
$return = array();
}
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ WHERE entity = ".$conf->entity." ORDER BY label";
$resql = $this->db->query($sql);
unset($object->context['createfromclone']);
if ($resql) {
while ($obj = $this->db->fetch_object($resql)) {
$tmp = new BankCateg($this->db);
$tmp->id = $obj->rowid;
$tmp->label = $obj->label;
// End
if (! $error)
{
$this->db->commit();
return $object->id;
}
else
{
$this->db->rollback();
return -1;
}
}
$return[] = $tmp;
}
}
return $return;
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
function initAsSpecimen()
{
$this->id=0;
$this->label='';
}
/**
* Initialise an instance with random values.
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return void
*/
public function initAsSpecimen()
{
$this->id = 0;
$this->label = '';
}
}

View File

@@ -6,6 +6,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 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
@@ -102,7 +103,7 @@ if ($user->rights->banque->modifier && $action == "update")
$ac = new Account($db);
$ac->fetch($id);
if ($ac->courant == 2 && $_POST['value'] != 'LIQ')
if ($ac->courant == Account::TYPE_CASH && $_POST['value'] != 'LIQ')
{
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
$error++;
@@ -205,24 +206,13 @@ $form = new Form($db);
llxHeader();
// The list of categories is initialized
$sql = "SELECT rowid, label";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_categ";
$sql.= " ORDER BY label";
$result = $db->query($sql);
if ($result)
{
$var=True;
$num = $db->num_rows($result);
$i = 0;
$options = "<option value=\"0\" selected>&nbsp;</option>";
while ($i < $num)
{
$obj = $db->fetch_object($result);
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n";
$i++;
}
$db->free($result);
// Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
$options = array();
foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
$var=false;
@@ -620,7 +610,7 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Rubriques").'</td><td colspan="2">';
if ($user->rights->banque->modifier)
{
print '<select class="flat" name="cat1">'.$options.'</select>&nbsp;';
print Form::selectarray('cat1', $options, '', 1).' ';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'"></td>';
}
print '</tr>';

View File

@@ -3,6 +3,7 @@
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* 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
@@ -111,28 +112,13 @@ if ($action == 'del')
}
}
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
$options = array();
// Load bank groups
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
$resql = $db->query($sql);
$options="";
if ($resql)
{
$var=True;
$num = $db->num_rows($resql);
if ($num > 0) $options .= '<option value="0"'.(GETPOST('cat')?'':' selected').'>&nbsp;</option>';
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$options .= '<option value="'.$obj->rowid.'"'.(GETPOST('cat')==$obj->rowid?' selected':'').'>'.$obj->label.'</option>'."\n";
$i++;
}
$db->free($resql);
//print $options;
foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
}
else dol_print_error($db);
/*
* View
@@ -236,10 +222,11 @@ if ($resql)
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
print '<input class="flat" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
print '<br>';
if ($options)
{
print $langs->trans("EventualyAddCategory").': <select class="flat" name="cat">'.$options.'</select><br>';
}
if ($options) {
print $langs->trans("EventualyAddCategory").': ';
print Form::selectarray('cat', $options, GETPOST('cat'), 1);
print '<br>';
}
print '<br>'.$langs->trans("ThenCheckLinesAndConciliate").' "'.$langs->trans("Conciliate").'"<br>';
print '<br>';
@@ -440,14 +427,6 @@ if ($resql)
print '<td align="center" class="nowrap">';
print '<input class="flat" name="rowid['.$objp->rowid.']" type="checkbox" value="'.$objp->rowid.'" size="1"'.(! empty($_POST['rowid'][$objp->rowid])?' checked':'').'>';
// print '<input class="flat" name="num_releve" type="text" value="'.$objp->num_releve.'" size="8">';
// print ' &nbsp; ';
// print "<input class=\"button\" type=\"submit\" value=\"".$langs->trans("Conciliate")."\">";
// if ($options)
// {
// print "<br><select class=\"flat\" name=\"cat\">$options";
// print "</select>";
// }
print "</td>";
}
else

View File

@@ -143,16 +143,12 @@ if (empty($num))
dol_fiche_end();
print '<div class="tabsAction">';
if ($object->type != 2 && $object->rappro)
{
if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate)
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline?'&amp;vline='.$vline:'').'">'.$langs->trans("Conciliate").'</a>';
}
else
{
if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/rappro.php?account='.$object->id.($vline ? '&amp;vline='.$vline : '').'">'.$langs->trans("Conciliate").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
}

View File

@@ -93,7 +93,7 @@ if ($action == 'add')
// By default, electronic transfert from bank to bank
$typefrom='PRE';
$typeto='VIR';
if ($accountto->courant == 2 || $accountfrom->courant == 2)
if ($accountto->courant == Account::TYPE_CASH || $accountfrom->courant == Account::TYPE_CASH)
{
// This is transfert of change
$typefrom='LIQ';

View File

@@ -783,10 +783,17 @@ if (empty($reshook))
$facture_source = new Facture($db); // fetch origin object
if ($facture_source->fetch($object->fk_facture_source)>0)
{
$fk_parent_line = 0;
foreach($facture_source->lines as $line)
{
// Reset fk_parent_line for no child products and special product
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
$fk_parent_line = 0;
}
$line->fk_facture = $object->id;
$line->fk_parent_line = $fk_parent_line;
$line->subprice =-$line->subprice; // invert price for object
$line->pa_ht = -$line->pa_ht;
@@ -796,9 +803,14 @@ if (empty($reshook))
$line->total_localtax1=-$line->total_localtax1;
$line->total_localtax2=-$line->total_localtax2;
$line->insert();
$result = $line->insert();
$object->lines[] = $line; // insert new line in current object
// Defined the new fk_parent_line
if ($result > 0 && $line->product_type == 9) {
$fk_parent_line = $result;
}
}
$object->update_price(1);
@@ -1594,7 +1606,7 @@ if (empty($reshook))
$line = new FactureLigne($db);
$line->fetch(GETPOST('lineid'));
$percent = $line->get_prev_progress();
$percent = $line->get_prev_progress($object->id);
if (GETPOST('progress') < $percent)
{
@@ -1712,7 +1724,7 @@ if (empty($reshook))
{
foreach ($object->lines as $line)
{
$percent = $line->get_prev_progress();
$percent = $line->get_prev_progress($object->id);
if (GETPOST('all_progress') < $percent) {
$mesg = '<div class="warning">' . $langs->trans("CantBeLessThanMinPercent") . '</div>';
$result = -1;
@@ -1911,7 +1923,7 @@ if ($action == 'create')
if ($element == 'project') {
$projectid = $originid;
if (!$cond_reglement_id) {
$cond_reglement_id = $soc->cond_reglement_id;
}
@@ -1924,7 +1936,7 @@ if ($action == 'create')
if (!$dateinvoice) {
// Do not set 0 here (0 for a date is 1970)
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice);
}
}
} else {
// For compatibility
if ($element == 'order' || $element == 'commande') {
@@ -2667,7 +2679,7 @@ else if ($id > 0 || ! empty($ref))
$qualified_for_stock_change = $object->hasProductsOrServices(1);
}
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1)
if ($object->type != Facture::TYPE_DEPOSIT && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $qualified_for_stock_change && $object->statut >= 1)
{
$langs->load("stocks");
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
@@ -2858,7 +2870,7 @@ else if ($id > 0 || ! empty($ref))
}
// Clone confirmation
if ($action == 'clone')
if ($action == 'clone')
{
// Create an array for form
$formquestion = array(
@@ -2869,7 +2881,7 @@ else if ($id > 0 || ! empty($ref))
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('CloneInvoice'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}
if (! $formconfirm)
if (! $formconfirm)
{
$parameters = array('lineid' => $lineid);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
@@ -3818,14 +3830,14 @@ else if ($id > 0 || ! empty($ref))
// modified by hook
if (empty($reshook)) {
// Editer une facture deja validee, sans paiement effectue et pas exporte en compta
if ($object->statut == 1)
if ($object->statut == 1)
{
// On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees
$ventilExportCompta = $object->getVentilExportCompta();
if ($resteapayer == $object->total_ttc && empty($object->paye) && $ventilExportCompta == 0)
if ($resteapayer == $object->total_ttc && empty($object->paye) && $ventilExportCompta == 0)
{
if (! $objectidnext)
if (! $objectidnext && $object->is_last_in_cycle())
{
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
@@ -4150,14 +4162,8 @@ else if ($id > 0 || ! empty($ref))
$formmail->withdeliveryreceipt = 1;
$formmail->withcancel = 1;
// Tableau des substitutions
$formmail->substit['__REF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
$formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit['__CONTACTCIVNAME__'] = '';
$formmail->setSubstitFromObject($object);
$formmail->substit['__INVREF__'] = $object->ref;
// Find the good contact adress
$custcontact = '';

View File

@@ -3566,7 +3566,7 @@ class Facture extends CommonInvoice
$line->remise_percent=0;
if ($xnbp == 1) // Qty is negative (product line)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->qty=-1;
$line->total_ht=-100;
@@ -3583,7 +3583,7 @@ class Facture extends CommonInvoice
}
else if ($xnbp == 3) // Discount is 50% (product line)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->total_ht=50;
$line->total_ttc=59.8;
@@ -3592,7 +3592,7 @@ class Facture extends CommonInvoice
}
else // (product line)
{
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->total_ht=100;
$line->total_ttc=119.6;
@@ -3621,7 +3621,7 @@ class Facture extends CommonInvoice
$line->total_ht=0;
$line->total_ttc=0; // 90 * 1.196
$line->total_tva=0;
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
@@ -4533,15 +4533,22 @@ class FactureLigne extends CommonInvoiceLine
}
/**
* Returns situation_percent of the previous line
* Returns situation_percent of the previous line.
* Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line.
*
* @return int >= 0
* @param int $invoiceid Invoice id
* @return int >= 0
*/
function get_prev_progress()
function get_prev_progress($invoiceid)
{
if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") {
return 0;
} else {
// If invoice is a not a situation invoice, this->fk_prev_id is used for something else
$tmpinvoice=new Facture($this->db);
$tmpinvoice->fetch($invoiceid);
if ($tmpinvoice->type != Facture::TYPE_SITUATION) return 0;
$sql = 'SELECT situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet WHERE rowid=' . $this->fk_prev_id;
$resql = $this->db->query($sql);
if ($resql && $resql->num_rows > 0) {

View File

@@ -1027,7 +1027,7 @@ else
print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecord,'title_accountancy.png',0,'','',$limit);
print $langs->trans("ToCreateAPredefinedInvoice").'<br><br>';
print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'<br><br>';
$i = 0;
print '<table class="noborder" width="100%">';

View File

@@ -61,6 +61,7 @@ $ref=GETPOST('ref','alpha');
$socid=GETPOST('socid','int');
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
$show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha');
$lineid=GETPOST('lineid','int');
$userid=GETPOST('userid','int');
@@ -131,7 +132,8 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
*/
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
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -533,8 +535,8 @@ if (empty($reshook))
$upload_dir = $diroutputpdf;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
$action='';
}
@@ -714,6 +716,7 @@ if ($resql)
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
if ($search_paymentmode > 0) $param.='search_paymentmode='.$search_paymentmode;
if ($show_files) $param.='&show_files=' .$show_files;
$param.=(! empty($option)?"&amp;option=".$option:"");
$massactionbutton=$form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
@@ -1055,7 +1058,7 @@ if ($resql)
print "</form>\n";
$db->free($resql);
if ($massaction == 'builddoc' || $action == 'remove_file')
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files)
{
/*
* Show list of available documents
@@ -1067,10 +1070,16 @@ if ($resql)
$genallowed=$user->rights->facture->lire;
$delallowed=$user->rights->facture->lire;
print '<br>';
// We disable multilang because we concat already existing pdf.
$formfile->show_documents('unpaid','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$langs->trans("PDFMerge"),'');
}
print '<br><a name="show_files"></a>';
$paramwithoutshowfiles=preg_replace('/show_files=1&?/','',$param);
$title=$langs->trans("MassFilesArea").' <a href="'.$_SERVER["PHP_SELF"].'?'.$paramwithoutshowfiles.'">('.$langs->trans("Hide").')</a>';
$formfile->show_documents('massfilesarea','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'');
}
else
{
print '<br><a name="show_files"></a><a href="'.$_SERVER["PHP_SELF"].'?show_files=1'.$param.'#show_files">'.$langs->trans("ShowTempMassFilesArea").'</a>';
}
}
else
{

File diff suppressed because it is too large Load Diff

View File

@@ -454,7 +454,7 @@ if ($object->id > 0)
/*
* Withdrawal request
* Withdrawal opened requests
*/
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande";
@@ -564,6 +564,8 @@ if ($object->id > 0)
dol_print_error($db);
}
// Closed requests
$sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande,";
$sql.= " pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,";
$sql.= " pb.ref,";

View File

@@ -97,7 +97,7 @@ if (count($listofsearchfields))
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr '.$bc[false].'>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;

View File

@@ -116,7 +116,7 @@ if (count($listofsearchfields))
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr '.$bc[false].'>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="14"></td>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="14"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;

View File

@@ -166,14 +166,15 @@ if ($result)
// Situation invoices handling
$line = new FactureLigne($db);
$line->fetch($obj->id);
$prev_progress = $line->get_prev_progress();
$line->fetch($obj->id); // id of line
$prev_progress = 0;
if ($obj->type==Facture::TYPE_SITUATION) {
// Avoid divide by 0
if ($obj->situation_percent == 0) {
$situation_ratio = 0;
} else {
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
$prev_progress = $line->get_prev_progress($obj->rowid); // id on invoice
$situation_ratio = ($obj->situation_percent - $prev_progress) / $obj->situation_percent;
}
} else {
$situation_ratio = 1;

View File

@@ -77,7 +77,7 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
else
{
$db->rollback();
$mesg='<div class="error">'.$localtax->error.'</div>';
setEventMessages($localtax->error, $localtax->errors, 'errors');
$_GET["action"]="create";
}
}
@@ -112,18 +112,19 @@ if ($_GET["action"] == 'delete')
{
$localtax->error=$accountline->error;
$db->rollback();
$mesg='<div class="error">'.$localtax->error.'</div>';
setEventMessages($localtax->error, $localtax->errors, 'errors');
}
}
else
{
$db->rollback();
$mesg='<div class="error">'.$localtax->error.'</div>';
setEventMessages($localtax->error, $localtax->errors, 'errors');
}
}
else
{
$mesg='<div class="error">Error try do delete a line linked to a conciliated bank transaction</div>';
$mesg='Error try do delete a line linked to a conciliated bank transaction';
setEventMessages($mesg, null, 'errors');
}
}

View File

@@ -65,11 +65,13 @@ if ($action == 'create')
$result=$bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET);
if ($result < 0)
{
$mesg='<div class="error">'.$bprev->error.'</div>';
setEventMessages($bprev->error, $bprev->errors, 'errors');
}
if ($result == 0)
{
$mesg='<div class="error">'.$langs->trans("NoInvoiceCouldBeWithdrawed").'</div>';
$mesg='';
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed");
setEventMessages($mesg, null, 'errors');
foreach($bprev->invoice_in_error as $key => $val)
{
$mesg.=$val."<br>\n";

View File

@@ -2147,7 +2147,7 @@ class Contrat extends CommonObject
$line->total_ht=90;
$line->total_ttc=107.64; // 90 * 1.196
$line->total_tva=17.64;
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$this->lines[$xnbp]=$line;
$xnbp++;

View File

@@ -103,8 +103,9 @@ class CMailFile
* @param string $errors_to Email for errors-to
* @param string $css Css option
* @param string $trackid Tracking string
* @param string $moreinheader More in header (for phpmail only for the moment)
*/
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='')
function __construct($subject,$to,$from,$msg,$filename_list=array(),$mimetype_list=array(),$mimefilename_list=array(),$addr_cc="",$addr_bcc="",$deliveryreceipt=0,$msgishtml=0,$errors_to='',$css='',$trackid='',$moreinheader='')
{
global $conf;
@@ -199,7 +200,8 @@ class CMailFile
$this->deliveryreceipt = $deliveryreceipt;
$this->trackid = $trackid;
$smtp_headers = $this->write_smtpheaders();
if (! empty($moreinheader)) $smtp_headers.=$moreinheader;
// Define mime_headers
$mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list);
@@ -259,7 +261,7 @@ class CMailFile
$smtps->setFrom($this->getValidAddress($from,0,1));
$smtps->setTrackId($trackid);
$smtps->setReplyTo($this->getValidAddress($from,0,1)); // Set property with this->smtps->setReplyTo after constructor if you want to use another value than the From
if (! empty($this->html))
{
if (!empty($css))

View File

@@ -4326,8 +4326,8 @@ class Form
$syear = '';
$smonth = '';
$sday = '';
$shour = '';
$smin = '';
$shour = !isset($conf->global->MAIN_DEFAULT_DATE_HOUR) ? '' : $conf->global->MAIN_DEFAULT_DATE_HOUR;
$smin = !isset($conf->global->MAIN_DEFAULT_DATE_MIN) ? '' : $conf->global->MAIN_DEFAULT_DATE_MIN;
}
$usecalendar='combo';

View File

@@ -49,32 +49,11 @@ class FormBank
* @param string $htmlname Nom champ formulaire
* @return void
*/
function select_type_comptes_financiers($selected=1,$htmlname='type')
public function selectTypeOfBankAccount($selected = Account::TYPE_CURRENT, $htmlname = 'type')
{
global $langs;
$langs->load("banks");
$account = new Account($this->db);
$type_available=array(0,1,2);
print '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">';
$num = count($type_available);
$i = 0;
if ($num)
{
while ($i < $num)
{
if ($selected == $type_available[$i])
{
print '<option value="'.$type_available[$i].'" selected>'.$langs->trans("BankType".$type_available[$i]).'</option>';
}
else
{
print '<option value="'.$type_available[$i].'">'.$langs->trans("BankType".$type_available[$i]).'</option>';
}
$i++;
}
}
print '</select>';
print Form::selectarray($htmlname, $account->type_lib, $selected);
}
}

View File

@@ -109,7 +109,10 @@ class FormFile
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp*1;
if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024;
if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024;
if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024;
// Now $max and $maxphp are in Kb
if ($maxphp > 0) $max=min($max,$maxphp);
@@ -796,6 +799,7 @@ class FormFile
// Show list of existing files
if (empty($useinecm)) print load_fiche_titre($title?$title:$langs->trans("AttachedFiles"));
if (empty($url)) $url=$_SERVER["PHP_SELF"];
print '<!-- html.formfile::list_of_documents -->'."\n";
print '<table width="100%" class="'.($useinecm?'nobordernopadding':'liste').'">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
@@ -829,10 +833,9 @@ class FormFile
{
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
}
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>';
print '<td class="tdoverflow">';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
if ($forcedownload) print '&attachment=1';
@@ -849,11 +852,12 @@ class FormFile
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
if ($showrelpart == 1) print $relativepath;
print dol_trunc($file['name'],$maxlength,'middle');
//print dol_trunc($file['name'],$maxlength,'middle');
print $file['name'];
print '</a>';
print "</td>\n";
print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>';
print '<td align="center">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>';
print '<td align="right" width="80px">'.dol_print_size($file['size'],1,1).'</td>';
print '<td align="center" width="130px">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>';
// Preview
if (empty($useinecm))
{
@@ -871,7 +875,7 @@ class FormFile
}
// Delete or view link
// ($param must start with &)
print '<td align="right">';
print '<td class="valignmiddle right" width="50px">';
if ($useinecm) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
else
{

View File

@@ -657,9 +657,10 @@ class FormMail extends Form
$langs->load('paypal');
// Set the paypal message and url link into __PERSONALIZED__ key
if ($this->param["models"]=='order_send')
{
$url=getPaypalPaymentUrl(0,'order',$this->substit['__ORDERREF__']);
$url=getPaypalPaymentUrl(0,'order',$this->substit['__ORDERREF__']?$this->substit['__ORDERREF__']:$this->substit['__REF__']);
$this->substit['__PERSONALIZED__']=str_replace('\n',"\n",$langs->transnoentitiesnoconv("PredefinedMailContentLink",$url));
}
if ($this->param["models"]=='facture_send')
@@ -908,8 +909,94 @@ class FormMail extends Form
return -1;
}
}
/**
* Set substit array from object
*
* @param Object $object Object to use
* @return void
*/
function setSubstitFromObject($object)
{
$this->substit['__REF__'] = $object->ref;
$this->substit['__SIGNATURE__'] = $user->signature;
$this->substit['__REFCLIENT__'] = $object->ref_client;
$this->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$this->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$this->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
$this->substit['__PERSONALIZED__'] = '';
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
}
/**
* Set substit array from object
*
* @param string $mode 'form' or 'emailing'
* @return void
*/
function getAvailableSubstitKey($mode='form')
{
global $conf;
$vars=array();
if ($mode == 'form')
{
$vars=array(
'__REF__',
'__REFCLIENT__',
'__THIRDPARTY_NAME__',
'__PROJECT_REF__',
'__PROJECT_NAME__',
'__CONTACTCIVNAME__',
'__PERSONALIZED__', // Paypal link will be added here in form mode
'__SIGNATURE__',
);
}
if ($mode == 'emailing')
{
// For mass emailing, we have different keys
$vars=array(
'__ID__' => 'IdRecord',
'__EMAIL__' => 'EMail',
'__LASTNAME__' => 'Lastname',
'__FIRSTNAME__' => 'Firstname',
'__MAILTOEMAIL__' => 'TagMailtoEmail',
'__OTHER1__' => 'Other1',
'__OTHER2__' => 'Other2',
'__OTHER3__' => 'Other3',
'__OTHER4__' => 'Other4',
'__OTHER5__' => 'Other5',
'__SIGNATURE__' => 'TagSignature',
'__CHECK_READ__' => 'TagCheckMail',
'__UNSUBSCRIBE__' => 'TagUnsubscribe'
//,'__PERSONALIZED__' => 'Personalized' // Hidden because not used yet in mass emailing
);
if (! empty($conf->paypal->enabled) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN))
{
$vars['__SECUREKEYPAYPAL__']='SecureKeyPaypal';
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
{
if ($conf->adherent->enabled) $vars['__SECUREKEYPAYPAL_MEMBER__']='SecureKeyPaypalUniquePerMember';
if ($conf->facture->enabled) $vars['__SECUREKEYPAYPAL_INVOICE__']='SecureKeyPaypalUniquePerInvoice';
if ($conf->commande->enabled) $vars['__SECUREKEYPAYPAL_ORDER__']='SecureKeyPaypalUniquePerOrder';
if ($conf->contrat->enabled) $vars['__SECUREKEYPAYPAL_CONTRACTLINE__']='SecureKeyPaypalUniquePerContractLine';
}
}
else
{
$vars['__SECUREKEYPAYPAL__']='';
$vars['__SECUREKEYPAYPAL_MEMBER__']='';
}
}
return $vars;
}
}
/**
* ModelMail
*/

View File

@@ -84,7 +84,7 @@ class FormSupplierProposal
}
else
{
$conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Opened','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Billed');
$conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Opened','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Closed');
if (! empty($conv_to_new_code[$obj->code])) $key=$conv_to_new_code[$obj->code];
print ($langs->trans("PropalStatus".$key.($short?'Short':''))!="PropalStatus".$key.($short?'Short':''))?$langs->trans("PropalStatus".$key.($short?'Short':'')):$obj->label;
}

View File

@@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
@@ -62,12 +62,16 @@ function versioncompare($versionarray1,$versionarray2)
{
$operande1=isset($versionarray1[$level])?$versionarray1[$level]:0;
$operande2=isset($versionarray2[$level])?$versionarray2[$level]:0;
if (preg_match('/alpha|dev/i',$operande1)) $operande1=-3;
if (preg_match('/alpha|dev/i',$operande2)) $operande2=-3;
if (preg_match('/beta/i',$operande1)) $operande1=-2;
if (preg_match('/beta/i',$operande2)) $operande2=-2;
if (preg_match('/rc/i',$operande1)) $operande1=-1;
if (preg_match('/rc/i',$operande2)) $operande2=-1;
if (preg_match('/alpha|dev/i',$operande1)) $operande1=-5;
if (preg_match('/alpha|dev/i',$operande2)) $operande2=-5;
if (preg_match('/beta$/i',$operande1)) $operande1=-4;
if (preg_match('/beta$/i',$operande2)) $operande2=-4;
if (preg_match('/beta([0-9])+/i',$operande1)) $operande1=-3;
if (preg_match('/beta([0-9])+/i',$operande2)) $operande2=-3;
if (preg_match('/rc$/i',$operande1)) $operande1=-2;
if (preg_match('/rc$/i',$operande2)) $operande2=-2;
if (preg_match('/rc([0-9])+/i',$operande1)) $operande1=-1;
if (preg_match('/rc([0-9])+/i',$operande2)) $operande2=-1;
$level++;
//print 'level '.$level.' '.$operande1.'-'.$operande2.'<br>';
if ($operande1 < $operande2) { $ret = -$level; break; }
@@ -591,7 +595,7 @@ function listOfSessions()
$sessValues = file_get_contents($fullpath); // get raw session data
// Example of possible value
//$sessValues = 'newtoken|s:32:"1239f7a0c4b899200fe9ca5ea394f307";dol_loginmesg|s:0:"";newtoken|s:32:"1236457104f7ae0f328c2928973f3cb5";dol_loginmesg|s:0:"";token|s:32:"123615ad8d650c5cc4199b9a1a76783f";dol_login|s:5:"admin";dol_authmode|s:8:"dolibarr";dol_tz|s:1:"1";dol_tz_string|s:13:"Europe/Berlin";dol_dst|i:0;dol_dst_observed|s:1:"1";dol_dst_first|s:0:"";dol_dst_second|s:0:"";dol_screenwidth|s:4:"1920";dol_screenheight|s:3:"971";dol_company|s:12:"MyBigCompany";dol_entity|i:1;mainmenu|s:4:"home";leftmenuopened|s:10:"admintools";idmenu|s:0:"";leftmenu|s:10:"admintools";';
if (preg_match('/dol_login/i',$sessValues) && // limit to dolibarr session
(preg_match('/dol_entity\|i:'.$conf->entity.';/i',$sessValues) || preg_match('/dol_entity\|s:([0-9]+):"'.$conf->entity.'"/i',$sessValues)) && // limit to current entity
preg_match('/dol_company\|s:([0-9]+):"('.$conf->global->MAIN_INFO_SOCIETE_NOM.')"/i',$sessValues)) // limit to company name

View File

@@ -64,7 +64,7 @@ function bank_prepare_head(Account $object)
$head[$h][2] = 'graph';
$h++;
if ($object->courant != 2)
if ($object->courant != Account::TYPE_CASH)
{
$head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$object->id;
$head[$h][1] = $langs->trans("AccountStatements");

View File

@@ -42,8 +42,10 @@ function contract_prepare_head(Contrat $object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans("ContactsAddresses");
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}

View File

@@ -45,8 +45,10 @@ function fichinter_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('InterventionContact');
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}

View File

@@ -45,8 +45,10 @@ function facturefourn_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/fourn/facture/contact.php?facid='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}
@@ -119,8 +121,10 @@ function ordersupplier_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/fourn/commande/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}

View File

@@ -630,14 +630,14 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
if ($level > $conf->global->SYSLOG_LEVEL) return;
// If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && ! empty($conf->global->MAIN_LOGTOHTML))
if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility
{
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
}
//TODO: Remove this. MAIN_ENABLE_LOG_HTML should be deprecated and use a log handler dedicated to HTML output
//TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_HTML) && ! empty($_GET["log"]))
if (! empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && ! empty($_GET["log"]))
{
print "\n\n<!-- Log start\n";
print $message."\n";
@@ -3418,9 +3418,10 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
* @param int $unit Unit of dimension (0, -3, ...)
* @param string $type 'weight', 'volume', ...
* @param Translate $outputlangs Translate language object
* @param int $round -1 = non rounding, x = number of decimal
* @return string String to show dimensions
*/
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs)
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
@@ -3445,7 +3446,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs)
$unit = $unit + 3;
}
$ret=price($dimension, 0, $outputlangs, 0, 0).' '.measuring_units_string($unit, $type);
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
return $ret;
}
@@ -5395,7 +5396,7 @@ function dol_set_focus($selector)
function dol_getmypid()
{
if (! function_exists('getmypid')) {
return rand(1,32768);
return mt_rand(1,32768);
} else {
return getmypid();
}

View File

@@ -45,8 +45,10 @@ function facture_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}
@@ -62,8 +64,20 @@ function facture_prepare_head($object)
//if ($fac->mode_reglement_code == 'PRE')
if (! empty($conf->prelevement->enabled))
{
$nbStandingOrders=0;
$sql = "SELECT COUNT(pfd.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
$sql .= " WHERE pfd.fk_facture = ".$object->id;
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
if ($obj) $nbStandingOrders = $obj->nb;
}
else dol_print_error($db);
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id;
$head[$h][1] = $langs->trans('StandingOrders');
if ($nbStandingOrders > 0) $head[$h][1].= ' <span class="badge">'.$nbStandingOrders.'</span>';
$head[$h][2] = 'standingorders';
$h++;
}

View File

@@ -70,8 +70,10 @@ function commande_prepare_head(Commande $object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}

View File

@@ -64,8 +64,10 @@ function propal_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{
$nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external'));
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses');
if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>';
$head[$h][2] = 'contact';
$h++;
}

View File

@@ -184,7 +184,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1704__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/paiement/list.php?leftmenu=customers_bills', 'Payments', 1, 'bills', '$user->rights->facture->lire', '', 2, 6, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'accountancy', '', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?leftmenu=customers_bills', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1703__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/mergepdftool.php?action=facturer&amp;leftmenu=customers_bills', 'MergingPDFTool', 1, 'bills', '$user->rights->facture->lire', '', 2, 7, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'accountancy', '', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?leftmenu=customers_bills', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__);
-- Accountancy - Orders to bill
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'accountancy', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?leftmenu=orders&amp;viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__);

View File

@@ -281,7 +281,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
{
$objp = $db->fetch_object($resql);
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
$newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}

View File

@@ -802,8 +802,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/paiement/rapport.php",$langs->trans("Reportings"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/stats/index.php", $langs->trans("Statistics"),1,$user->rights->facture->lire);
$newmenu->add("/compta/facture/mergepdftool.php",$langs->trans("MergingPDFTool"),1,$user->rights->facture->lire);
}
// Suppliers invoices
@@ -1342,7 +1340,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$objp = $db->fetch_object($resql);
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != 2 && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
$newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}

View File

@@ -240,7 +240,9 @@ class doc_generic_order_odt extends ModelePDFCommandes
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -241,7 +241,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -451,7 +451,7 @@ class pdf_rouget extends ModelePdfExpedition
$voltxt='';
if ($object->lines[$i]->fk_product_type == 0 && $object->lines[$i]->volume)
{
$voltxt=$object->lines[$i]->volume*$object->lines[$i]->qty_shipped.' '.measuring_units_string($object->lines[$i]->volume_units,"volume");
$voltxt=$object->lines[$i]->volume*$object->lines[$i]->qty_shipped.' '.measuring_units_string($object->lines[$i]->volume_units?$object->lines[$i]->volume_units:0,"volume");
}
$pdf->MultiCell(($this->posxqtyordered - $this->posxweightvol), 3, $weighttxt.(($weighttxt && $voltxt)?', ':'').$voltxt,'','C');

View File

@@ -241,7 +241,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -166,7 +166,7 @@ class pdf_crabe extends ModelePDFFactures
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf,$mysoc,$db,$hookmanager;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
@@ -539,7 +539,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0);
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$prev_progress = $object->lines[$i]->get_prev_progress();
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
if ($prev_progress > 0) // Compute progress from previous situation
{
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent;
@@ -548,6 +548,7 @@ class pdf_crabe extends ModelePDFFactures
if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva;
else $tvaligne=$object->lines[$i]->total_tva;
}
$localtax1ligne=$object->lines[$i]->total_localtax1;
$localtax2ligne=$object->lines[$i]->total_localtax2;
$localtax1_rate=$object->lines[$i]->localtax1_tx;
@@ -1106,7 +1107,8 @@ class pdf_crabe extends ModelePDFFactures
}
}
}
//}
//}
// VAT
foreach($this->tva as $tvakey => $tvaval)
{

View File

@@ -450,7 +450,9 @@ class doc_generic_project_odt extends ModelePDFProjects
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -274,7 +274,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -686,21 +686,39 @@ class pdf_azur extends ModelePDFPropales
if (count($filetomerge->lines) > 0) {
foreach ( $filetomerge->lines as $linefile ) {
if (! empty($linefile->id) && ! empty($linefile->file_name)) {
if (! empty($conf->product->enabled))
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
elseif (! empty($conf->service->enabled))
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . dol_sanitizeFileName($line->product_ref);
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{
if (! empty($conf->product->enabled)) {
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
} elseif (! empty($conf->service->enabled)) {
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos";
}
}
else
{
if (! empty($conf->product->enabled)) {
$filetomerge_dir = $conf->product->multidir_output[$entity_product_file] . '/' . get_exdir(0,0,0,0,$product,'product') . dol_sanitizeFileName($product->ref);
} elseif (! empty($conf->service->enabled)) {
$filetomerge_dir = $conf->service->multidir_output[$entity_product_file] . '/' . get_exdir(0,0,0,0,$product,'product') . dol_sanitizeFileName($product->ref);
}
}
dol_syslog(get_class($this) . ':: upload_dir=' . $filetomerge_dir, LOG_DEBUG);
$infile = $filetomerge_dir . '/' . $linefile->file_name;
if (is_file($infile)) {
if (file_exists($infile) && is_readable($infile)) {
$pagecount = $pdf->setSourceFile($infile);
for($i = 1; $i <= $pagecount; $i ++) {
$tplidx = $pdf->ImportPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
$tplIdx = $pdf->importPage(1);
if ($tplIdx!==false) {
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplIdx);
} else {
setEventMessages(null, array($infile.' cannot be added, probably protected PDF'),'warnings');
}
}
}
}
@@ -710,10 +728,6 @@ class pdf_azur extends ModelePDFPropales
}
}
//exit;
$pdf->Close();
$pdf->Output($file,'F');

View File

@@ -134,19 +134,19 @@ class modGeneratePassPerso extends ModeleGenPassword
{
$pass = "";
for($i=0; $i<$this->NbMaj; $i++){ // Y
$pass .= $this->Maj[rand(0,strlen($this->Maj) - 1)];
$pass .= $this->Maj[mt_rand(0,strlen($this->Maj) - 1)];
}
for($i=0; $i<$this->NbNum; $i++){ // X
$pass .= $this->Nb[rand(0,strlen($this->Nb) - 1)];
$pass .= $this->Nb[mt_rand(0,strlen($this->Nb) - 1)];
}
for($i=0; $i<$this->NbSpe; $i++){ // @
$pass .= $this->Spe[rand(0,strlen($this->Spe) - 1)];
$pass .= $this->Spe[mt_rand(0,strlen($this->Spe) - 1)];
}
for($i=strlen($pass);$i<$this->length2; $i++){ // y
$pass .= $this->All[rand(0,strlen($this->All) -1)];
$pass .= $this->All[mt_rand(0,strlen($this->All) -1)];
}
$pass = str_shuffle($pass);

View File

@@ -209,9 +209,15 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
// Get extension (ods or odt)
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME))
{
$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp;
}
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -274,7 +274,9 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
{
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
$format=$conf->global->MAIN_DOC_USE_TIMING;
if ($format == '1') $format='%Y%m%d%H%M%S';
$filename=$newfiletmp.'-'.dol_print_date(dol_now(),$format).'.'.$newfileformat;
}
else
{

View File

@@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_proposal/modules_supplie
class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal
{
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $prefix='DF';
var $prefix='RQ'; // RQ = Request for quotation
var $error='';
var $nom = "Marbre";

View File

@@ -392,7 +392,25 @@ if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $da
echo $form->select_date($date_start,'date_start',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct",1,0,1);
echo ' '.$langs->trans('to').' ';
echo $form->select_date($date_end,'date_end',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addproduct",1,0,1);
};
print '<script type="text/javascript">';
if (!$date_start) {
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
}
}
if (!$date_end) {
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
}
}
print '</script>'
?>
</td>
</tr>

View File

@@ -229,6 +229,24 @@ $coldisplay=-1; // We remove first td
echo $form->select_date($line->date_start,'date_start',$hourmin,$hourmin,$line->date_start?0:1,"updateligne",1,0,1);
echo ' '.$langs->trans('to').' ';
echo $form->select_date($line->date_end,'date_end',$hourmin,$hourmin,$line->date_end?0:1,"updateligne",1,0,1);
print '<script type="text/javascript">';
if (!$line->date_start) {
if (isset($conf->global->MAIN_DEFAULT_DATE_START_HOUR)) {
print 'jQuery("#date_starthour").val("'.$conf->global->MAIN_DEFAULT_DATE_START_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_START_MIN)) {
print 'jQuery("#date_startmin").val("'.$conf->global->MAIN_DEFAULT_DATE_START_MIN.'");';
}
}
if (!$line->date_end) {
if (isset($conf->global->MAIN_DEFAULT_DATE_END_HOUR)) {
print 'jQuery("#date_endhour").val("'.$conf->global->MAIN_DEFAULT_DATE_END_HOUR.'");';
}
if (isset($conf->global->MAIN_DEFAULT_DATE_END_MIN)) {
print 'jQuery("#date_endmin").val("'.$conf->global->MAIN_DEFAULT_DATE_END_MIN.'");';
}
}
print '</script>'
?>
</td>
</tr>

View File

@@ -1895,10 +1895,8 @@ else if ($id || $ref)
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit['__SHIPPINGREF__']=$object->ref;
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
//Find the good contact adress
//Find the good contact adress

View File

@@ -265,7 +265,12 @@ if ($id > 0 || ! empty($ref))
// Date
print '<tr><td>'.$langs->trans('Date').'</td>';
print '<td colspan="2">'.dol_print_date($commande->date,'daytext').'</td>';
print '<td colspan="2">';
print dol_print_date($commande->date,'daytext');
if ($commande->hasDelay() && empty($commande->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning");
}
print '</td>';
print '</tr>';
// Delivery date planned
@@ -289,6 +294,9 @@ if ($id > 0 || ! empty($ref))
else
{
print dol_print_date($commande->date_livraison,'daytext');
if ($commande->hasDelay() && ! empty($commande->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning");
}
}
print '</td>';
// Note on several rows

View File

@@ -117,17 +117,20 @@ if (empty($reshook))
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
@@ -143,17 +146,20 @@ if (empty($reshook))
$result = $object->setDraft($user);
if ($result >= 0)
{
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->modelpdf:GETPOST('model','alpha'), $outputlangs);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) $result=fichinter_create($db, $object, (!GETPOST('model','alpha'))?$object->model:GETPOST('model','apha'), $outputlangs);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
@@ -1866,10 +1872,8 @@ else if ($id > 0 || ! empty($ref))
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit['__FICHINTERREF__']=$object->ref;
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
//Find the good contact adress
$custcontact='';

View File

@@ -1692,7 +1692,7 @@ class FactureFournisseur extends CommonInvoice
$line->remise_percent=0;
}
$prodid = rand(1, $num_prods);
$prodid = mt_rand(1, $num_prods);
$line->fk_product=$prodids[$prodid];
$line->product_type=0;

View File

@@ -1,10 +1,13 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Charlie Benke <charlie@patas-monkey.com>
status
*
* 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
@@ -439,6 +442,7 @@ class ProductFournisseur extends Product
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE pfp.entity IN (".getEntity('product', 1).")";
$sql.= " AND pfp.fk_soc = s.rowid";
$sql.= " AND s.status=1"; // only enabled company selected
$sql.= " AND pfp.fk_product = ".$prodid;
if (empty($sortfield)) $sql.= " ORDER BY s.nom, pfp.quantity, pfp.price";
else $sql.= $this->db->order($sortfield,$sortorder);
@@ -545,6 +549,7 @@ class ProductFournisseur extends Product
$sql.= " WHERE s.entity IN (".getEntity('societe', 1).")";
$sql.= " AND pfp.fk_product = ".$prodid;
$sql.= " AND pfp.fk_soc = s.rowid";
$sql.= " AND s.status = 1"; // only enabled society
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
dol_syslog(get_class($this)."::find_min_price_product_fournisseur", LOG_DEBUG);

View File

@@ -563,6 +563,19 @@ if (empty($reshook))
unset($localtax1_tx);
unset($localtax2_tx);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
if ($result >= 0)
{
// Define output language
@@ -2468,13 +2481,9 @@ elseif (! empty($object->id))
$object->fetch_projet();
// Tableau des substitutions
$formmail->substit['__ORDERREF__']=$object->ref;
$formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier;
$formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
$formmail->setSubstitFromObject($object);
$formmail->substit['__ORDERSUPPLIERREF__']=$object->ref_supplier; // For backward compatibility
$formmail->substit['__SUPPLIERORDERREF__']=$object->ref_supplier;
//Find the good contact adress
$custcontact='';
@@ -2755,6 +2764,11 @@ elseif (! empty($object->id))
print '</a>';
}
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}
// Modify
if ($object->statut == 1)

View File

@@ -620,6 +620,19 @@ if (empty($reshook))
if ($result >= 0)
{
unset($_POST['label']);
unset($_POST['date_starthour']);
unset($_POST['date_startmin']);
unset($_POST['date_startsec']);
unset($_POST['date_startday']);
unset($_POST['date_startmonth']);
unset($_POST['date_startyear']);
unset($_POST['date_endhour']);
unset($_POST['date_endmin']);
unset($_POST['date_endsec']);
unset($_POST['date_endday']);
unset($_POST['date_endmonth']);
unset($_POST['date_endyear']);
$db->commit();
}
else
@@ -1709,12 +1722,6 @@ else
if ($objectref == 'PROV')
{
$savdate=$object->date;
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION))
{
$object->date=dol_now();
//TODO: Possibly will have to control payment information into suppliers
//$object->date_lim_reglement=$object->calculate_date_lim_reglement();
}
$numref = $object->getNextNumRef($societe);
}
else
@@ -2321,6 +2328,12 @@ else
}
}
}
// Create event
if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;origin=' . $object->element . '&amp;originid=' . $object->id . '&amp;socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
}
// Clone
if ($action != 'edit' && $user->rights->fournisseur->facture->creer)
@@ -2455,11 +2468,9 @@ else
$formmail->withbody=1;
$formmail->withdeliveryreceipt=1;
$formmail->withcancel=1;
// Tableau des substitutions
$formmail->substit['__REF__']=$object->ref;
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
// Tableau des substitutions
$formmail->setSubstitFromObject($object);
$formmail->substit['__SUPPLIERINVREF__']=$object->ref;
//Find the good contact adress
$custcontact='';

View File

@@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 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
@@ -91,23 +91,23 @@ if ($action == 'create')
$error++;
$action='create';
}
// If no start date
if (empty($date_debut))
{
header('Location: card.php?action=request&error=nodatedebut');
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=nodatedebut');
exit;
}
// If no end date
if (empty($date_fin))
{
header('Location: card.php?action=request&error=nodatefin');
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=nodatefin');
exit;
}
// If start date after end date
if ($date_debut > $date_fin)
{
header('Location: card.php?action=request&error=datefin');
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=datefin');
exit;
}
@@ -115,15 +115,15 @@ if ($action == 'create')
$verifCP = $cp->verifDateHolidayCP($userID, $date_debut, $date_fin, $halfday);
if (! $verifCP)
{
header('Location: card.php?action=request&error=alreadyCP');
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=alreadyCP');
exit;
}
// If there is no Business Days within request
// If there is no Business Days within request
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
if($nbopenedday < 0.5)
{
header('Location: card.php?action=request&error=DureeHoliday');
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=DureeHoliday');
exit;
}
@@ -137,7 +137,7 @@ if ($action == 'create')
$result = 0;
$result = 0;
if (! $error)
{
$cp->fk_user = $userid;
@@ -147,16 +147,16 @@ if ($action == 'create')
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
$cp->fk_type = $type;
$result = $cp->create($user);
}
// If no SQL error we redirect to the request card
if (! $error && $result > 0)
{
$db->commit();
header('Location: card.php?id='.$result);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
else
@@ -179,15 +179,15 @@ if ($action == 'update')
else if ($starthalfday == 'afternoon') $halfday=-1;
else if ($endhalfday == 'morning') $halfday=1;
// If no right to modify a request
// If no right to modify a request
if (! $user->rights->holiday->write)
{
header('Location: card.php?action=request&error=CantUpdate');
header('Location: '.$_SERVER["PHP_SELF"].'?action=request&error=CantUpdate');
exit;
}
$cp = new Holiday($db);
$cp->fetch($_POST['holiday_id']);
$cp->fetch($id);
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
@@ -202,25 +202,25 @@ if ($action == 'update')
// If no start date
if (empty($_POST['date_debut_'])) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatedebut');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit&error=nodatedebut');
exit;
}
// If no end date
if (empty($_POST['date_fin_'])) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=nodatefin');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit&error=nodatefin');
exit;
}
// If start date after end date
if ($date_debut > $date_fin) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=datefin');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit&error=datefin');
exit;
}
// If no validator designated
if ($valideur < 1) {
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=Valideur');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit&error=Valideur');
exit;
}
@@ -228,7 +228,7 @@ if ($action == 'update')
$nbopenedday=num_open_day($date_debut_gmt, $date_fin_gmt, 0, 1, $halfday);
if ($nbopenedday < 0.5)
{
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=DureeHoliday');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit&error=DureeHoliday');
exit;
}
@@ -242,18 +242,18 @@ if ($action == 'update')
$verif = $cp->update($user->id);
if ($verif > 0)
{
header('Location: card.php?id='.$_POST['holiday_id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
else
{
// Otherwise we display the request form with the SQL error message
header('Location: card.php?id='.$_POST['holiday_id'].'&action=edit&error=SQL_Create&msg='.$cp->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit&error=SQL_Create&msg='.$cp->error);
exit;
}
}
} else {
header('Location: card.php?id='.$_POST['holiday_id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
}
@@ -276,7 +276,7 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights-
// Si l'utilisateur à le droit de lire cette demande, il peut la supprimer
if ($canedit)
{
$result=$cp->delete($id);
$result=$cp->delete($cp->id);
}
else
{
@@ -303,7 +303,7 @@ if ($action == 'confirm_send')
$cp->fetch($id);
$canedit=(($user->id == $cp->fk_user && $user->rights->holiday->write) || ($user->id != $cp->fk_user && $user->rights->holiday->write_all));
// Si brouillon et créateur
if($cp->statut == 1 && $canedit)
{
@@ -321,7 +321,7 @@ if ($action == 'confirm_send')
if (!$emailTo)
{
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
@@ -370,7 +370,7 @@ if ($action == 'confirm_send')
$message.= "\n";
$message.= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($cp->date_debut,'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($cp->date_fin,'day')."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->id."\n\n";
$message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@@ -380,16 +380,16 @@ if ($action == 'confirm_send')
if (!$result)
{
header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=mail&error_content='.$mail->error);
exit;
}
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
else
{
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=SQL_Create&msg='.$cp->error);
exit;
}
}
@@ -433,7 +433,7 @@ if ($action == 'confirm_valid')
if (!$emailTo)
{
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
@@ -455,7 +455,7 @@ if ($action == 'confirm_valid')
$message.= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->id."\n\n";
$message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@@ -464,15 +464,15 @@ if ($action == 'confirm_valid')
$result=$mail->sendfile();
if(!$result) {
header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=mail&error_content='.$mail->error);
exit;
}
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
} else {
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=SQL_Create&msg='.$cp->error);
exit;
}
@@ -485,7 +485,7 @@ if ($action == 'confirm_refuse')
if (! empty($_POST['detail_refuse']))
{
$cp = new Holiday($db);
$cp->fetch($_GET['id']);
$cp->fetch($id);
// Si statut en attente de validation et valideur = utilisateur
if ($cp->statut == 2 && $user->id == $cp->fk_validator)
@@ -507,7 +507,7 @@ if ($action == 'confirm_refuse')
if (!$emailTo)
{
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
@@ -530,7 +530,7 @@ if ($action == 'confirm_refuse')
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->id."\n\n";
$message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@@ -539,22 +539,22 @@ if ($action == 'confirm_refuse')
$result=$mail->sendfile();
if(!$result) {
header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=mail&error_content='.$mail->error);
exit;
}
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
} else {
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=SQL_Create&msg='.$cp->error);
exit;
}
}
} else {
header('Location: card.php?id='.$_GET['id'].'&error=NoMotifRefuse');
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=NoMotifRefuse');
exit;
}
}
@@ -563,7 +563,7 @@ if ($action == 'confirm_refuse')
if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
{
$cp = new Holiday($db);
$cp->fetch($_GET['id']);
$cp->fetch($id);
// Si statut en attente de validation et valideur = utilisateur
if (($cp->statut == 2 || $cp->statut == 3) && ($user->id == $cp->fk_validator || $user->id == $cp->fk_user))
@@ -616,7 +616,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
if (!$emailTo)
{
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
@@ -638,7 +638,7 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
$message.= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($cp->date_debut,'day'), dol_print_date($cp->date_fin,'day'))."\n";
$message.= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->rowid."\n\n";
$message.= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$cp->id."\n\n";
$message.= "\n";
$mail = new CMailFile($subject,$emailTo,$emailFrom,$message);
@@ -648,17 +648,17 @@ if ($action == 'confirm_cancel' && GETPOST('confirm') == 'yes')
if(!$result)
{
header('Location: card.php?id='.$_GET['id'].'&error=mail&error_content='.$mail->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=mail&error_content='.$mail->error);
exit;
}
header('Location: card.php?id='.$_GET['id']);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id);
exit;
}
else
{
// Sinon on affiche le formulaire de demande avec le message d'erreur SQL
header('Location: card.php?id='.$_GET['id'].'&error=SQL_Create&msg='.$cp->error);
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&error=SQL_Create&msg='.$cp->error);
exit;
}
@@ -852,13 +852,8 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create
// Approved by
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("ReviewedByCP").'</td>';
$validator = new UserGroup($db);
$excludefilter=$user->admin?'':'u.rowid <> '.$user->id;
$valideurobjects = $validator->listUsersForGroup($excludefilter);
$valideurarray = array();
foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id;
print '<td>';
print $form->select_dolusers((GETPOST('valideur')>0?GETPOST('valideur'):$user->fk_user), "valideur", 1, "", 0, $valideurarray, 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent
print $form->select_dolusers((GETPOST('valideur')>0?GETPOST('valideur'):$user->fk_user), "valideur", 1, ($user->admin ? '' : array($user->id)), 0, '', 0, 0, 0, 0, '', 0, '', '', 1); // By default, hierarchical parent
print '</td>';
print '</tr>';
@@ -952,35 +947,35 @@ else
{
if ($action == 'delete')
{
if($user->rights->holiday->delete)
if ($user->rights->holiday->delete)
{
print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$cp->id,$langs->trans("TitleDeleteCP"),$langs->trans("ConfirmDeleteCP"),"confirm_delete", '', 0, 1);
}
}
// Si envoi en validation
if ($action == 'sendToValidate' && $cp->statut == 1)
{
print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$cp->id,$langs->trans("TitleToValidCP"),$langs->trans("ConfirmToValidCP"),"confirm_send", '', 1, 1);
}
// Si validation de la demande
if ($action == 'valid')
{
print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$cp->id,$langs->trans("TitleValidCP"),$langs->trans("ConfirmValidCP"),"confirm_valid", '', 1, 1);
}
// Si refus de la demande
if ($action == 'refuse')
{
$array_input = array(array('type'=>"text",'label'=> $langs->trans('DetailRefusCP'),'name'=>"detail_refuse",'size'=>"50",'value'=>""));
print $form->formconfirm("card.php?id=".$id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$cp->id."&action=confirm_refuse", $langs->trans("TitleRefuseCP"), $langs->trans('ConfirmRefuseCP'), "confirm_refuse", $array_input, 1, 0);
}
// Si annulation de la demande
if ($action == 'cancel')
{
print $form->formconfirm("card.php?id=".$id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$cp->id,$langs->trans("TitleCancelCP"),$langs->trans("ConfirmCancelCP"),"confirm_cancel", '', 1, 1);
}
$head=holiday_prepare_head($cp);
@@ -989,13 +984,13 @@ else
if ($action == 'edit' && $cp->statut == 1)
{
$edit = true;
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$id.'">'."\n";
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$cp->id.'">'."\n";
print '<input type="hidden" name="action" value="update"/>'."\n";
print '<input type="hidden" name="holiday_id" value="'.$id.'" />'."\n";
print '<input type="hidden" name="id" value="'.$cp->id.'" />'."\n";
}
dol_fiche_head($head,'card',$langs->trans("CPTitreMenu"),0,'holiday');
print '<table class="border" width="100%">';
print '<tbody>';
@@ -1132,15 +1127,8 @@ else
} else {
print '<tr>';
print '<td width="50%">'.$langs->trans('ReviewedByCP').'</td>';
$validator = new UserGroup($db);
$excludefilter=$user->admin?'':'u.rowid <> '.$user->id;
$valideurobjects = $validator->listUsersForGroup($excludefilter);
$valideurarray = array();
foreach($valideurobjects as $val) $valideurarray[$val->id]=$val->id;
print '<td>';
print $form->select_dolusers($user->fk_user, "valideur", 1, "", 0, $valideurarray); // By default, hierarchical parent
print $form->select_dolusers($cp->fk_user, "valideur", 1, ($user->admin ? '' : array($user->id))); // By default, hierarchical parent
print '</td>';
print '</tr>';
}
@@ -1149,19 +1137,19 @@ else
print '<td>'.$langs->trans('DateCreateCP').'</td>';
print '<td>'.dol_print_date($cp->date_create,'dayhour').'</td>';
print '</tr>';
if($cp->statut == 3) {
if ($cp->statut == 3) {
print '<tr>';
print '<td>'.$langs->trans('DateValidCP').'</td>';
print '<td>'.dol_print_date($cp->date_valid,'dayhour').'</td>';
print '</tr>';
}
if($cp->statut == 4) {
if ($cp->statut == 4) {
print '<tr>';
print '<td>'.$langs->trans('DateCancelCP').'</td>';
print '<td>'.dol_print_date($cp->date_cancel,'dayhour').'</td>';
print '</tr>';
}
if($cp->statut == 5) {
if ($cp->statut == 5) {
print '<tr>';
print '<td>'.$langs->trans('DateRefusCP').'</td>';
print '<td>'.dol_print_date($cp->date_refuse,'dayhour').'</td>';
@@ -1171,7 +1159,7 @@ else
print '</table>';
dol_fiche_end();
if ($action == 'edit' && $cp->statut == 1)
{
print '<div align="center">';
@@ -1192,26 +1180,26 @@ else
// Boutons d'actions
if ($canedit && $cp->statut == 1)
{
print '<a href="card.php?id='.$_GET['id'].'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=edit" class="butAction">'.$langs->trans("EditCP").'</a>';
}
if ($canedit && $cp->statut == 1)
{
print '<a href="card.php?id='.$_GET['id'].'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=sendToValidate" class="butAction">'.$langs->trans("Validate").'</a>';
}
if ($user->rights->holiday->delete && $cp->statut == 1) // If draft
{
print '<a href="card.php?id='.$_GET['id'].'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=delete" class="butActionDelete">'.$langs->trans("DeleteCP").'</a>';
}
if ($user->id == $cp->fk_validator && $cp->statut == 2)
{
print '<a href="card.php?id='.$_GET['id'].'&action=valid" class="butAction">'.$langs->trans("Approve").'</a>';
print '<a href="card.php?id='.$_GET['id'].'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=valid" class="butAction">'.$langs->trans("Approve").'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=refuse" class="butAction">'.$langs->trans("ActionRefuseCP").'</a>';
}
if (($user->id == $cp->fk_validator || $user->id == $cp->fk_user) && ($cp->statut == 2 || $cp->statut == 3)) // Status validated or approved
{
if (($cp->date_debut > dol_now()) || $user->admin) print '<a href="card.php?id='.$_GET['id'].'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
if (($cp->date_debut > dol_now()) || $user->admin) print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$cp->id.'&action=cancel" class="butAction">'.$langs->trans("ActionCancelCP").'</a>';
else print '<a href="#" class="butActionRefused" title="'.$langs->trans("HolidayStarted").'">'.$langs->trans("ActionCancelCP").'</a>';
}

View File

@@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 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
@@ -35,7 +35,7 @@ class Holiday extends CommonObject
public $table_element='holiday';
protected $isnolinkedbythird = 1; // No field fk_soc
protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* @deprecated
* @see id
@@ -161,7 +161,7 @@ class Holiday extends CommonObject
if (! $error)
{
$this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday");
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."holiday");
}
// Commit or rollback
@@ -178,7 +178,7 @@ class Holiday extends CommonObject
else
{
$this->db->commit();
return $this->rowid;
return $this->id;
}
}
@@ -301,7 +301,8 @@ class Holiday extends CommonObject
$sql.= " ua.firstname as validator_firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
$sql.= " WHERE cp.entity IN (".getEntity('holiday', 1).")";
$sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
$sql.= " AND cp.fk_user = '".$user_id."'";
// Filtre de séléction
@@ -413,7 +414,8 @@ class Holiday extends CommonObject
$sql.= " ua.firstname as validator_firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp, ".MAIN_DB_PREFIX."user as uu, ".MAIN_DB_PREFIX."user as ua";
$sql.= " WHERE cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
$sql.= " WHERE cp.entity IN (".getEntity('holiday', 1).")";
$sql.= " AND cp.fk_user = uu.rowid AND cp.fk_validator = ua.rowid "; // Hack pour la recherche sur le tableau
// Filtrage de séléction
if(!empty($filter)) {
@@ -560,7 +562,7 @@ class Holiday extends CommonObject
$sql.= " detail_refuse = NULL";
}
$sql.= " WHERE rowid= '".$this->rowid."'";
$sql.= " WHERE rowid= '".$this->id."'";
$this->db->begin();
@@ -607,7 +609,7 @@ class Holiday extends CommonObject
$error=0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."holiday";
$sql.= " WHERE rowid=".$this->rowid;
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
@@ -1112,16 +1114,29 @@ class Holiday extends CommonObject
*/
function fetchUsers($stringlist=true,$type=true)
{
global $conf;
// Si vrai donc pour user Dolibarr
if ($stringlist)
{
if($type)
if ($type)
{
// Si utilisateur de Dolibarr
$sql = "SELECT u.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE statut > 0";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
{
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE (ug.fk_user = u.rowid";
$sql.= " AND ug.entity = ".$conf->entity.")";
$sql.= " OR u.admin = 1";
}
else
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
$sql.= " AND u.statut > 0";
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
$resql=$this->db->query($sql);
@@ -1138,7 +1153,7 @@ class Holiday extends CommonObject
{
$obj = $this->db->fetch_object($resql);
if($i == 0) {
if ($i == 0) {
$stringlist.= $obj->rowid;
} else {
$stringlist.= ', '.$obj->rowid;
@@ -1158,7 +1173,7 @@ class Holiday extends CommonObject
}
else
{
{
// We want only list of user id
$sql = "SELECT DISTINCT cpu.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu";
@@ -1199,14 +1214,25 @@ class Holiday extends CommonObject
}
else
{ // Si faux donc user Congés Payés
{ // Si faux donc user Congés Payés
// List for Dolibarr users
if ($type)
{
$sql = "SELECT u.rowid, u.lastname, u.firstname";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE statut > 0";
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode))
{
$sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug";
$sql.= " WHERE (ug.fk_user = u.rowid";
$sql.= " AND ug.entity = ".$conf->entity.")";
$sql.= " OR u.admin = 1";
}
else
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
$sql.= " AND u.statut > 0";
dol_syslog(get_class($this)."::fetchUsers", LOG_DEBUG);
$resql=$this->db->query($sql);

View File

@@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Regis Houssin <regis.houssin@capnetworks.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
@@ -132,7 +133,7 @@ elseif($action == 'add_event')
$new_holiday = $nb_holiday + $add_holiday;
// add event to existing types of vacation
foreach ($typeleaves as $key => $leave)
foreach ($typeleaves as $key => $leave)
{
$vacationTypeID = $leave['rowid'];
@@ -160,7 +161,7 @@ print load_fiche_titre($langs->trans('MenuConfCP'), '', 'title_hrm.png');
print '<div class="info">'.$langs->trans('LastUpdateCP').': '."\n";
$lastUpdate = $holiday->getConfCP('lastUpdate');
if ($lastUpdate)
if ($lastUpdate)
{
$monthLastUpdate = $lastUpdate[4].$lastUpdate[5];
$yearLastUpdate = $lastUpdate[0].$lastUpdate[1].$lastUpdate[2].$lastUpdate[3];
@@ -215,7 +216,7 @@ else
{
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<input type="hidden" name="action" value="update" />';
print '<table class="noborder" width="100%;">';
print "<tr class=\"liste_titre\">";
print '<td width="55%">'.$langs->trans('Employee').'</td>';
@@ -233,12 +234,12 @@ else
print '<td width="20%" style="text-align:center">'.$langs->trans('Note').'</td>';
print '<td></td>';
print '</tr>';
foreach($listUsers as $users)
{
$var=!$var;
print '<tr '.$bc[$var].' style="height: 20px;">';
print '<td>';
$userstatic->id=$users['rowid'];
@@ -246,7 +247,7 @@ else
$userstatic->firstname=$users['firstname'];
print $userstatic->getNomUrl(1);
print '</td>';
if (count($typeleaves))
{
foreach($typeleaves as $key => $val)
@@ -261,17 +262,17 @@ else
}
else
{
print '<td></td>';
print '<td></td>';
}
print '<td style="text-align:center"><input type="text" value="" name="note_holiday['.$users['rowid'].']" size="30"/></td>';
print '<td><input type="submit" name="update_cp['.$users['rowid'].']" value="'.dol_escape_htmltag($langs->trans("Update")).'" class="button"/></td>'."\n";
print '</tr>';
$i++;
}
print '</table>';
print '</form>';
}

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@capnetworks.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
@@ -232,16 +232,16 @@ if ($id > 0)
$title = $langs->trans("User");
$linkback = '<a href="'.DOL_URL_ROOT.'/user/index.php">'.$langs->trans("BackToList").'</a>';
$head = user_prepare_head($fuser);
dol_fiche_head($head, 'paidholidays', $title, 0, 'user');
dol_banner_tab($fuser,'id',$linkback,$user->rights->user->user->lire || $user->admin);
print '<div class="underbanner clearboth"></div>';
print '<br>';
}
else
{
@@ -283,7 +283,7 @@ if ($sall)
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
print '<table class="noborder" width="100%;">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder);

0
htdocs/includes/ccampbell/chromephp/ChromePhp.php Executable file → Normal file
View File

View File

View File

View File

@@ -170,6 +170,7 @@ if (empty($user->societe_id))
! empty($conf->contrat->enabled) && $user->rights->contrat->activer,
! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS),
! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS),
! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS),
! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire,
! empty($conf->projet->enabled) && $user->rights->projet->lire
);
@@ -188,6 +189,7 @@ if (empty($user->societe_id))
DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
DOL_DOCUMENT_ROOT."/projet/class/project.class.php"
);
@@ -205,7 +207,8 @@ if (empty($user->societe_id))
'Contrat',
'CommandeFournisseur',
'FactureFournisseur',
'ExpenseReport',
'SupplierProposal',
'ExpenseReport',
'Project'
);
// Cle array returned by the method load_state_board for each line
@@ -222,7 +225,8 @@ if (empty($user->societe_id))
'Contracts',
'supplier_orders',
'supplier_invoices',
'expensereports',
'askprice',
'expensereports',
'projects'
);
// Dashboard Icon lines
@@ -239,6 +243,7 @@ if (empty($user->societe_id))
'order',
'order',
'bill',
'propal',
'trip',
'project'
);
@@ -255,7 +260,8 @@ if (empty($user->societe_id))
"BillsCustomers",
"Contracts",
"SuppliersOrders",
"SuppliersInvoices",
"SuppliersInvoices",
"SupplierProposalShort",
"ExpenseReports",
"Projects"
);
@@ -273,7 +279,8 @@ if (empty($user->societe_id))
DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=accountancy',
DOL_URL_ROOT.'/contrat/list.php',
DOL_URL_ROOT.'/fourn/commande/list.php',
DOL_URL_ROOT.'/fourn/facture/list.php',
DOL_URL_ROOT.'/fourn/facture/list.php',
DOL_URL_ROOT.'/supplier_proposal/list.php',
DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm',
DOL_URL_ROOT.'/projet/list.php?mainmenu=project'
);
@@ -287,7 +294,8 @@ if (empty($user->societe_id))
"produts",
"propal",
"orders",
"bills",
"bills",
"supplier_proposal",
"contracts",
"trips",
"projects"
@@ -387,9 +395,19 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire)
{
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$board=new Propal($db);
$dashboardlines[] = $board->load_board($user,"opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
$dashboardlines[] = $board->load_board($user,"opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
}
// Number of commercial proposals opened (expired)
if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire)
{
include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
$board=new SupplierProposal($db);
$dashboardlines[] = $board->load_board($user,"opened");
// Number of commercial proposals CLOSED signed (billed)
$dashboardlines[] = $board->load_board($user,"signed");
}
// Number of customer orders a deal
@@ -438,7 +456,11 @@ if (! empty($conf->banque->enabled) && $user->rights->banque->lire && ! $user->s
{
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$board=new Account($db);
$dashboardlines[] = $board->load_board($user);
$nb = $board::countAccountToReconcile();
if ($nb > 0)
{
$dashboardlines[] = $board->load_board($user);
}
}
// Number of cheque to send
@@ -519,7 +541,7 @@ foreach($valid_dashboardlines as $board)
if ($showweather)
{
$boxwork.='<td class="nohover hideonsmartphone" rowspan="'.$rowspan.'" width="80" style="border-left: 1px solid #DDDDDD" align="center">';
$boxwork.='<td class="nohover hideonsmartphone noborderbottom" rowspan="'.$rowspan.'" width="80" style="border-left: 1px solid #DDDDDD" align="center">';
$text='';
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate).')';
$options='height="64px"';

View File

@@ -127,7 +127,7 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile)
$includeconferror='ErrorBadFormatForConfFile';
}
}
$conf->global->MAIN_LOGTOHTML = 1;
$conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
// Define prefix
if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_';

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