Compare commits

...

70 Commits

Author SHA1 Message Date
Laurent Destailleur
b2fbef4a91 Prepare 4.0.3 2016-12-25 23:04:59 +01:00
Laurent Destailleur
a9beeec0b3 Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-23 16:03:09 +01:00
Laurent Destailleur
8ce5ed0192 Fix position of discount on PDF with US letter format 2016-12-23 15:57:31 +01:00
Laurent Destailleur
99a501fcfb Merge pull request #6207 from aspangaro/4.0-p1
Fix: Accountancy - Problem on quadratus export
2016-12-23 00:52:47 +01:00
Laurent Destailleur
792da7f56d Merge pull request #6205 from fmarcet/4.0
FIX: Deposits and credit notes weren't added in column invoices list
2016-12-23 00:51:59 +01:00
Laurent Destailleur
293560f9c1 Fix missing ref is object is supplier object 2016-12-22 17:41:58 +01:00
Laurent Destailleur
39bd9a69ec Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-22 17:30:50 +01:00
Laurent Destailleur
b4ed0a1e12 Fix nb of lat approvals wrong 2016-12-22 17:30:39 +01:00
Laurent Destailleur
574f84bb84 Fix warning for approval delay. 2016-12-22 15:49:06 +01:00
aspangaro
d53a238b49 Fix: Accountancy - Problem on quadratus export 2016-12-22 06:12:42 +01:00
Ferran Marcet
ae7f49b5d8 FIX: Deposits and credit notes weren't added in the received and pending columns 2016-12-21 18:40:05 +01:00
Laurent Destailleur
3f5d67d4d6 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-19 02:35:16 +01:00
Laurent Destailleur
0d1d68d5d9 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts:
	htdocs/admin/dict.php
	htdocs/product/price.php
2016-12-19 02:34:29 +01:00
Laurent Destailleur
876722733a Better fix to get localtax 2016-12-19 02:33:54 +01:00
Laurent Destailleur
74e00c4d80 More comment and hidden option to solve problems when sending emails. 2016-12-19 01:04:17 +01:00
Laurent Destailleur
dbf96b8f59 Log at wrong place 2016-12-18 23:32:31 +01:00
Laurent Destailleur
0e7da2cd22 FIX Label of project is in field title not label. 2016-12-18 11:55:30 +01:00
Laurent Destailleur
a37b1fb6c1 Merge pull request #6171 from fmarcet/4.0
FIX: Setting supplier as client when accept a supplier proposal
2016-12-18 11:09:33 +01:00
Laurent Destailleur
e0db9a8ca7 Merge pull request #6169 from atm-gauthier/FIX_ttc_and_ht_must_always_be_available
FIX : HT and TTC price should always be displayed together
2016-12-18 11:08:33 +01:00
Laurent Destailleur
47bf442c84 Merge pull request #6167 from atm-florian/4.0
GETPOST instead of $_GET
2016-12-18 10:59:27 +01:00
Laurent Destailleur
b3d5f40f37 Merge pull request #6166 from atm-gauthier/3.9_fix_wrong_test
FIX : wrong test on dict.php
2016-12-18 10:58:32 +01:00
Laurent Destailleur
27785323ae Merge pull request #6164 from hregis/4.0_bug
Fix: missing date locale and date rfc
2016-12-18 10:57:29 +01:00
Laurent Destailleur
c36d4b9894 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-18 02:17:21 +01:00
Laurent Destailleur
394e284a4a Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts:
	htdocs/core/class/CMailFile.class.php
	htdocs/langs/en_US/errors.lang
2016-12-18 02:16:40 +01:00
Laurent Destailleur
6830fdca98 Merge branch '3.8' of git@github.com:Dolibarr/dolibarr.git into 3.9
Conflicts:
	htdocs/product/class/product.class.php
2016-12-18 02:12:34 +01:00
Laurent Destailleur
321933f267 Fix deletion of product 2016-12-18 02:10:26 +01:00
Laurent Destailleur
73e6663230 Fix help/messages for emailing to warn users. 2016-12-17 14:47:06 +01:00
Laurent Destailleur
c5db333af8 Fix translation of error message when sending email 2016-12-17 14:00:39 +01:00
Laurent Destailleur
d8e394d3aa FIX Missing field 2016-12-16 17:09:15 +01:00
Laurent Destailleur
929904041d Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts:
	htdocs/conf/conf.php.example
	htdocs/langs/en_US/mails.lang
2016-12-16 13:53:34 +01:00
Laurent Destailleur
534e2b1282 FIX Security to restrict email sending was not efficient 2016-12-16 13:46:39 +01:00
Laurent Destailleur
7fdd6ccbd2 Prepare 4.0.3 2016-12-15 22:50:20 +01:00
Laurent Destailleur
8f3ce46c50 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-15 12:12:36 +01:00
Laurent Destailleur
2c4c48ad6f Better fix to add server name into email id. 2016-12-15 12:11:39 +01:00
Laurent Destailleur
d32fd7aa11 FIX javascript xss injection and a translation 2016-12-15 11:55:33 +01:00
Ferran Marcet
2777c4d4a5 FIX: Setting supplier as client when accept a supplier proposal 2016-12-14 18:35:59 +01:00
gauthier
1f1c75adfb FIX : HT and TTC price should always be displayed together 2016-12-14 15:50:50 +01:00
Laurent Destailleur
d2e4888bdd Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-14 12:21:33 +01:00
Laurent Destailleur
e4dd020887 Fix bad concat 2016-12-14 11:23:55 +01:00
Laurent Destailleur
af407a094a FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of
tracking email.
2016-12-14 11:20:44 +01:00
Laurent Destailleur
56b3f2c011 FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of
tracking email.
2016-12-14 10:36:11 +01:00
Laurent Destailleur
530d3503f5 FIX Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of
tracking email.
2016-12-14 10:32:31 +01:00
Regis Houssin
cb21ad2cc5 Merge remote-tracking branch 'origin/4.0' into 4.0_bug 2016-12-13 16:52:36 +01:00
florian HENRY
3992a92dd4 Merge branch '4.0' of https://github.com/Dolibarr/dolibarr.git into 4.0 2016-12-13 13:34:05 +01:00
Laurent Destailleur
43d18cd70c FIX if a supplier price reference is changed after creating an order, we
can't clone order.
2016-12-13 13:22:24 +01:00
gauthier
4dd740fe2f FIX : wrong test on dict.php 2016-12-13 11:41:26 +01:00
Regis Houssin
337509d40f Fix: missing date locale and date rfc 2016-12-13 09:40:08 +01:00
Juanjo Menent
5c4ab99a9a Merge pull request #6132 from simnandez/3.9
Fix #5646 Error editing Sell Price on products/services
2016-12-11 14:32:00 +01:00
Laurent Destailleur
95d8faef04 Merge branch '3.9' of git@github.com:Dolibarr/dolibarr.git into 4.0
Conflicts:
	htdocs/product/class/product.class.php
