diff --git a/ChangeLog b/ChangeLog index d3274e1048d..1ad2ff66841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,61 @@ during migration. Upgrading to any other version or any other database system is abolutely required BEFORE trying make a Dolibarr upgrade. + +***** ChangeLog for 3.9.4 compared to 3.9.3 ***** +FIX: #2853 +FIX: #3128 +FIX: #4447 +FIX: #5128 if create method return duplicated code error not use GETPOST in order to get a new code +FIX: #5340 +FIX: #5473 +FIX: #5474 Country_id of "Don" object is still empty +FIX: #5534 +FIX: #5535 bad dependency. +FIX: #5537 AJAX project search does not work properly +FIX: #5540 getFormMail is not registered as addReplace hook +FIX: #5544 Disabled Contact still appear in lists to send emails +FIX: #5549 getNomUrl tooltips show Order info even if user has no rights to read them +FIX: #5568 +FIX: #5594 +FIX: #5629 PgSQL Interger string stylish error +FIX: #5651 +FIX: #5660 +FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 +FIX: #5907 +FIX: #5966 Bug: getNomUrl tooltips show Proposal info even if user has no rights to read them +FIX: #6051 +FIX: #6088 +FIX: Can correct stock of lot using eatby or sell by date +FIX: Can make a movement on "out of sell" products +FIX: cannot update bank account on invoice if module order not activated +FIX: Can't create withdrawal document +FIX: delete contract extrafields on contract deletion +FIX: Direction of movement lost if an error occurs +FIX: Error when CATEGORIE_RECURSIV_ADD is enabled and new category is daughter of an already linked to object +FIX: export extrafields must not include separe type +FIX: External user must not be able to edit its discounts +FIX: Failed to export contact categories with contact extra fields +FIX: header title in commercial area +FIX: HT and TTC price should always be displayed together +FIX: incoterms +FIX: incoterms do not output into crabe invoice PDF +FIX: in PgSQL no quote "word style" is permitted around column name +FIX: Introduce hidden option MAIL_PREFIX_FOR_EMAIL_ID to solve pb of tracking email. +FIX: margin tab on customer card must filter on current entity invoices +FIX: missing column into SQL on thridparty list +FIX: only show projects of related third if external user +FIX: PgSQL Module Ressource list crash #5637 +FIX: php Strict +FIX: Regression when deleting product +FIX: Security to restrict email sending was not efficient +FIX: tag for date rfc in odt substitution +FIX: Update intervention lline crash with PgSQL +FIX: update limit stock on product stock +FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15) +FIX: wrong test on dict.php + + ***** ChangeLog for 3.9.3 compared to 3.9.2 ***** FIX: #4383 $userid not defined FIX: #4448 $filebonprev is not used, $this->filename now diff --git a/build/debian/conf.php.install b/build/debian/conf.php.install index c0ba3bdb120..72b18049a6c 100644 --- a/build/debian/conf.php.install +++ b/build/debian/conf.php.install @@ -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'; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index bef8c6951bf..cae081e55e3 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1292,8 +1292,6 @@ if ($id) } else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index 1ff005e88b2..0fb3a6c9a7b 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -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', diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index eeea93a2fea..38ae5377710 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -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' ); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index cf2b475e10d..7ea5719bb6e 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -928,7 +928,14 @@ if (count($listofextcals)) // Complete $eventarray with events coming from external module $parameters=array(); $object=null; $reshook=$hookmanager->executeHooks('getCalendarEvents',$parameters,$object,$action); -if (! empty($hookmanager->resArray['eventarray'])) $eventarray=array_merge($eventarray, $hookmanager->resArray['eventarray']); +if (! empty($hookmanager->resArray['eventarray'])) { + foreach ($hookmanager->resArray['eventarray'] as $keyDate => $events) { + if (!isset($eventarray[$keyDate])) { + $eventarray[$keyDate]=array(); + } + $eventarray[$keyDate]=array_merge($eventarray[$keyDate], $events); + } +} diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 2cb2337d177..7a3e1ab8057 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -761,10 +761,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=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); @@ -772,19 +774,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('', 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.='
'; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 463c81266f8..25ed1acb27e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2734,20 +2734,33 @@ class Propal extends CommonObject */ function getNomUrl($withpicto=0,$option='', $get_params='') { - global $langs, $conf; + global $langs, $conf, $user; $result=''; - $label = '' . $langs->trans("ShowPropal") . ''; - if (! empty($this->ref)) - $label.= '
'.$langs->trans('Ref').': '.$this->ref; - if (! empty($this->ref_client)) - $label.= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (! empty($this->total_ht)) - $label.= '
' . $langs->trans('AmountHT') . ': ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_tva)) - $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (! empty($this->total_ttc)) - $label.= '
' . $langs->trans('AmountTTC') . ': ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + $label = ''; + + if ($user->rights->propal->lire) { + $label .= ''.$langs->trans("ShowPropal").''; + if (!empty($this->ref)) { + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->ref_client)) { + $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; + } + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, + $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, + $conf->currency); + } + } + $linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">'; if ($option == '') { $link = 'amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc); $newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT'); $newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT'); - $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount2->amount_ht); + $newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount1->amount_ht); $newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht); $db->begin(); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index f9653c06732..c6c1fe704e2 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -275,6 +275,7 @@ if ($resql) if ($search_sale > 0) $param.='&search_sale='.$search_sale; if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht; if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($billed != '') $param.='&billed='.$billed; $num = $db->num_rows($resql); print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_commercial.png'); diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 1d9da7f9f59..9f27d347592 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -87,6 +87,17 @@ if ($action == 'delete') { if (GETPOST('categid')) { + // Delete bank class + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class"; + $sql.= " WHERE fk_categ = '".GETPOST('categid')."'"; + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } + + // Delete bank categ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ"; $sql.= " WHERE rowid = '".GETPOST('categid')."'"; $sql.= " AND entity = ".$conf->entity; diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index b4cea5b4982..5c21b67a891 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -106,7 +106,7 @@ $fsearch.=' '; $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 ""; print ""; @@ -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 "
"; print ""; print '"; @@ -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 '