2016-12-11 10:51:15 +01:00
Laurent Destailleur
7fd75c793a FIX Regression when deleting product 2016-12-11 10:39:48 +01:00
Laurent Destailleur
9b436ce871 Merge remote-tracking branch 'origin/3.9' into 4.0
Conflicts:
	htdocs/product/class/product.class.php
2016-12-11 02:51:32 +01:00
Laurent Destailleur
b42a2616bc Merge remote-tracking branch 'origin/3.8' into 3.9
Conflicts:
	htdocs/install/mysql/migration/3.8.0-3.9.0.sql
2016-12-11 02:34:59 +01:00
Juanjo Menent
56aafa4660 Fix #5646 Error editing Sell Price on products/services 2016-12-10 23:25:13 +01:00
Laurent Destailleur
6e9d6b4e49 Merge pull request #6128 from simnandez/3.9
FIX #5853 $conf->global->$calc==0 || $conf->global->$calc==1
2016-12-10 23:17:33 +01:00
Juanjo Menent
5a2b8ff53c FIX #5853 $conf->global->$calc==0 || $conf->global->$calc==1 2016-12-10 22:41:53 +01:00
Laurent Destailleur
f49d332b73 Merge pull request #6113 from atm-maxime/3.8
Fix : delete product was not possible if batch stock
2016-12-10 13:16:50 +01:00
Laurent Destailleur
46d84f8f11 Merge pull request #6111 from simnandez/3.8
Fix: Delete surplus migration file
2016-12-10 13:16:16 +01:00
Maxime Kohlhaas
97e21cb775 Fix : delete product was not possible if batch stock 2016-12-10 13:05:46 +01:00
Juanjo Menent
829ff2299e Fix: Delete surplus migration file 2016-12-10 12:46:26 +01:00
Laurent Destailleur
08f27a5c28 Merge pull request #6076 from olsesacl/#6062
FIX: #6062 Can't add images to the description when edit product
2016-12-10 12:13:44 +01:00
florian HENRY
0f0db5a3fb fix: uniformize 2016-12-10 12:06:18 +01:00
Laurent Destailleur
45783e6bc5 Merge branch '4.0' of git@github.com:Dolibarr/dolibarr.git into 4.0 2016-12-10 12:04:56 +01:00
Laurent Destailleur
a45915e4a0 Better message after report on #5933 2016-12-10 12:04:13 +01:00
Laurent Destailleur
668937d7c9 Merge pull request #6097 from hregis/4.0_bug
Fix: contract use "total_vat" instead "total_tva"
2016-12-10 11:41:09 +01:00
Regis Houssin
239e42faa0 Fix: contract use "total_vat" instead "total_tva" 2016-12-09 13:04:05 +01:00
Laurent Destailleur
7a8ac224ed FIX A draft can be deleted by a user with create permission. 2016-12-09 00:18:27 +01:00
Sergio Sanchis Climent
79d6fa334b FIX: Consistent description for add or edit product 2016-12-08 13:12:10 +01:00
Sergio Sanchis Climent
863e569593 Merge branch '4.0' of https://github.com/Dolibarr/dolibarr into #6062 2016-12-08 13:11:07 +01:00
Laurent Destailleur
c2bee0f937 FIX #6088 2016-12-07 12:44:56 +01:00
Sergio Sanchis Climent
6dfeaabad5 FIX: #6062 2016-12-01 22:28:29 +01:00
43 changed files with 363 additions and 159 deletions

View File

@@ -12,6 +12,52 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade.
***** ChangeLog for 4.0.3 to 4.0.2 *****
FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1
FIX: #5958 no discount on supplier command made by replenishment
FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them
FIX: #5972 #5734
FIX: #6007
FIX: #6010
FIX: #6029
FIX: #6043 - Payment mode not visible on supplier invoice list
FIX: #6051
FIX: #6062
FIX: #6088
FIX: A draft can be deleted by a user with create permission.
FIX: bad permission to see contract on home page
FIX: bad permission to see contract statistics
FIX: Bcc must not appears to recipient when using SMTPs lib
FIX: Consistent description for add or edit product
FIX: delete contract extrafields on contract deletion
FIX: Deposits and credit notes weren't added in the received and pending columns
FIX: export extrafields must not include separe type
FIX: Export of opportunity status must be code, not id.
FIX: False positive on services not activated
FIX: Filter was wrong or lost during navigation
FIX: HT and TTC price should always be displayed together
FIX: if a supplier price reference is changed after creating an order, we can't clone order.
FIX: in export. Error when using a separate extrafields.
FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email.
FIX: javascript error when using on mobile/smartphone
FIX: javascript xss injection and a translation
FIX: Label of project is in field title not label.
FIX: List of people able to validate an expense report was not complete.
FIX: Missing field
FIX: Module gravatar was not triggered on thirdparty and contact card
FIX: Must use external link into a forged email content.
FIX: Pb in management of date end of projects
FIX: Regression when deleting product
FIX: rendering of output of estimated amount on project overview page.
FIX: Sanitize title of ajax_dialog
FIX: Security to restrict email sending was not efficient
FIX: Setting supplier as client when accept a supplier proposal
FIX: Some statistics not compatible with multicompany module.
FIX: the time spent on project was not visible in its overwiew
FIX: Update intervention lline crash with PgSQL
FIX: wrong test on dict.php
FIX: wrong var name
***** ChangeLog for 4.0.2 compared to 4.0.1 *****
FIX: #5340
FIX: #5779
@@ -115,7 +161,7 @@ NEW: Add hidden option to hide column qty ordered on shipments.
NEW: Add view of virtual stock into product list (when appropriate)
NEW: Add warning on tasks when they are late (add also the warning tolerance parameter)
NEW: Add weight/volume for one product into shipment export
NEW: Add width and height on product card
NEW: Add width and height on product table
NEW: allow a document to be linked to project from another customer on config
NEW: allow project to be shared across entities (for multicompany module)
NEW: All variant of ckeditor config can be tested into the setup page of module.

View File

@@ -222,7 +222,13 @@ $dolibarr_main_prod='0';
# $dolibarr_main_limit_users='0';
# dolibarr_mailing_limit_sendbyweb
# Can set a limit for mailing send by web, can be used for a restricted mode.
# Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
# Default value: 0 (use database value if exist)
# Examples:
# $dolibarr_mailing_limit_sendbyweb='0';
# dolibarr_mailing_limit_sendbycli
# Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
# Default value: 0 (use database value if exist)
# Examples:
# $dolibarr_mailing_limit_sendbycli='0';

View File

@@ -357,7 +357,7 @@ class AccountancyExport
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_compte, 20), 20);
$Tab['sens'] = $data->sens; // C or D
$Tab['signe_montant'] = '+';
$Tab['montant'] = str_pad(abs($data->montant) * 100, 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['montant'] = str_pad(abs($data->montant), 12, '0', STR_PAD_LEFT); // TODO manage negative amount
$Tab['contrepartie'] = str_repeat(' ', 8);
if (! empty($data->date_echeance))
$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);

View File

@@ -90,7 +90,8 @@ $configfileparameters=array(
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_strict_mode'
'?dolibarr_mailing_limit_sendbycli',
'?dolibarr_strict_mode'
);
$configfilelib=array(
// 'separator',

View File

@@ -284,7 +284,8 @@ $configfileparameters=array(
'separator4' => '',
'dolibarr_main_prod' => 'Production mode (Hide all error messages)',
'?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_mailing_limit_sendbycli' => 'Limit nb of email sent by cli',
'?dolibarr_strict_mode' => 'Strict mode is on/off',
'?dolibarr_pdf_force_fpdf' => 'Force fpdf usage to generate PDF'
);

View File

@@ -753,10 +753,12 @@ else
$sendingmode=$conf->global->MAIN_MAIL_SENDMODE;
if (empty($sendingmode)) $sendingmode='mail'; // If not defined, we use php mail function
// MAILING_NO_USING_PHPMAIL may be defined or not
// MAILING_LIMIT_SENDBYWEB is always defined to something != 0, MAILING_LIMIT_SENDBYCLI may be defined ot not.
if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail')
{
// EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent.
// You ensure that every user is using its own SMTP server.
// You ensure that every user is using its own SMTP server when using the mass emailing module.
$linktoadminemailbefore='<a href="'.DOL_URL_ROOT.'/admin/mails.php">';
$linktoadminemailend='</a>';
setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings');
@@ -764,19 +766,27 @@ else
if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings');
$_GET["action"]='';
}
else if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1')
{
// Pour des raisons de securite, on ne permet pas cette fonction via l'IHM,
// on affiche donc juste un message
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
// The feature is forbidden from GUI, we show just message to use from command line.
setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings');
setEventMessages('<textarea cols="60" rows="'.ROWS_1.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.'</textarea>', null, 'warnings');
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings');
if ($conf->file->mailing_limit_sendbyweb != '-1') // MAILING_LIMIT_SENDBYWEB was set to -1 in database, but it is allowed ot increase it.
{
setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant...
}
$_GET["action"]='';
}
else
{
$text='';
if ($conf->file->mailing_limit_sendbyweb == 0)
if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings');
if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings');
$text='';
if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0)
{
$text.=$langs->trans("MailingNeedCommand");
$text.='<br><textarea cols="60" rows="'.ROWS_2.'" wrap="soft">php ./scripts/emailings/mailing-send.php '.$object->id.' '.$user->login.'</textarea>';

View File

@@ -1216,6 +1216,12 @@ if ($resql)
$facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$paiement = $facturestatic->getSommePaiement();
$totalcreditnotes = $facturestatic->getSumCreditNotesUsed();
$totaldeposits = $facturestatic->getSumDepositsUsed();
$totalpay = $paiement + $totalcreditnotes + $totaldeposits;
$remaintopay = $obj->total_ttc - $totalpay;
print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.facnumber']['checked']))
@@ -1223,9 +1229,7 @@ if ($resql)
print '<td class="nowrap">';
$notetoshow=dol_string_nohtmltag(($user->societe_id>0?$obj->note_public:$obj->note_private),1);
$paiement = $facturestatic->getSommePaiement();
$remaintopay = $obj->total_ttc - $paiement;
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
print '<td class="nobordernopadding nowrap">';
@@ -1372,10 +1376,10 @@ if ($resql)
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print '<td align="right">'.(! empty($paiement)?price($paiement,0,$langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
print '<td align="right">'.(! empty($totalpay)?price($totalpay,0,$langs):'&nbsp;').'</td>'; // TODO Use a denormalized field
if (! $i) $totalarray['nbfield']++;
if (! $i) $totalarray['totalamfield']=$totalarray['nbfield'];
$totalarray['totalam'] += $paiement;
$totalarray['totalam'] += $totalpay;
}
if (! empty($arrayfields['rtp']['checked']))

View File

@@ -106,7 +106,7 @@ $fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
$calc=$conf->global->MAIN_INFO_LOCALTAX_CALC.$local;
// Affiche en-tete du rapport
if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice for goods and services
if ($calc==0 || $calc==1) // Calculate on invoice for goods and services
{
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$calc==0?$langs->trans("CalcModeLT".$local):$langs->trans("CalcModeLT".$local."Rec");
@@ -124,7 +124,7 @@ if ($conf->global->$calc==0 || $conf->global->$calc==1) // Calculate on invoice
$productsup=$langs->trans("Description");
$amountsup=$langs->trans("AmountHT");
}
if ($conf->global->$calc==2) // Invoice for goods, payment for services
if ($calc==2) // Invoice for goods, payment for services
{
$nom=$langs->transcountry($local==1?"LT1ReportByCustomersInInputOutputMode":"LT2ReportByCustomersInInputOutputMode",$mysoc->country_code);
$calcmode=$langs->trans("CalcModeLT2Debt");
@@ -149,7 +149,7 @@ $vatcust=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
$vatsup=$langs->transcountry($local==1?"LT1":"LT2",$mysoc->country_code);
// IRPF that the customer has retained me
if($conf->global->$calc ==0 || $conf->global->$calc == 2)
if($calc ==0 || $calc == 2)
{
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
@@ -232,7 +232,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 2)
}
// IRPF I retained my supplier
if($conf->global->$calc ==0 || $conf->global->$calc == 1){
if($calc ==0 || $calc == 1){
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print '<td align="left">'.$langs->trans("Num")."</td>";
@@ -309,7 +309,7 @@ if($conf->global->$calc ==0 || $conf->global->$calc == 1){
}
}
if($conf->global->$calc ==0){
if($calc ==0){
// Total to pay
print '<br><br>';
print '<table class="noborder" width="100%">';

View File

@@ -274,6 +274,18 @@ $dolibarr_nocsrfcheck='0';
// Examples:
// $dolibarr_main_limit_users='0';
// dolibarr_mailing_limit_sendbyweb
// Can set a limit for mailing send by web. This overwrite database value. Can be used to restrict on OS level.
// Default value: '0' (no overwrite, use database value if exists)
// Examples: '-1' (sending by web is forbidden)
// $dolibarr_mailing_limit_sendbyweb='0';
// dolibarr_mailing_limit_sendbycli
// Can set a limit for mailing send by cli. This overwrite database value. Can be used to restrict on OS level.
// Default value: '0' (no overwrite, use database value if exists)
// Examples: '-1' (sending by cli is forbidden)
// $dolibarr_mailing_limit_sendbycli='0';
// dolibarr_strict_mode
// Set this to 1 to enable the PHP strict mode. For dev environment only.
// Default value: 0 (use database value if exist)

View File

@@ -51,8 +51,8 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
{
// Increase date
$al = new AccountLine($db);
$al->datev_next($_GET["rowid"]);
$al->fetch($_GET["rowid"]);
$al->datev_next(GETPOST('rowid','int'));
$al->fetch(GETPOST('rowid','int'));
print '<span>'.dol_print_date($db->jdate($al->datev),"day").'</span>';
@@ -63,8 +63,8 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $
{
// Decrease date
$al =new AccountLine($db);
$al->datev_previous($_GET["rowid"]);
$al->fetch($_GET["rowid"]);
$al->datev_previous(GETPOST('rowid','int'));
$al->fetch(GETPOST('rowid','int'));
print '<span>'.dol_print_date($db->jdate($al->datev),"day").'</span>';

View File

@@ -152,6 +152,8 @@ class CMailFile
$this->msgishtml = $msgishtml;
}
if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html.
// Detect images
if ($this->msgishtml)
{
@@ -456,7 +458,7 @@ class CMailFile
*/
function sendfile()
{
global $conf,$db;
global $conf,$db,$langs;
$errorlevel=error_reporting();
error_reporting($errorlevel ^ E_WARNING); // Desactive warnings
@@ -479,6 +481,30 @@ class CMailFile
return $reshook;
}
// Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL
if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10;
$tmparray = explode(',', $this->addr_to);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in to:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
$tmparray = explode(',', $this->addr_cc);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in cc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
$tmparray = explode(',', $this->addr_bcc);
if (count($tmparray) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)
{
$this->error = 'Too much recipients in bcc:';
dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING);
return false;
}
// Action according to choosed sending method
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
{
@@ -507,8 +533,6 @@ class CMailFile
}
else
{
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'), LOG_DEBUG);
$bounce = ''; // By default
if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F))
{
@@ -521,7 +545,8 @@ class CMailFile
{
$bounce .= ($bounce?' ':'').'-ba';
}
dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$bounce, LOG_DEBUG);
$this->message=stripslashes($this->message);
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
@@ -539,7 +564,8 @@ class CMailFile
{
$this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems
}
$this->error.=".<br>Check your server logs and your firewalls setup";
$this->error.=".<br>";
$this->error.=$langs->trans("ErrorPhpMailDelivery");
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
}
else
@@ -824,7 +850,7 @@ class CMailFile
global $conf;
$out = "";
$host = dol_getprefix();
$host = dol_getprefix('email');
// Sender
//$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2;
@@ -942,8 +968,9 @@ class CMailFile
$strContent = preg_replace("/\r\n/si", "\n", $strContent);
}
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems bugged
$strContent = rtrim(wordwrap($strContent));
// Make RFC2045 Compliant, split lines
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent)); // TODO Using this method creates unexpected line break on text/plain content.
if ($this->msgishtml)
{

View File

@@ -366,13 +366,13 @@ abstract class CommonDocGenerator
$array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code)!='PaymentCondition'.$object->cond_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code):$object->cond_reglement),
$array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs),
$array_key.'_total_vat_locale'=>price($object->total_tva, 0, $outputlangs),
$array_key.'_total_vat_locale'=>(! empty($object->total_vat)?price($object->total_vat, 0, $outputlangs):price($object->total_tva, 0, $outputlangs)),
$array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs),
$array_key.'_total_localtax2_locale'=>price($object->total_localtax2, 0, $outputlangs),
$array_key.'_total_ttc_locale'=>price($object->total_ttc, 0, $outputlangs),
$array_key.'_total_discount_ht_locale' => price($object->getTotalDiscount(), 0, $outputlangs),
$array_key.'_total_ht'=>price2num($object->total_ht),
$array_key.'_total_vat'=>price2num($object->total_tva),
$array_key.'_total_vat'=>(! empty($object->total_vat)?price2num($object->total_vat):price2num($object->total_tva)),
$array_key.'_total_localtax1'=>price2num($object->total_localtax1),
$array_key.'_total_localtax2'=>price2num($object->total_localtax2),
$array_key.'_total_ttc'=>price2num($object->total_ttc),
@@ -586,9 +586,10 @@ abstract class CommonDocGenerator
{
if (strlen($object->array_options['options_'.$key])>0)
{
$object->array_options['options_'.$key] = dol_print_date($object->array_options['options_'.$key],'day'); // using company output language
$object->array_options['options_'.$key.'_locale'] = dol_print_date($object->array_options['options_'.$key],'day','tzserver',$outputlangs); // using output language format
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($object->array_options['options_'.$key],'dayrfc'); // international format
$date = $object->array_options['options_'.$key];
$object->array_options['options_'.$key] = dol_print_date($date,'day'); // using company output language
$object->array_options['options_'.$key.'_locale'] = dol_print_date($date,'day','tzserver',$outputlangs); // using output language format
$object->array_options['options_'.$key.'_rfc'] = dol_print_date($date,'dayrfc'); // international format
}
else
{
@@ -596,12 +597,17 @@ abstract class CommonDocGenerator
$object->array_options['options_'.$key.'_locale'] = '';
$object->array_options['options_'.$key.'_rfc'] = '';
}
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
}
else if($extrafields->attribute_type[$key] == 'datetime')
{
$object->array_options['options_'.$key] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language
$object->array_options['options_'.$key.'_locale'] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour','tzserver',$outputlangs):''); // using output language format
$object->array_options['options_'.$key.'_rfc'] = ($object->array_options['options_'.$key]!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):''); // international format
$datetime = $object->array_options['options_'.$key];
$object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language
$object->array_options['options_'.$key.'_locale'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour','tzserver',$outputlangs):''); // using output language format
$object->array_options['options_'.$key.'_rfc'] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhourrfc'):''); // international format
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale']));
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc']));
}
$array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key => $object->array_options['options_'.$key]));
}