'; print '
'.$langs->trans("Num")."
'; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 3d6db94d801..11d0fc8ef23 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -262,9 +262,15 @@ $dolibarr_main_db_prefix=''; // $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. -// Default value: 0 (use database value if exist) -// Examples: +// 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_sendbyweb='0'; // dolibarr_strict_mode diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 74ea611dc96..e4bee39c39e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -56,7 +56,7 @@ class Contrat extends CommonObject * @var string */ var $ref_customer; - + /** * Supplier reference of the contract * @var string @@ -536,7 +536,7 @@ class Contrat extends CommonObject return -1; } } - + /** * Load a contract from database * @@ -1134,6 +1134,16 @@ class Contrat extends CommonObject } } + // Removed extrafields + if (! $error) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + } + } + if (! $error) { // We remove directory @@ -1333,7 +1343,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1356,9 +1366,9 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0) { @@ -1515,7 +1525,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1539,7 +1549,7 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0) { @@ -2571,7 +2581,7 @@ class ContratLigne extends CommonObjectLine if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index cd9e47f8a78..a7c9b0a0e56 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -143,6 +143,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) { @@ -366,7 +368,7 @@ class CMailFile */ function sendfile() { - global $conf,$db; + global $conf,$db,$langs; $errorlevel=error_reporting(); error_reporting($errorlevel ^ E_WARNING); // Desactive warnings @@ -388,7 +390,31 @@ 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') { @@ -417,8 +443,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)) { @@ -431,7 +455,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(); @@ -449,7 +474,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.=".
Check your server logs and your firewalls setup"; + $this->error.=".
"; + $this->error.=$langs->trans("ErrorPhpMailDelivery"); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); } else @@ -680,7 +706,7 @@ class CMailFile global $conf; $out = ""; - $host = dol_getprefix(); + $host = dol_getprefix('email'); // Sender //$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2; @@ -798,8 +824,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) { diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 35c3b3909ef..7e68589c5f9 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -108,7 +108,7 @@ class DolEditor // Dolibarr utilise toujours liens avec modulepart='fckeditor' quelque soit modulepart. // Ou se trouve donc cette valeur /viewimage.php?modulepart=fckeditor&file=' ? $modulepart='fckeditor'; - $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&file='; + $this->editor->Config['UserFilesPath'] = '/viewimage.php?modulepart='.$modulepart.'&entity='.$conf->entity.'&file='; $this->editor->Config['UserFilesAbsolutePath'] = DOL_DATA_ROOT.'/'.$modulepart.'/' ; $this->editor->Config['LinkBrowser']=($uselocalbrowser?'true':'false'); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 52c3b2f5cb9..420f6529758 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -729,7 +729,7 @@ class ExtraFields } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index d93e6c657b9..a5a2ec0ab51 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -135,13 +135,15 @@ class FormProjets // Search all projects $sql = 'SELECT p.rowid, p.ref, p.title, p.fk_soc, p.fk_statut, p.public'; $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; - $sql.= " WHERE p.entity = ".$conf->entity; + $sql.= " WHERE p.entity IN (".getEntity('project',1).")"; if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")"; if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; if (!empty($filterkey)) { - $sql .= " AND p.title LIKE '%".$this->db->escape($filterkey)."%'"; - $sql .= " OR p.ref LIKE '%".$this->db->escape($filterkey)."%'"; + $sql .= ' AND ('; + $sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ' OR p.ref LIKE "%'.$this->db->escape($filterkey).'%"'; + $sql .= ')'; } $sql.= " ORDER BY p.ref ASC"; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index dd2726d2306..91efd218de1 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1126,6 +1126,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"; @@ -1186,7 +1188,9 @@ class SMTPs // Make RFC821 Compliant, replace bare linefeeds $strContent = preg_replace("/(?_msgContent[$strType] = array(); diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 1a608f6bc2e..82c26a91991 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -1,4 +1,4 @@ -db->fetch_object($resql)) { - $fieldname=$keyforaliasextra.'.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpkeys=array_keys($tmpparam['options']); - $tmp=array_shift($tmpkeys); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; + if ($obj->type!='separate') { + $fieldname=$keyforaliasextra.'.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $tmp=''; + $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $tmpkeys=array_keys($tmpparam['options']); + $tmp=array_shift($tmpkeys); + } + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]=$keyforelement; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]=$keyforelement; } } // End add axtra fields diff --git a/htdocs/core/filemanagerdol/connectors/php/config.php b/htdocs/core/filemanagerdol/connectors/php/config.php index 0c3b0a4884c..e21e69bdec2 100644 --- a/htdocs/core/filemanagerdol/connectors/php/config.php +++ b/htdocs/core/filemanagerdol/connectors/php/config.php @@ -44,7 +44,8 @@ $Config['Enabled'] = true ; // Path to user files relative to the document root. -$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&file=' ; +$extEntity=(empty($entity) ? 1 : $entity); // For multicompany with external access +$Config['UserFilesPath'] = DOL_URL_ROOT.'/viewimage.php?modulepart=fckeditor&entity='.$extEntity.'&file=' ; // Fill the following value it you prefer to specify the absolute path for the // user files directory. Useful if you are using a virtual directory, symbolic diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index aaff894fcf9..bd184469e49 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -286,10 +286,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); @@ -3320,7 +3330,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) * @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 @@ -3379,18 +3389,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) { diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 36f62be3833..286038f1b22 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -110,8 +110,8 @@ class pdf_einstein extends ModelePDFCommandes { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index ff8a73c527d..6d7b22613f7 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -120,8 +120,8 @@ class pdf_crabe extends ModelePDFFactures { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 517cd0a7ce9..bb7eb09abf4 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -252,7 +252,7 @@ class mod_codeproduct_elephant extends ModeleProductCode // Get Mask value $mask = ''; if ($type==0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT)?'':$conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; - if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SSERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; + if ($type==1) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_SERVICE)?'':$conf->global->PRODUCT_ELEPHANT_MASK_SERVICE; if (! $mask) { $this->error='NotConfigured'; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 52f9a09ae9f..0c0728093ac 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -108,8 +108,8 @@ class pdf_azur extends ModelePDFPropales { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 6b89ef7f5c8..c368ca52ca9 100644 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -102,8 +102,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices if($conf->global->PRODUCT_USE_UNITS) { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } //if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) $this->posxtva=$this->posxup; $this->posxpicture=$this->posxtva - (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH)?20:$conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH); // width of images diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 95b0c00ff5b..3117b6a9e55 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -111,8 +111,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $this->posxtva=99; $this->posxup=114; - $this->posxqty=133; - $this->posxunit=150; + $this->posxqty=130; + $this->posxunit=147; } else { $this->posxtva=112; $this->posxup=126; diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 7cda584abbf..9fc8c7627dd 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -524,13 +524,14 @@ class PaymentExpenseReport extends CommonObject { if ($mode == 'payment_expensereport') { - $euser = new User($this->db); - $euser->fetch($key); + $er = new ExpenseReport($this->db); + $er->fetch($key); + $er->fetch_user($er->fk_user_author); $result=$acc->add_url_line( $bank_line_id, - $euser->id, + $er->user->id, DOL_URL_ROOT.'/user/card.php?id=', - $euser->getFullName($langs), + $er->user->getFullName($langs), 'user' ); if ($result <= 0) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 59ea03476c4..f1c2ad16879 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1202,7 +1202,7 @@ class FichinterLigne extends CommonObjectLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET"; $sql.= " description='".$this->db->escape($this->desc)."'"; - $sql.= ",date=".$this->db->idate($this->datei); + $sql.= ",date='".$this->db->idate($this->datei)."'"; $sql.= ",duree=".$this->duration; $sql.= ",rang='".$this->rang."'"; $sql.= " WHERE rowid = ".$this->rowid; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 14dd1f0e318..42df075fa17 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.4'); +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.9.5'); if (! defined('EURO')) define('EURO',chr(128)); @@ -122,6 +122,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; diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index 1a776c27e66..86d2549a8bc 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -22,7 +22,7 @@ -- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup); -insert into llx_const (name, value, type, note, visible, entity) values ('MAIN_ENABLE_LOG_TO_HTML','0','chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); +insert into llx_const (name, value, type, note, visible, entity) values (__ENCRYPT('MAIN_ENABLE_LOG_TO_HTML')__,__ENCRYPT('0')__,'chaine','If this option is set to 1, it is possible to see log output at end of HTML sources by adding paramater logtohtml=1 on URL',1,0); -- Was done into a 3.8 fix, so we must do it also in 3.9 @@ -61,7 +61,7 @@ update llx_opensurvey_sondage set format = 'D' where format = 'D+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+'; INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_DELAY_EXPENSEREPORTS_TO_PAY')__,__ENCRYPT('31')__,'chaine','Tolérance de retard avant alerte (en jours) sur les notes de frais impayées',0); -INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_SIZE_SHORTLISTE_LIMIT','4','chaine','Longueur maximum des listes courtes (fiche client)',0); +INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLISTE_LIMIT')__,__ENCRYPT('4')__,'chaine','Longueur maximum des listes courtes (fiche client)',0); ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32); ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32); diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index dc3502e027a..8635b3e2d88 100755 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -176,10 +176,11 @@ ErrorWarehouseRequiredIntoShipmentLine=Warehouse is required on the line to ship ErrorFileMustHaveFormat=File must have format %s ErrorSupplierCountryIsNotDefined=Country for this supplier is not defined. Correct this first. ErrorsThirdpartyMerge=Failed to merge the two records. Request canceled. -ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enougth for product %s to add it into a new order. -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. +ErrorStockIsNotEnoughToAddProductOnOrder=Stock is not enough for product %s to add it into a new order. +ErrorStockIsNotEnoughToAddProductOnInvoice=Stock is not enough for product %s to add it into a new invoice. +ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s to add it into a new shipment. +ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal. +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. diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 94a74604901..67a8a24c04d 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -42,7 +42,7 @@ MailingStatusSentPartialy=Sent partialy MailingStatusSentCompletely=Sent completely MailingStatusError=Error MailingStatusNotSent=Not sent -MailSuccessfulySent=Email successfully sent (from %s to %s) +MailSuccessfulySent=Email successfully accepted for delivery (from %s to %s) MailingSuccessfullyValidated=EMailing successfully validated MailUnsubcribe=Unsubscribe Unsuscribe=Unsubscribe @@ -116,9 +116,9 @@ SearchAMailing=Search mailing SendMailing=Send emailing SendMail=Send email SentBy=Sent by -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: +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, %s recipients at a time for each sending session. TargetsReset=Clear list ToClearAllRecipientsClickHere=Click here to clear the recipient list for this emailing diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 21c8e740334..e246848c9d8 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -184,6 +184,12 @@ ProfId3FR=Id. prof. 3 (NAF-APE) ProfId4FR=Id. prof. 4 (RCS/RM) ProfId5FR=- ProfId6FR=- +ProfId1GA=Id. prof. 1 (NIF) +ProfId2GA=Id. prof. 2 (RCCM) +ProfId3GA=Id. prof. 3 (CAE) +ProfId4GA=Id. prof. 4 +ProfId5GA=- +ProfId6GA=- ProfId1GB=Numéro d'enregistrement ProfId2GB=- ProfId3GB=SIC diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index f9189ed7e97..d023720a875 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -126,6 +126,7 @@ $sql.= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ", ".MAIN_DB_PREFIX."user as u"; $sql.= " WHERE f.fk_soc = s.rowid"; +$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND sc.fk_soc = f.fk_soc"; $sql.= " AND (d.product_type = 0 OR d.product_type = 1)"; if (! empty($conf->global->AGENT_CONTACT_TYPE)) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 7c0000bedea..80fc5d9a1d4 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -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)) diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index e284572e7e7..224acd9c04b 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -155,7 +155,6 @@ $genPriceOptions = function($level) use ($price_options) { return $return; }; - ?>
@@ -173,7 +172,8 @@ $genPriceOptions = function($level) use ($price_options) { "; - print '"; + print '"; + print '"; if (! empty($conf->dynamicprices->enabled)) { //Only if module is enabled print ''; } } - print ''; - print ''; + print ''; + print ''; // User print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 48b8d089375..ba257721746 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -115,8 +115,8 @@ if ($action == "correct_stock") //$eatby=GETPOST('eatby'); //$sellby=GETPOST('sellby'); - $eatby=dol_mktime(12, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); - $sellby=dol_mktime(12, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); + $eatby=dol_mktime(0, 0, 0, GETPOST('eatbymonth'), GETPOST('eatbyday'), GETPOST('eatbyyear')); + $sellby=dol_mktime(0, 0, 0, GETPOST('sellbymonth'), GETPOST('sellbyday'), GETPOST('sellbyyear')); $result=$product->correct_stock_batch( $user, diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 3170f329ea7..d37219db898 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -54,8 +54,8 @@ $stocklimit = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); $cancel = GETPOST('cancel'); $fieldid = isset($_GET["ref"])?'ref':'rowid'; -$d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); -$d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); +$d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); +$d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $pdluoid=GETPOST('pdluoid','int'); // Security check @@ -352,8 +352,8 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save')) } else { - $d_eatby=dol_mktime(12, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); - $d_sellby=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $d_eatby=dol_mktime(0, 0, 0, $_POST['eatbymonth'], $_POST['eatbyday'], $_POST['eatbyyear']); + $d_sellby=dol_mktime(0, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $pdluo->batch=GETPOST("batch_number",'san_alpha'); $pdluo->eatby=$d_eatby; $pdluo->sellby=$d_sellby; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 91a75f80ce1..6e866057584 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2017 Ferran Marcet * * 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 @@ -279,7 +280,7 @@ class Project extends CommonObject } } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->projet->dir_output) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index ea2cb899893..c31b4513ef5 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -250,6 +250,7 @@ if ($type_element == 'supplier_invoice') $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; + $where.= " AND f.entity = ".$conf->entity; $dateprint = 'f.datef'; $doc_number='f.ref'; $thirdTypeSelect='supplier'; @@ -262,6 +263,7 @@ if ($type_element == 'supplier_order') $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='supplier'; @@ -275,6 +277,7 @@ if ($type_element == 'contract') $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_contrat = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='customer'; diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index d14ccc6f8d4..5aeb1072d04 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -36,6 +36,12 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); // Disable "main.inc.php" hooks // Pour autre que companylogo, on charge environnement + info issus de logon comme le user if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'companylogo') && ! defined("NOLOGIN")) define("NOLOGIN",'1'); +if ((isset($_GET["modulepart"]) && $_GET["modulepart"] == 'fckeditor') && ! defined("NOLOGIN")) { + define("NOLOGIN",'1'); + // For multicompany + $entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1)); + if (is_numeric($entity)) define("DOLENTITY", $entity); +} /** * Header empty diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index 98455b2a233..fb8612977a8 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -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) {
trans('SellingPrice').' '.$i; // Label of price - if (! empty($conf->global->{"PRODUIT_MULTIPRICES_LABEL$i"})) { + $keyforlabel='PRODUIT_MULTIPRICES_LABEL'.$i; + if (! empty($conf->global->$keyforlabel)) { print ' - '.$langs->trans($conf->global->$keyforlabel); } ?> diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index afff7d6f1c6..72f7533135a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -12,7 +12,7 @@ * Copyright (C) 2014 Henry Florian * Copyright (C) 2014-2016 Philippe Grand * Copyright (C) 2014 Ion agorria - * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2016-2017 Ferran Marcet * * 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 @@ -803,7 +803,7 @@ class Product extends CommonObject // End call triggers } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref != $this->ref)) + if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->product->dir_output) @@ -908,6 +908,22 @@ 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) { diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 8c3ad45c90c..625b6c29631 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2014 Florian Henry - * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2014-2015 Philippe Grand * Copyright (C) 2014 Ion agorria * Copyright (C) 2015 Alexandre Spangaro @@ -250,6 +250,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( @@ -1269,14 +1276,14 @@ if ($result) } else { - print '' . ($objp->price_base_type != 'TTC' ? price($objp->price) : ''). "' . ($objp->price_base_type == 'TTC' ? price($objp->price_ttc) : '') . "' . price($objp->price). "' . price($objp->price_ttc) . "' . ($objp->price_base_type != 'TTC' ? price($objp->price_min) : '') . '' . ($objp->price_base_type == 'TTC' ? price($objp->price_min_ttc) : '') . '' . price($objp->price_min) . '' . price($objp->price_min_ttc) . '' . img_object($langs->trans("ShowUser"), 'user') . ' ' . $objp->login . '