View File

@@ -543,10 +543,13 @@ class Conf
$this->bank->cheque->warning_delay=(isset($this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT)?$this->global->MAIN_DELAY_CHEQUES_TO_DEPOSIT:0)*24*60*60;
}
if (isset($this->expensereport)) {
$this->expensereport->approve = new stdClass();
$this->expensereport->approve->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS)?$this->global->MAIN_DELAY_EXPENSEREPORTS:0)*24*60*60;
$this->expensereport->payment = new stdClass();
$this->expensereport->payment->warning_delay=(isset($this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY)?$this->global->MAIN_DELAY_EXPENSEREPORTS_TO_PAY:0)*24*60*60;
}
// For modules that want to disable top or left menu
if (! empty($this->global->MAIN_HIDE_TOP_MENU)) $this->dol_hide_topmenu=$this->global->MAIN_HIDE_TOP_MENU;
if (! empty($this->global->MAIN_HIDE_LEFT_MENU)) $this->dol_hide_leftmenu=$this->global->MAIN_HIDE_LEFT_MENU;

View File

@@ -743,7 +743,7 @@ class ExtraFields
}
elseif ($type == 'price')
{
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="6" value="'.price2num($value).'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
}
elseif ($type == 'double')
{

View File

@@ -1190,6 +1190,8 @@ class SMTPs
$host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix
$host=dol_getprefix('email').'-'.$host;
//NOTE: Message-ID should probably contain the username of the user who sent the msg
$_header .= 'Subject: ' . $this->getSubject() . "\r\n";
$_header .= 'Date: ' . date("r") . "\r\n";
@@ -1251,7 +1253,9 @@ class SMTPs
// Make RFC821 Compliant, replace bare linefeeds
$strContent = preg_replace("/(?<!\r)\n/si", "\r\n", $strContent);
$strContent = rtrim(wordwrap($strContent, 75, "\r\n"));
// Make RFC2045 Compliant
//$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content
$strContent = rtrim(wordwrap($strContent, 75, "\r\n")); // TODO Using this method creates unexpected line break on text/plain content.
$this->_msgContent[$strType] = array();

View File

@@ -287,10 +287,20 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
* This prefix is unique for instance and avoid conflict between multi-instances,
* even when having two instances with one root dir or two instances in virtual servers
*
* @param string $mode '' or 'email'
* @return string A calculated prefix
*/
function dol_getprefix()
function dol_getprefix($mode='')
{
global $conf;
// If MAIL_PREFIX_FOR_EMAIL_ID is set and prefix is for email
if ($mode == 'email' && ! empty($conf->global->MAIL_PREFIX_FOR_EMAIL_ID))
{
if ($conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') return $conf->global->MAIL_PREFIX_FOR_EMAIL_ID;
else if (isset($_SERVER["SERVER_NAME"])) return $_SERVER["SERVER_NAME"];
}
if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"]))
{
return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
@@ -3522,7 +3532,7 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
* @param float $vatrate Vat rate. Can be '8.5' or '8.5 (VATCODEX)' for example
* @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2)
* @param Societe $thirdparty_buyer Object of buying third party
* @param Societe $thirdparty_seller Object of selling third party
* @param Societe $thirdparty_seller Object of selling third party ($mysoc if not defined)
* @param int $vatnpr If vat rate is NPR or not
* @return mixed 0 if not found, localtax rate if found
* @see get_default_tva
@@ -3581,18 +3591,15 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 1 && ! $thirdparty_seller->localtax1_assuj) return 0;
if ($local == 2 && ! $thirdparty_seller->localtax2_assuj) return 0;
}
//if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0);
// Do not enabled this. We want localtax that match the vat rate.
// If we forced a vat, we must also force local tax
/*
if (is_object($thirdparty_buyer))
// For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on.
if (in_array($mysoc->country_code, array('ES')))
{
if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0;
}*/
$conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY = 1;
}
// Search local taxes
if ($mysoc->country_code == 'ES' || ! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
if (! empty($conf->global->MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY))
{
if ($local==1)
{

View File

@@ -129,6 +129,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}

View File

@@ -135,12 +135,14 @@ class pdf_crabe extends ModelePDFFactures
$this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images
if ($this->page_largeur < 210) // To work with US executive format
{
$this->posxpicture-=20;
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
$this->posxpicture-=20;
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20;
$this->posxprogress-=20;
$this->postotalht-=20;
}
$this->tva=array();
@@ -297,7 +299,7 @@ class pdf_crabe extends ModelePDFFactures
$this->atleastonediscount++;
}
}
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS))
if (empty($this->atleastonediscount) && empty($conf->global->PRODUCT_USE_UNITS)) // retreive space not used by discount
{
$this->posxpicture+=($this->postotalht - $this->posxdiscount);
$this->posxtva+=($this->postotalht - $this->posxdiscount);
@@ -527,9 +529,9 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($this->posxprogress-$this->posxdiscount+2, 3, $remise_percent, 0, 'R');
}
// Situation progress
if ($this->situationinvoice)
{
// Situation progress
$progress = pdf_getlineprogress($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxprogress, $curY);
$pdf->MultiCell($this->postotalht-$this->posxprogress, 3, $progress, 0, 'R');

View File

@@ -214,17 +214,16 @@ class modProjet extends DolibarrModules
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text",
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text",
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'cls.code'=>"project",'p.opp_percent'=>'project','p.description'=>"project");
's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country',
's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description");
'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description");
// Add fields for project
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array());

View File

@@ -127,6 +127,7 @@ class pdf_azur extends ModelePDFPropales
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}

View File

@@ -113,6 +113,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}

View File

@@ -127,6 +127,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}

View File

@@ -115,6 +115,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->posxtva-=20;
$this->posxup-=20;
$this->posxqty-=20;
$this->posxunit-=20;
$this->posxdiscount-=20;
$this->postotalht-=20;
}

View File

@@ -1515,17 +1515,17 @@ else
// Validation date
print '<tr>';
print '<td>'.$langs->trans("DATE_SAVE").'</td>';
print '<td>'.dol_print_date($object->date_create,'dayhour');
print '<td>'.dol_print_date($object->date_valid,'dayhour');
if ($object->status == 2 && $object->hasDelay('toapprove')) print ' '.img_warning($langs->trans("Late"));
if ($object->status == 5 && $object->hasDelay('topay')) print ' '.img_warning($langs->trans("Late"));
print '</td></tr>';
print '</tr>';
// User to inform
// User to inform for approval
if ($object->fk_statut < 3) // informed
{
print '<tr>';
print '<td>'.$langs->trans("VALIDATOR").'</td>';
print '<td>'.$langs->trans("VALIDATOR").'</td>'; // approver
print '<td>';
if ($object->fk_user_validator > 0)
{

View File

@@ -907,7 +907,6 @@ class ExpenseReport extends CommonObject
}
}
}
if ($this->fk_statut != 2)
{
$now = dol_now();
@@ -918,7 +917,7 @@ class ExpenseReport extends CommonObject
$sql.= ", ref_number_int = ".$ref_number_int;
}
$sql.= ' WHERE rowid = '.$this->id;
$resql=$this->db->query($sql);
if ($resql)
{
@@ -1598,13 +1597,13 @@ class ExpenseReport extends CommonObject
if ($option == 'toapprove')
{
if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->approve->warning_delay)) {
if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->approve->warning_delay)) {
$response->nbtodolate++;
}
}
else
{
if ($this->db->jdate($obj->datevalid) < ($now - $conf->expensereport->payment->warning_delay)) {
if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->payment->warning_delay)) {
$response->nbtodolate++;
}
}
@@ -1635,11 +1634,12 @@ class ExpenseReport extends CommonObject
if ($option == 'topay' && $this->status != 5) return false;
$now = dol_now();
if ($option == 'toapprove')
return $this->datevalid < ($now - $conf->expensereport->approve->warning_delay);
{
return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->approve->warning_delay);
}
else
return $this->datevalid < ($now - $conf->expensereport->payment->warning_delay);
return ($this->datevalid?$this->datevalid:$this->date_valid) < ($now - $conf->expensereport->payment->warning_delay);
}
}

View File

@@ -141,7 +141,7 @@ if (!empty($sall))
}
// Ref
if(!empty($search_ref)){
$sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'";
$sql.= natural_search("d.ref", $search_ref);
}
// Date Start
if ($month_start > 0)
@@ -325,9 +325,9 @@ if ($resql)
$expensereportstatic->id=$objp->rowid;
$expensereportstatic->ref=$objp->ref;
$expensereportstatic->status=$objp->status;
$expensereportstatic->valid=$objp->date_valid;
$expensereportstatic->date_debut=$objp->date_debut;
$expensereportstatic->date_fin=$objp->date_fin;
$expensereportstatic->date_valid=$db->jdate($objp->date_valid);
$expensereportstatic->date_debut=$db->jdate($objp->date_debut);
$expensereportstatic->date_fin=$db->jdate($objp->date_fin);
$var=!$var;
print "<tr ".$bc[$var].">";

View File

@@ -31,7 +31,7 @@
*/
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.2');
if (! defined('DOL_VERSION')) define('DOL_VERSION','4.0.3');
if (! defined('EURO')) define('EURO',chr(128));
@@ -151,6 +151,7 @@ if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0;
if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey='';
if (empty($dolibarr_main_limit_users)) $dolibarr_main_limit_users=0;
if (empty($dolibarr_mailing_limit_sendbyweb)) $dolibarr_mailing_limit_sendbyweb=0;
if (empty($dolibarr_mailing_limit_sendbycli)) $dolibarr_mailing_limit_sendbycli=0;
if (empty($dolibarr_strict_mode)) $dolibarr_strict_mode=0; // For debug in php strict mode
// TODO Multicompany Remove this. Useless.
if (empty($multicompany_transverse_mode)) $multicompany_transverse_mode=0;

View File

@@ -324,10 +324,10 @@ class CommandeFournisseur extends CommonOrder
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc;
$line->ref = $objp->product_ref;
$line->product_ref = $objp->product_ref;
$line->ref_fourn = $objp->ref_supplier;
$line->ref_supplier = $objp->ref_supplier;
$line->ref = $objp->product_ref; // Ref of product
$line->product_ref = $objp->product_ref; // Ref of product
$line->ref_fourn = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since
$line->ref_supplier = $objp->ref_supplier; // The supplier ref of price when product was added. May have change since
$line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end);
@@ -1139,7 +1139,7 @@ class CommandeFournisseur extends CommonOrder
$this->lines[$i]->localtax2_tx,
$this->lines[$i]->fk_product,
0,
$this->lines[$i]->ref_fourn,
$this->lines[$i]->ref_fourn, // $this->lines[$i]->ref_fourn comes from field ref into table of lines. Value may ba a ref that does not exists anymore, so we first try with value of product
$this->lines[$i]->remise_percent,
'HT',
0,
@@ -1295,7 +1295,7 @@ class CommandeFournisseur extends CommonOrder
* @param float $txlocaltax2 Localtax2 tax
* @param int $fk_product Id product
* @param int $fk_prod_fourn_price Id supplier price
* @param string $fourn_ref Supplier reference
* @param string $fourn_ref Supplier reference price
* @param float $remise_percent Remise
* @param string $price_base_type HT or TTC
* @param float $pu_ttc Unit price TTC
@@ -1341,7 +1341,8 @@ class CommandeFournisseur extends CommonOrder
$pu=$pu_ttc;
}
$desc=trim($desc);
$ref=''; // Ref of supplier price when we add line
// Check parameters
if ($qty < 1 && ! $fk_product)
{
@@ -1363,15 +1364,28 @@ class CommandeFournisseur extends CommonOrder
$prod = new Product($this->db, $fk_product);
if ($prod->fetch($fk_product) > 0)
{
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, $fourn_ref); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref
$product_type = $prod->type;
$label = $prod->libelle;
// We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
$result=$prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', $this->fk_soc); // Search on couple $fk_prod_fourn_price/$qty first, then on triplet $qty/$fk_product/$fourn_ref/$this->fk_soc
if ($result > 0)
{
$label = $prod->libelle;
$pu = $prod->fourn_pu;
$ref = $prod->ref_fourn;
$product_type = $prod->type;
$pu = $prod->fourn_pu; // Unit price supplier price set by get_buyprice
$ref = $prod->ref_fourn; // Ref supplier price set by get_buyprice
}
if ($result == 0 || $result == -1)
if ($result == 0) // If result == 0, we failed to found the supplier reference price
{
$langs->load("errors");
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
$this->db->rollback();
dol_syslog(get_class($this)."::addline we did not found supplier price, so we can't guess unit price");
//$pu = $prod->fourn_pu; // We do not overwrite unit price
//$ref = $prod->ref_fourn; // We do not overwrite ref supplier price
return -1;
}
if ($result == -1)
{
$langs->load("errors");
$this->error = "Ref " . $prod->ref . " " . $langs->trans("ErrorQtyTooLowForThisSupplier");
@@ -1424,7 +1438,7 @@ class CommandeFournisseur extends CommonOrder
$subprice = price2num($pu,'MU');
// TODO We should use here $this->line=new CommandeFournisseurLigne($this->db); and $this->line->insert(); to work loke other object (proposal, order, invoice)
// TODO We should use here $this->line=new CommandeFournisseurLigne($this->db); and $this->line->insert(); to work like other object (proposal, order, invoice)
$sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseurdet";
$sql.= " (fk_commande, label, description, date_start, date_end,";
$sql.= " fk_product, product_type,";
@@ -2708,15 +2722,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
// From llx_product_fournisseur_price
/**
* Supplier ref
* @var string
* @deprecated Use ref_supplier
* @see ref_supplier
*/
public $ref_fourn;
/**
* Supplier reference
* Supplier reference of price when we added the line. May have been changed after line was added.
* @var string
*/
public $ref_supplier;

View File

@@ -1219,11 +1219,11 @@ class FactureFournisseur extends CommonInvoice
$txtva=price2num($txtva);
$txlocaltax1=price2num($txlocaltax1);
$txlocaltax2=price2num($txlocaltax2);
$ref=''; // Ref of supplier price when we add line
// Check parameters
if ($type < 0) return -1;
$this->db->begin();
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
@@ -1954,12 +1954,14 @@ class SupplierInvoiceLine extends CommonObjectLine
* @var string
*/
public $product_ref;
/**
* Reference product supplier
* TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields it into updateline
* Supplier reference of price when we added the line. May have been changed after line was added.
* TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields into updateline
* @var string
*/
public $ref_supplier;
/**
* @deprecated
* @see label

View File

@@ -27,7 +27,7 @@
-- de l'install et tous les sigles '--' sont supprimés.
--
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (1,'RECEP', 1,1, 'A réception de facture','Réception de facture',0,1);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (1,'RECEP', 1,1, 'Due Upon Receipt','Due Upon Receipt',0,1);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (2,'30D', 2,1, '30 jours','Réglement à 30 jours',0,30);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (3,'30DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 30 jours fin de mois',1,30);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, fdm, nbjour) values (4,'60D', 4,1, '60 jours','Réglement à 60 jours',0,60);

View File

@@ -329,8 +329,8 @@ GeneratedFromRecurringInvoice=Generated from template recurring invoice %s
DateIsNotEnough=Date not reached yet
InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s
# PaymentConditions
PaymentConditionShortRECEP=Immediate
PaymentConditionRECEP=Immediate
PaymentConditionShortRECEP=Due Upon Receipt
PaymentConditionRECEP=Due Upon Receipt
PaymentConditionShort30D=30 days
PaymentCondition30D=30 days
PaymentConditionShort30DENDMONTH=30 days of month-end

View File

@@ -174,7 +174,8 @@ ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to
ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enougth for product %s to add it into a new invoice.
ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enougth for product %s to add it into a new shipment.
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enougth for product %s to add it into a new proposal.
ErrorFailedToLoadLoginFileForMode=Failed to get the login file for mode '%s'.
ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'.
ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information.
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@@ -87,9 +87,10 @@ MailNoChangePossible=Recipients for validated emailing can't be changed
SearchAMailing=Search mailing
SendMailing=Send emailing
SendMail=Send email
MailingNeedCommand=For security reason, sending an emailing is better when performed from command line. If you have one, ask your server administrator to launch the following command to send the emailing to all recipients:
SentBy=Sent by
MailingNeedCommand=Sending an emailing can be performed from command line. Ask your server administrator to launch the following command to send the emailing to all recipients:
MailingNeedCommand2=You can however send them online by adding parameter MAILING_LIMIT_SENDBYWEB with value of max number of emails you want to send by session. For this, go on Home - Setup - Other.
ConfirmSendingEmailing=If you can't or prefer sending them with your www browser, please confirm you are sure you want to send emailing now from your browser ?
ConfirmSendingEmailing=If you want to send emailing directly from this screen, please confirm you are sure you want to send emailing now from your browser ?
LimitSendingEmailing=Note: Sending of emailings from web interface is done in several times for security and timeout reasons, <b>%s</b> recipients at a time for each sending session.
TargetsReset=Clear list
ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing

View File

@@ -89,7 +89,6 @@ function test_sql_and_script_inject($val, $type)
$sql_inj += preg_match('/union.+select/i', $val);
$sql_inj += preg_match('/into\s+(outfile|dumpfile)/i', $val);
$sql_inj += preg_match('/(\.\.%2f)+/i', $val);
$sql_inj += preg_match('/onerror=/i', $val);
}
// For XSS Injection done by adding javascript with script
// This is all cases a browser consider text is javascript:
@@ -98,7 +97,8 @@ function test_sql_and_script_inject($val, $type)
$sql_inj += preg_match('/<script/i', $val);
if (! defined('NOSTYLECHECK')) $sql_inj += preg_match('/<style/i', $val);
$sql_inj += preg_match('/base[\s]+href/si', $val);
$sql_inj += preg_match('/<.*onmouse/si', $val); // onmouseover can be set on img or any html tag like <img title='>' onmouseover=alert(1)>
$sql_inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='>' onmouseover=alert(1)>
$sql_inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='>' onerror = alert(1)>
if ($type == 1)
{
$sql_inj += preg_match('/javascript:/i', $val);

View File

@@ -61,6 +61,7 @@ if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type=constant('TEST_DB_FORCE_TYPE'
// Set properties specific to conf file
$conf->file->main_limit_users = $dolibarr_main_limit_users;
$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb;
$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli;
$conf->file->main_authentication = empty($dolibarr_main_authentication)?'':$dolibarr_main_authentication; // Identification mode
$conf->file->main_force_https = empty($dolibarr_main_force_https)?'':$dolibarr_main_force_https; // Force https
$conf->file->strict_mode = empty($dolibarr_strict_mode)?'':$dolibarr_strict_mode; // Force php strict mode (for debug)
@@ -188,6 +189,18 @@ if (! empty($conf->file->mailing_limit_sendbyweb))
{
$conf->global->MAILING_LIMIT_SENDBYWEB = $conf->file->mailing_limit_sendbyweb;
}
if (empty($conf->global->MAILING_LIMIT_SENDBYWEB))
{
$conf->global->MAILING_LIMIT_SENDBYWEB = 25;
}
if (! empty($conf->file->mailing_limit_sendbycli))
{
$conf->global->MAILING_LIMIT_SENDBYCLI = $conf->file->mailing_limit_sendbycli;
}
if (empty($conf->global->MAILING_LIMIT_SENDBYCLI))
{
$conf->global->MAILING_LIMIT_SENDBYCLI = 0;
}
// If software has been locked. Only login $conf->global->MAIN_ONLY_LOGIN_ALLOWED is allowed.
if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))

View File

@@ -963,7 +963,7 @@ else
// Description (used in invoice, propal...)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
$doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, '80%');
$doleditor = new DolEditor('desc', GETPOST('desc'), '', 160, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 4, '80%');
$doleditor->Create();
print "</td></tr>";

View File

@@ -925,10 +925,26 @@ class Product extends CommonObject
// End call triggers
}
// Delete from product_batch on product delete
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX.'product_batch';
$sql.= " WHERE fk_product_stock IN (";
$sql.= "SELECT rowid FROM ".MAIN_DB_PREFIX.'product_stock';
$sql.= " WHERE fk_product = ".$id.")";
dol_syslog(get_class($this).'::delete', LOG_DEBUG);
$result = $this->db->query($sql);
if (! $result)
{
$error++;
$this->errors[] = $this->db->lasterror();
}
}
// Delete all child tables
if (! $error)
{
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_lot');
$elements = array('product_fournisseur_price','product_price','product_lang','categorie_product','product_stock','product_customer_price','product_lot'); // product_batch is done before
foreach($elements as $table)
{
if (! $error)
@@ -1318,10 +1334,11 @@ class Product extends CommonObject
* @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price
* @param double $qty Quantity asked or -1 to get first entry found
* @param int $product_id Filter on a particular product id
* @param string $fourn_ref Filter on a supplier ref. 'none' to exclude ref in search.
* @param string $fourn_ref Filter on a supplier price ref. 'none' to exclude ref in search.
* @param int $fk_soc If of supplier
* @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...)
*/
function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='')
function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0)
{
global $conf;
$result = 0;
@@ -1367,12 +1384,13 @@ class Product extends CommonObject
}
else // If not found
{
// We do a second search by doing a select again but searching with qty and id product
// We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc.
$sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,";
$sql.= " pfp.fk_product, pfp.ref_fourn as ref_supplier, pfp.tva_tx, pfp.fk_supplier_price_expression";
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
$sql.= " WHERE pfp.fk_product = ".$product_id;
if ($fourn_ref != 'none') $sql.= " AND pfp.ref_fourn = '".$fourn_ref."'";
if ($fk_soc > 0) $sql.= " AND pfp.fk_soc = ".$fk_soc;
if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty;
$sql.= " ORDER BY pfp.quantity DESC";
$sql.= " LIMIT 1";

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2014 Ion agorria <ion@agorria.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@@ -282,6 +282,13 @@ if (empty($reshook))
$localtax2 = $obj->localtax2;
$localtax1_type = $obj->localtax1_type;
$localtax2_type = $obj->localtax2_type;
// If spain, we don't use the localtax found into tax record in database with same code, but using the get_localtax rule
if (in_array($mysoc->country_code, array('ES')))
{
$localtax1 = get_localtax($tva_tx,1);
$localtax2 = get_localtax($tva_tx,2);
}
}
}
$pricestoupdate[0] = array(

View File

@@ -751,6 +751,11 @@ foreach ($listofreferent as $key => $value)
}
print $formfile->getDocumentsLink($element_doc, $filename, $filedir);
// Show supplier ref
if (! empty($element->ref_supplier)) print ' - '.$element->ref_supplier;
// Show customer ref
if (! empty($element->ref_customer)) print ' - '.$element->ref_customer;
}
print "</td>\n";

View File

@@ -1791,7 +1791,7 @@ if ($action == 'create')
}
// Delete
if ($user->rights->supplier_proposal->supprimer) {
if (($object->statut == 0 && $user->rights->supplier_proposal->creer) || $user->rights->supplier_proposal->supprimer) {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=delete"';
print '>' . $langs->trans('Delete') . '</a></div>';
}

View File

@@ -11,6 +11,7 @@
* Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1631,24 +1632,11 @@ class SupplierProposal extends CommonObject
$trigger_name='SUPPLIER_PROPOSAL_CLOSE_SIGNED';
$modelpdf=$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL?$conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL:$this->modelpdf;
// The connected company is classified as a client
$soc=new Societe($this->db);
$soc->id = $this->socid;
$result=$soc->set_as_client();
if ($result < 0)
if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists
{
$this->error=$this->db->error();
$this->db->rollback();
return -2;
$result = $this->updateOrCreatePriceFournisseur($user);
}
else
{
if (! empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists
{
$result = $this->updateOrCreatePriceFournisseur($user);
}
}
}
if ($statut == 4)
{

View File

@@ -61,6 +61,11 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
if ($conf->global->MAILING_LIMIT_SENDBYCLI == '-1')
{
}
$user = new User($db);
// for signature, we use user send as parameter
if (! empty($login)) $user->fetch('',$login);
@@ -108,7 +113,11 @@ if ($resql)
$sql2 = "SELECT mc.rowid, mc.lastname as lastname, mc.firstname as firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
$sql2.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql2.= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$id;
if ($conf->global->MAILING_LIMIT_SENDBYCLI > 0)
{
$sql2.= " LIMIT ".$conf->global->MAILING_LIMIT_SENDBYCLI;
}
$resql2=$db->query($sql2);
if ($resql2)
{

View File

@@ -219,7 +219,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
print __METHOD__." DOL_MAIN_URL_ROOT=".DOL_MAIN_URL_ROOT."\n";
print __METHOD__." DOL_URL_ROOT=".DOL_URL_ROOT."\n";
$this->assertEquals(DOL_URL_ROOT,$expectedresult);
$this->assertEquals($expectedresult, DOL_URL_ROOT);
return true;
}
@@ -245,7 +245,7 @@ class CoreTest extends PHPUnit_Framework_TestCase
global $dolibarr_main_db_prefix;
// This is code copied from main.inc.php
// This is code copied from main.inc.php !!!!!!!!!!!!!!!
/**
* Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF).
@@ -258,14 +258,16 @@ class CoreTest extends PHPUnit_Framework_TestCase
{
$sql_inj = 0;
// For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests)
if ($type != 2) {
$sql_inj += preg_match('/delete[\s]+from/i', $val);
$sql_inj += preg_match('/create[\s]+table/i', $val);
$sql_inj += preg_match('/update.+set.+=/i', $val);
$sql_inj += preg_match('/insert[\s]+into/i', $val);
$sql_inj += preg_match('/select.+from/i', $val);
$sql_inj += preg_match('/union.+select/i', $val);
$sql_inj += preg_match('/(\.\.%2f)+/i', $val);
if ($type != 2)
{
$sql_inj += preg_match('/delete\s+from/i', $val);
$sql_inj += preg_match('/create\s+table/i', $val);
$sql_inj += preg_match('/update.+set.+=/i', $val);
$sql_inj += preg_match('/insert\s+into/i', $val);
$sql_inj += preg_match('/select.+from/i', $val);
$sql_inj += preg_match('/union.+select/i', $val);
$sql_inj += preg_match('/into\s+(outfile|dumpfile)/i', $val);
$sql_inj += preg_match('/(\.\.%2f)+/i', $val);
}
// For XSS Injection done by adding javascript with script
// This is all cases a browser consider text is javascript:
@@ -273,22 +275,40 @@ class CoreTest extends PHPUnit_Framework_TestCase
// All examples on page: http://ha.ckers.org/xss.html#XSScalc
$sql_inj += preg_match('/<script/i', $val);
if (! defined('NOSTYLECHECK')) $sql_inj += preg_match('/<style/i', $val);
$sql_inj += preg_match('/base[\s]+href/i', $val);
if ($type == 1) {
$sql_inj += preg_match('/base[\s]+href/si', $val);
$sql_inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='>' onmouseover=alert(1)>
$sql_inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='>' onerror = alert(1)>
if ($type == 1)
{
$sql_inj += preg_match('/javascript:/i', $val);
$sql_inj += preg_match('/vbscript:/i', $val);
}
// For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param)
if ($type == 1) $sql_inj += preg_match('/"/i', $val); // We refused " in GET parameters value
if ($type == 2) $sql_inj += preg_match('/[\s;"]/', $val); // PHP_SELF is an url and must match url syntax
if ($type == 2) $sql_inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces.
return $sql_inj;
}
//type=2 key=0 value=/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices
// Run tests
$_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices';
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"],2);
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2);
$expectedresult=0;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1a');
$_SERVER["PHP_SELF"]='/DIR WITH SPACE/htdocs/admin/index.php?mainmenu=home&leftmenu=setup&username=weservices;badaction';
$result=test_sql_and_script_inject($_SERVER["PHP_SELF"], 2);
$expectedresult=1;
$this->assertEquals($result,$expectedresult);
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 1b');
$_GET['aaa']="<img src='1.jpg' onerror =javascript:alert('XSS')>";
$result=test_sql_and_script_inject($_GET['aaa'], 0);
$expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 2');
$_POST['bbb']="<img src='1.jpg' onerror =javascript:alert('XSS')>";
$result=test_sql_and_script_inject($_POST['bbb'], 2);
$expectedresult=1;
$this->assertEquals($expectedresult, $result, 'Error on test_sql_and_script_inject 3');
}
}