| '.$langs->trans("DateSubscription").' | ';
print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1);
@@ -309,6 +309,12 @@ if ($rowid && $action != 'edit')
print '';
+ // Member
+ $adh->ref=$adh->getFullName($langs);
+ print '';
+ print '| '.$langs->trans("Member").' | '.$adh->getNomUrl(1, 0, 'subscription').' | ';
+ print ' ';
+
// Type
print '';
print '| '.$langs->trans("Type").' | ';
@@ -322,17 +328,6 @@ if ($rowid && $action != 'edit')
}
print ' ';
- // Member
- $adh->ref=$adh->getFullName($langs);
- print '';
- print '| '.$langs->trans("Member").' | '.$adh->getNomUrl(1, 0, 'subscription').' | ';
- print ' ';
-
- // Date record
- /*print '';
- print '| '.$langs->trans("DateSubscription").' | '.dol_print_date($object->datec,'dayhour').' | ';
- print ' ';*/
-
// Date subscription
print '';
print '| '.$langs->trans("DateSubscription").' | '.dol_print_date($object->dateh, 'day').' | ';
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index 2c8c108b3d5..96b043fcf7b 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -342,7 +342,7 @@ if ($action == 'create')
// Morphy
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
- $morphys["mor"] = $langs->trans("Morale");
+ $morphys["mor"] = $langs->trans("Moral");
print ' | '.$langs->trans("MemberNature").' | ';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print " | ";
@@ -775,7 +775,7 @@ if ($rowid > 0)
// Morphy
$morphys[""] = $langs->trans("MorPhy");
$morphys["phy"] = $langs->trans("Physical");
- $morphys["mor"] = $langs->trans("Morale");
+ $morphys["mor"] = $langs->trans("Moral");
print '| '.$langs->trans("MemberNature").' | ';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print " | ";
diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php
index 7f4a167edd9..99c6cea7b39 100644
--- a/htdocs/admin/clicktodial.php
+++ b/htdocs/admin/clicktodial.php
@@ -37,12 +37,12 @@ $action = GETPOST('action', 'aZ09');
/*
* Actions
*/
-
+
if ($action == 'setvalue' && $user->admin)
{
- $result=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
- $result=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
-
+ $result1=dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity);
+ $result2=dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity);
+
if ($result1 >= 0 && $result2 >= 0)
{
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php
new file mode 100644
index 00000000000..0e62029e8f2
--- /dev/null
+++ b/htdocs/admin/facture_situation.php
@@ -0,0 +1,228 @@
+
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2005 Eric Seigne
+ * Copyright (C) 2005-2012 Regis Houssin
+ * Copyright (C) 2008 Raphael Bertrand (Resultic)
+ * Copyright (C) 2012-2013 Juanjo Menent
+ * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/**
+ * \file htdocs/admin/facture.php
+ * \ingroup facture
+ * \brief Page to setup invoice module
+ */
+
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
+
+if (! $user->admin) accessforbidden();
+
+$action = GETPOST('action', 'alpha');
+$value = GETPOST('value', 'alpha');
+$label = GETPOST('label', 'alpha');
+$scandir = GETPOST('scan_dir', 'alpha');
+$type='invoice';
+
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+
+
+
+/*
+ * View
+ */
+
+$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
+
+llxHeader(
+ "", $langs->trans("BillsSetup"),
+ 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
+);
+
+$form=new Form($db);
+
+
+$linkback=''.$langs->trans("BackToModuleList").'';
+print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
+
+$head = invoice_admin_prepare_head();
+dol_fiche_head($head, 'situation', $langs->trans("InvoiceSituation"), -1, 'invoice');
+
+/*
+ * Numbering module
+ */
+
+print load_fiche_titre($langs->trans("InvoiceSituation"), '', '');
+$var=0;
+
+print '';
+
+dol_fiche_end();
+
+// End of page
+llxFooter();
+$db->close();
+
+/**
+ * Print an update button
+ *
+ * @return void
+ */
+function _updateBtn()
+{
+ global $langs;
+ print '';
+ print '';
+ print ' ';
+}
+
+/**
+ * Print a On/Off button
+ *
+ * @param string $confkey the conf key
+ * @param bool $title Title of conf
+ * @param string $desc Description
+ *
+ * @return void
+ */
+function _printOnOff($confkey, $title = false, $desc = '')
+{
+ global $var, $bc, $langs;
+ $var=!$var;
+ print '';
+ print ''.($title?$title:$langs->trans($confkey));
+ if (!empty($desc)) {
+ print ' '.$langs->trans($desc).'';
+ }
+ print ' | ';
+ print ' | ';
+ print '';
+ print ajax_constantonoff($confkey);
+ print ' | ';
+}
+
+
+/**
+ * Print a form part
+ *
+ * @param string $confkey the conf key
+ * @param bool $title Title of conf
+ * @param string $desc Description of
+ * @param array $metas html meta
+ * @param string $type type of input textarea or input
+ * @param bool $help help description
+ *
+ * @return void
+ */
+function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false)
+{
+ global $var, $bc, $langs, $conf, $db, $inputCount;
+ $var=!$var;
+ $inputCount = empty($inputCount)?1:($inputCount+1);
+ $form=new Form($db);
+
+ $defaultMetas = array(
+ 'name' => 'value'.$inputCount
+ );
+
+ if ($type!='textarea') {
+ $defaultMetas['type'] = 'text';
+ $defaultMetas['value'] = $conf->global->{$confkey};
+ }
+
+
+ $metas = array_merge($defaultMetas, $metas);
+ $metascompil = '';
+ foreach ($metas as $key => $values) {
+ $metascompil .= ' '.$key.'="'.$values.'" ';
+ }
+
+ print '';
+ print '';
+
+ if (!empty($help)) {
+ print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
+ } else {
+ print $title?$title:$langs->trans($confkey);
+ }
+
+ if (!empty($desc)) {
+ print ' '.$langs->trans($desc).'';
+ }
+
+ print ' | ';
+ print ' | ';
+ print '';
+ print '';
+
+ print '';
+ if ($type=='textarea') {
+ print '';
+ } else {
+ print '';
+ }
+ print ' | ';
+}
diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php
index e63aec50dca..c06314daa9a 100644
--- a/htdocs/admin/tools/dolibarr_export.php
+++ b/htdocs/admin/tools/dolibarr_export.php
@@ -446,8 +446,10 @@ print "\n";
-" id="buttonGo" />
+
+ " id="buttonGo">
+
+
'.$langs->trans("BackupResult").': ';
print $_SESSION["commandbackupresult"];
@@ -598,9 +600,6 @@ print ' ';
-
-
-
admin) accessforbidden();
if ($file && ! $what)
{
//print DOL_URL_ROOT.'/dolibarr_export.php';
- header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))));
+ header("Location: ".DOL_URL_ROOT.'/admin/tools/dolibarr_export.php?msg='.urlencode($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportMethod"))).(GETPOST('page_y', 'int')?'&page_y='.GETPOST('page_y', 'int'):''));
exit;
}
@@ -122,25 +122,15 @@ $utils = new Utils($db);
// MYSQL
if ($what == 'mysql')
{
-
$cmddump=GETPOST("mysqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump);
if (! empty($dolibarr_main_restrict_os_commands))
{
$arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
- $ok=0;
dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
- foreach($arrayofallowedcommand as $allowedcommand)
- {
- $basenamecmddump=basename($cmddump);
- if (preg_match('/^'.preg_quote($allowedcommand, '/').'$/', $basenamecmddump)) // the provided command $cmddump must be an allowed command
- {
- $ok=1;
- break;
- }
- }
- if (! $ok)
+ $basenamecmddump=basename($cmddump);
+ if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
{
$errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
}
@@ -176,6 +166,18 @@ if ($what == 'postgresql')
$cmddump=GETPOST("postgresqldump"); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
$cmddump=dol_sanitizePathName($cmddump);
+ /* Not required, the command is output on screen but not ran for pgsql
+ if (! empty($dolibarr_main_restrict_os_commands))
+ {
+ $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands);
+ dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump);
+ $basenamecmddump=basename($cmddump);
+ if (! in_array($basenamecmddump, $arrayofallowedcommand)) // the provided command $cmddump must be an allowed command
+ {
+ $errormsg=$langs->trans('CommandIsNotInsideAllowedCommands');
+ }
+ } */
+
if (! $errormsg && $cmddump)
{
dolibarr_set_const($db, 'SYSTEMTOOLS_POSTGRESQLDUMP', $cmddump, 'chaine', 0, '', $conf->entity);
@@ -193,7 +195,6 @@ if ($what == 'postgresql')
}
-
if ($errormsg)
{
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
@@ -230,8 +231,8 @@ $result=$formfile->list_of_documents($filearray,null,'systemtools','',1,'backup/
print ' ';
*/
-// Redirect t backup page
-header("Location: dolibarr_export.php");
+// Redirect to backup page
+header("Location: dolibarr_export.php".(GETPOST('page_y', 'int')?'?page_y='.GETPOST('page_y', 'int'):''));
$time_end = time();
diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php
index 05117f5e7cb..bb0e037bf7d 100644
--- a/htdocs/cashdesk/index_verif.php
+++ b/htdocs/cashdesk/index_verif.php
@@ -79,16 +79,6 @@ if (! empty($conf->stock->enabled) && empty($conf->global->CASHDESK_NO_DECREASE_
}
-/*
-if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb)))
-{
- $langs->load("errors");
- $retour=$langs->trans("ErrorModuleSetupNotComplete");
- header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid);
- exit;
-}
-*/
-
// Check password
$auth = new Auth($db);
$retour = $auth->verif($username, $password);
diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php
index 8da535f20f3..4230227717e 100644
--- a/htdocs/cashdesk/tpl/facturation1.tpl.php
+++ b/htdocs/cashdesk/tpl/facturation1.tpl.php
@@ -165,7 +165,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CASH']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CASH'] < 0)
{
$langs->load("errors");
- print '';
+ print 'transnoentitiesnoconv("CashDesk"))).'" />';
}
else print '';
print ' ';
@@ -173,7 +173,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
{
$langs->load("errors");
- print ' ';
+ print ' transnoentitiesnoconv("CashDesk"))).'" />';
}
else print ' ';
print ' ';
@@ -181,7 +181,7 @@ $langs->loadLangs(array("main","bills","cashdesk"));
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
{
$langs->load("errors");
- print '';
+ print 'transnoentitiesnoconv("CashDesk")).'" />';
}
else print '';
print '';
diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php
index b0f1f5253c2..429e5398c5a 100644
--- a/htdocs/collab/index.php
+++ b/htdocs/collab/index.php
@@ -168,287 +168,8 @@ if ($action != 'preview' && $action != 'editcontent') $style=' margin-bottom: 5p
//var_dump($objectpage);exit;
print '';
-
- $array=$objectpage->fetchAll($object->id);
- if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors);
- $atleastonepage=(is_array($array) && count($array) > 0);
-
- print '';
- print ' ';
- print $langs->trans("Page").': ';
- print ' ';
- print ' ';
- print ' ';
- print ' ';
-
- print ' ';
-
- if ($action == 'preview')
- {
- // Adding jquery code to change on the fly url of preview ext
- if (! empty($conf->use_javascript_ajax))
- {
- print '';
- }
- }
- }
-}
-else
-{
- print ' ';
- $langs->load("errors");
- print $langs->trans("ErrorModuleSetupNotComplete");
- print ' ';
- $action='';
-}
-
-
-print ' ';
-
-$head = array();
-
-if ($action == 'editcontent')
-{
- /*
- * Editing global variables not related to a specific theme
- */
-
- $csscontent = @file_get_contents($filecss);
-
- $contentforedit = '';
- /*$contentforedit.=''."\n";*/
- $contentforedit .= $objectpage->content;
-
- require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
- $doleditor=new DolEditor('PAGE_CONTENT', $contentforedit, '', 500, 'Full', '', true, true, true, ROWS_5, '90%');
- $doleditor->Create(0, '', false);
-}
print " \n\n";
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 481f6a5096f..eca3a5bb6cf 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -3519,7 +3519,7 @@ class Propal extends CommonObject
else
{
$langs->load("errors");
- print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
+ print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Proposal"));
return "";
}
}
diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index 241f22cfe38..4377ebe6211 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -272,7 +272,7 @@ $sql.= ' p.rowid, p.entity, p.note_private, p.total_ht, p.tva as total_vat, p.to
$sql.= ' p.datec as date_creation, p.tms as date_update,';
$sql.= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
$sql.= ' u.login';
-if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user,";
+if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 29688b7d690..0f875b68f22 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -2591,7 +2591,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
} else {
$langs->load("errors");
- print ' ';
+ print ' ';
}
}
}
diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php
index 61acf6e3a89..378d6087cc7 100644
--- a/htdocs/compta/cashcontrol/cashcontrol_card.php
+++ b/htdocs/compta/cashcontrol/cashcontrol_card.php
@@ -247,7 +247,7 @@ if ($action=="create" || $action=="start")
}
// Get the bank account dedicated to this point of sale module/terminal
- $vartouse=CASHDESK_ID_BANKACCOUNT_CASH.$terminaltouse;
+ $vartouse='CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse;
$bankid = $conf->global->$vartouse; // This value is ok for 'Terminal 0' for module 'CashDesk' and 'TakePos' (they manage only 1 terminal)
// Hook to get the good bank id according to posmodule and posnumber.
// @TODO add hook here
diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php
index 5ba7232dc95..38a5f88842a 100644
--- a/htdocs/compta/charges/index.php
+++ b/htdocs/compta/charges/index.php
@@ -190,7 +190,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print $socialcontrib->getNomUrl(1, '20');
print '';
// Type
- print ' '.$obj->lib.' | ';
+ print ' '.$obj->lib.' | ';
// Expected to pay
print ' '.price($obj->total).' | ';
// Ref payment
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 2f017b485d6..bfa21a9c759 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -309,6 +309,38 @@ if (empty($reshook))
dol_print_error($db, $object->error);
}
+ elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer)
+ {
+ $object->fetch($id);
+ $object->retained_warranty_fk_cond_reglement = 0; // To clean property
+ $result = $object->setRetainedWarrantyPaymentTerms(GETPOST('retained_warranty_fk_cond_reglement', 'int'));
+ if ($result < 0) dol_print_error($db, $object->error);
+
+ $old_rw_date_lim_reglement = $object->retained_warranty_date_limit;
+ $new_rw_date_lim_reglement = $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
+ if ($new_rw_date_lim_reglement > $old_rw_date_lim_reglement) $object->retained_warranty_date_limit = $new_rw_date_lim_reglement;
+ if ($object->retained_warranty_date_limit < $object->date) $object->retained_warranty_date_limit = $object->date;
+ $result = $object->update($user);
+ if ($result < 0) dol_print_error($db, $object->error);
+ }
+
+ elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer)
+ {
+ $object->fetch($id);
+ $result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float'));
+ if ($result < 0)
+ dol_print_error($db, $object->error);
+ }
+
+ elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer)
+ {
+ $object->fetch($id);
+ $result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float'));
+ if ($result < 0)
+ dol_print_error($db, $object->error);
+ }
+
+
// Multicurrency Code
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
@@ -1209,6 +1241,16 @@ if (empty($reshook))
$object->situation_counter = 1;
$object->situation_final = 0;
$object->situation_cycle_ref = $object->newCycle();
+
+
+ $object->retained_warranty = GETPOST('retained_warranty', 'int');
+ $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
+
+ $retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
+ if(!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)){
+ $object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
+ }
+ $object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
}
$object->fetch_thirdparty();
@@ -3147,6 +3189,44 @@ if ($action == 'create')
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
print '';
+ if (! empty($conf->global->INVOICE_USE_SITUATION))
+ {
+ if($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY){
+
+ $rwStyle = 'display:none;';
+ if(GETPOST('type', 'int') == Facture::TYPE_SITUATION){
+ $rwStyle = '';
+ }
+
+
+ $retained_warranty = GETPOST('retained_warranty', 'int');
+ $retained_warranty = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
+ print ' | ' . $langs->trans('RetainedWarranty') . ' | ';
+ print '%';
+
+ // Retained warranty payment term
+ print ' | | ' . $langs->trans('PaymentConditionsShortRetainedWarranty') . ' | ';
+ $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
+ $retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
+ $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
+ print ' | ';
+
+ print '';
+ }
+ }
+
// Payment mode
print ' | ' . $langs->trans('PaymentMode') . ' | ';
$form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id', 'CRDT');
@@ -4020,6 +4100,126 @@ elseif ($id > 0 || ! empty($ref))
print ' | ';
}
+ $displayWarranty = false;
+ if( ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)) ) )
+ {
+ // Check if this situation invoice is 100% for real
+ if(!empty($object->situation_final) && !empty($object->lines)){
+ $displayWarranty = true;
+ foreach($object->lines as $i => $line){
+ if($line->product_type < 2 && $line->situation_percent < 100){
+ $displayWarranty = false;
+ break;
+ }
+ }
+ }
+
+
+
+ // Retained Warranty
+ print ' | ';
+ print '';
+ print ' | ';
+ if ($action == 'editretainedwarranty')
+ {
+ print '';
+ }
+ else
+ {
+ print price($object->retained_warranty).'%';
+ }
+ print ' | ';
+
+ // Retained warranty payment term
+ print ' | ';
+ print '';
+ print ' | ';
+ $defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
+ if($object->date > $defaultDate){
+ $defaultDate = $object->date;
+ }
+
+ if ($action == 'editretainedwarrantypaymentterms')
+ {
+ //date('Y-m-d',$object->date_lim_reglement)
+ print '';
+ }
+ else
+ {
+ print $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->retained_warranty_fk_cond_reglement, 'none');
+ if(!$displayWarranty){
+ print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
+ }
+ }
+ print ' | ';
+
+
+
+
+ if($displayWarranty)
+ {
+ // Retained Warranty payment date limit
+ print ' | ';
+ print '';
+ print ' | ';
+ $defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
+ if($object->date > $defaultDate){
+ $defaultDate = $object->date;
+ }
+
+ if ($action == 'editretainedwarrantydatelimit')
+ {
+ //date('Y-m-d',$object->date_lim_reglement)
+ print '';
+ }
+ else
+ {
+ print dol_print_date($object->retained_warranty_date_limit, 'day');
+ }
+ print ' | ';
+ }
+ }
+
+
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
@@ -4464,6 +4664,31 @@ elseif ($id > 0 || ! empty($ref))
print ' :';
print ' ' . price($resteapayeraffiche) . ' | ';
print ' | ';
+
+ // Retained warranty : usualy use on construction industry
+ if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
+
+ // Billed - retained warranty
+ if($object->type == Facture::TYPE_SITUATION)
+ {
+ $retainedWarranty = $total_global_ttc * $object->retained_warranty / 100;
+ }
+ else
+ {
+ // Because one day retained warranty could be used on standard invoices
+ $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
+ }
+
+ $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
+
+ print ' | ' . $langs->trans("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')) . ' : | ' . price($billedWithRetainedWarranty) . ' | | ';
+
+ // retained warranty
+ print ' | ';
+ print $langs->trans("RetainedWarranty") . ' ('.$object->retained_warranty.'%)';
+ print !empty($object->retained_warranty_date_limit)?' '.$langs->trans("ToPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
+ print ' : | ' . price($retainedWarranty) . ' | | ';
+ }
}
else // Credit note
{
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 00b25b64506..763eea6cdd2 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -206,6 +206,21 @@ class Facture extends CommonInvoice
public $oldcopy;
+ /**
+ * @var double percentage of retainage
+ */
+ public $retained_warranty;
+
+ /**
+ * @var int timestamp of date limit of retainage
+ */
+ public $retained_warranty_date_limit;
+
+ /**
+ * @var int Code in llx_c_paiement
+ */
+ public $retained_warranty_fk_cond_reglement;
+
/**
* Standard invoice
*/
@@ -472,6 +487,9 @@ class Facture extends CommonInvoice
$sql.= ", fk_multicurrency";
$sql.= ", multicurrency_code";
$sql.= ", multicurrency_tx";
+ $sql.= ", retained_warranty";
+ $sql.= ", retained_warranty_date_limit";
+ $sql.= ", retained_warranty_fk_cond_reglement";
$sql.= ")";
$sql.= " VALUES (";
$sql.= "'(PROV)'";
@@ -506,6 +524,10 @@ class Facture extends CommonInvoice
$sql.= ", ".(int) $this->fk_multicurrency;
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql.= ", ".(double) $this->multicurrency_tx;
+ $sql.= ", ".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty));
+ $sql.= ", ".(!empty($this->retained_warranty_date_limit)?"'".$this->db->idate($this->retained_warranty_date_limit)."'":'NULL');
+ $sql.= ", ".(int) $this->retained_warranty_fk_cond_reglement;
+
$sql.=")";
$resql=$this->db->query($sql);
@@ -1336,6 +1358,7 @@ class Facture extends CommonInvoice
$sql.= ', f.fk_incoterms, f.location_incoterms';
$sql.= ', f.module_source, f.pos_source';
$sql.= ", i.libelle as label_incoterms";
+ $sql.= ", f.retained_warranty as retained_warranty, f.retained_warranty_date_limit as retained_warranty_date_limit, f.retained_warranty_fk_cond_reglement as retained_warranty_fk_cond_reglement";
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
@@ -1405,6 +1428,10 @@ class Facture extends CommonInvoice
$this->situation_cycle_ref = $obj->situation_cycle_ref;
$this->situation_counter = $obj->situation_counter;
$this->situation_final = $obj->situation_final;
+ $this->retained_warranty = $obj->retained_warranty;
+ $this->retained_warranty_date_limit = $this->db->jdate($obj->retained_warranty_date_limit);
+ $this->retained_warranty_fk_cond_reglement = $obj->retained_warranty_fk_cond_reglement;
+
$this->extraparams = (array) json_decode($obj->extraparams, true);
//Incoterms
@@ -1648,6 +1675,8 @@ class Facture extends CommonInvoice
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
+ if (isset($this->retained_warranty)) $this->retained_warranty = floatval($this->retained_warranty);
+
// Check parameters
// Put here code to add control on parameters values
@@ -1688,7 +1717,10 @@ class Facture extends CommonInvoice
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").",";
$sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).",";
$sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).",";
- $sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final));
+ $sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final)).",";
+ $sql.= " retained_warranty=".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty)).",";
+ $sql.= " retained_warranty_date_limit=".(strval($this->retained_warranty_date_limit)!='' ? "'".$this->db->idate($this->retained_warranty_date_limit)."'" : 'null').",";
+ $sql.= " retained_warranty_fk_cond_reglement=".(isset($this->retained_warranty_fk_cond_reglement)?intval($this->retained_warranty_fk_cond_reglement):"null");
$sql.= " WHERE rowid=".$this->id;
$this->db->begin();
@@ -3463,7 +3495,7 @@ class Facture extends CommonInvoice
else
{
$langs->load("errors");
- print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
+ print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice"));
return "";
}
}
@@ -4375,6 +4407,137 @@ class Facture extends CommonInvoice
return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
}
+
+
+ /**
+ * @return number or -1 if not available
+ */
+ public function getRetainedWarrantyAmount()
+ {
+ if(empty($this->retained_warranty) ){
+ return -1;
+ }
+
+ $retainedWarrantyAmount = 0;
+
+ // Billed - retained warranty
+ if($this->type == Facture::TYPE_SITUATION)
+ {
+ $displayWarranty = true;
+ // Check if this situation invoice is 100% for real
+ if(!empty($this->lines)){
+ foreach($this->lines as $i => $line){
+ if($line->product_type < 2 && $line->situation_percent < 100){
+ $displayWarranty = false;
+ break;
+ }
+ }
+ }
+
+ if($displayWarranty && !empty($this->situation_final))
+ {
+ $this->fetchPreviousNextSituationInvoice();
+ $TPreviousIncoice = $this->tab_previous_situation_invoice;
+
+ $total2BillWT = 0;
+ foreach ($TPreviousIncoice as &$fac){
+ $total2BillWT += $fac->total_ttc;
+ }
+ $total2BillWT += $this->total_ttc;
+
+ $retainedWarrantyAmount = $total2BillWT * $this->retained_warranty / 100;
+ }
+ else{
+ return -1;
+ }
+ }
+ else
+ {
+ // Because one day retained warranty could be used on standard invoices
+ $retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
+ }
+
+ return $retainedWarrantyAmount;
+ }
+
+ /**
+ * Change the retained warranty
+ *
+ * @param float $value value of retained warranty
+ * @return int >0 if OK, <0 if KO
+ */
+ public function setRetainedWarranty($value)
+ {
+ dol_syslog(get_class($this).'::setRetainedWarranty('.$value.')');
+ if ($this->statut >= 0)
+ {
+ $fieldname = 'retained_warranty';
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
+ $sql .= ' SET '.$fieldname.' = '.floatval($value);
+ $sql .= ' WHERE rowid='.$this->id;
+
+ if ($this->db->query($sql))
+ {
+ $this->retained_warranty = floatval($value);
+ return 1;
+ }
+ else
+ {
+ dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error());
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
+ else
+ {
+ dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible');
+ $this->error='Status of the object is incompatible '.$this->statut;
+ return -2;
+ }
+ }
+
+
+ /**
+ * Change the retained_warranty_date_limit
+ *
+ * @param int $timestamp date limit of retained warranty in timestamp format
+ * @param string $dateYmd date limit of retained warranty in Y m d format
+ * @return int >0 if OK, <0 if KO
+ */
+ public function setRetainedWarrantyDateLimit($timestamp, $dateYmd = false)
+ {
+ if(!$timestamp && $dateYmd){
+ $timestamp = $this->db->jdate($dateYmd);
+ }
+
+
+ dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$timestamp.')');
+ if ($this->statut >= 0)
+ {
+ $fieldname = 'retained_warranty_date_limit';
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
+ $sql .= ' SET '.$fieldname.' = '.(strval($timestamp)!='' ? '\'' .$this->db->idate($timestamp).'\'' : 'null' );
+ $sql .= ' WHERE rowid='.$this->id;
+
+ if ($this->db->query($sql))
+ {
+ $this->retained_warranty_date_limit = $timestamp;
+ return 1;
+ }
+ else
+ {
+ dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error());
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
+ else
+ {
+ dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible');
+ $this->error='Status of the object is incompatible '.$this->statut;
+ return -2;
+ }
+ }
}
/**
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 2982246c6d9..eca39ade98c 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -182,6 +182,12 @@ $arrayfields=array(
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
);
+
+if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
+{
+ $arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0);
+}
+
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@@ -373,6 +379,10 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,';
$sql.= ' f.datec as date_creation, f.tms as date_update,';
+if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
+{
+ $sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,';
+}
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
$sql.= " typent.code as typent_code,";
$sql.= " state.code_departement as state_code, state.nom as state_name,";
@@ -834,6 +844,13 @@ if ($resql)
print ' ';
print '';
}
+
+ if(! empty($arrayfields['f.retained_warranty']['checked']))
+ {
+ print ' ';
+ print ' | ';
+ }
+
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print ' ';
@@ -899,6 +916,7 @@ if ($resql)
if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
+ if (! empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
// Extra fields
@@ -939,7 +957,15 @@ if ($resql)
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->note_public=$obj->note_public;
$facturestatic->note_private=$obj->note_private;
-
+ if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
+ {
+ $facturestatic->retained_warranty=$obj->retained_warranty;
+ $facturestatic->retained_warranty_date_limit=$obj->retained_warranty_date_limit;
+ $facturestatic->situation_final=$obj->retained_warranty_date_limit;
+ $facturestatic->situation_final=$obj->retained_warranty_date_limit;
+ $facturestatic->situation_cycle_ref=$obj->situation_cycle_ref;
+ $facturestatic->situation_counter=$obj->situation_counter;
+ }
$thirdpartystatic->id=$obj->socid;
$thirdpartystatic->name=$obj->name;
$thirdpartystatic->client=$obj->client;
@@ -1181,6 +1207,11 @@ if ($resql)
$totalarray['totalttc'] += $obj->total_ttc;
}
+ if(! empty($arrayfields['f.retained_warranty']['checked']))
+ {
+ print ' | '.(! empty($obj->retained_warranty)?price($obj->retained_warranty).'%':' ').' | ';
+ }
+
if (! empty($arrayfields['dynamount_payed']['checked']))
{
print ' '.(! empty($totalpay)?price($totalpay, 0, $langs):' ').' | '; // TODO Use a denormalized field
diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
index d9a912ea50b..26e3f2792d6 100644
--- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php
+++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php
@@ -489,7 +489,7 @@ class RemiseCheque extends CommonObject
else
{
$langs->load("errors");
- print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
+ print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank"));
return "";
}
}
diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php
index a3c79d23602..614782c519b 100644
--- a/htdocs/compta/paiement/class/paiement.class.php
+++ b/htdocs/compta/paiement/class/paiement.class.php
@@ -1141,7 +1141,7 @@ class Paiement extends CommonObject
else
{
$langs->load("errors");
- print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
+ print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice"));
return "";
}
}
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 1a98c33ab02..a60330270d4 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -1417,7 +1417,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
- $sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum";
+ $sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
@@ -1443,7 +1443,8 @@ class BonPrelevement extends CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
- $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum, $obj->rum);
+ $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
+ $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum);
$this->total = $this->total + $obj->somme;
$i++;
}
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 2dfbb5adf9d..eaef92a1abc 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -78,7 +78,7 @@ if (empty($reshook))
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
$bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday')+$conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear'));
-
+
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate);
if ($result < 0)
{
@@ -116,7 +116,7 @@ llxHeader('', $langs->trans("NewStandingOrder"));
if (prelevement_check_config() < 0)
{
$langs->load("errors");
- setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
+ setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
}
/*$h=0;
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index 4e2c4e2d3a5..1be716f8f61 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -58,7 +58,7 @@ llxHeader('', $langs->trans("CustomersStandingOrdersArea"));
if (prelevement_check_config() < 0)
{
$langs->load("errors");
- setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
+ setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Withdraw")), null, 'errors');
}
print load_fiche_titre($langs->trans("CustomersStandingOrdersArea"));
diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php
index 7e25d8c3423..5f7f7d0fc0a 100644
--- a/htdocs/compta/sociales/list.php
+++ b/htdocs/compta/sociales/list.php
@@ -187,7 +187,7 @@ if ($resql)
if ($year)
{
- $center=($year?" ".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":"");
+ $center=($year?" ".img_previous()." ".$langs->trans("Year")." $year ".img_next()."":"");
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
}
else
@@ -281,7 +281,7 @@ if ($resql)
print ' ';
if ($obj->periode)
{
- print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'';
+ print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'';
}
else
{
diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php
index 9bf94a16b34..af215902d0e 100644
--- a/htdocs/compta/sociales/payments.php
+++ b/htdocs/compta/sociales/payments.php
@@ -90,7 +90,7 @@ print '';
if ($mode != 'sconly')
{
- $center=($year?''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."":"");
+ $center=($year?''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."":"");
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
}
else
@@ -181,7 +181,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print $socialcontrib->getNomUrl(1, '20');
print ' | ';
// Type
- print ' '.$obj->lib.' | ';
+ print ' '.$obj->lib.' | ';
// Date
$date=$obj->periode;
if (empty($date)) $date=$obj->date_ech;
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index 3f0d0313ee0..9cde6e2df4e 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -38,7 +38,7 @@ $id = GETPOST('id', 'int');
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
if ($id > 0) $object->fetch($id);
-if(empty($object->thirdparty)) $object->fetch_thirdparty();
+if (empty($object->thirdparty)) $object->fetch_thirdparty();
$socid = $object->thirdparty->id;
// Sort & Order fields
@@ -69,7 +69,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
// Customer or supplier selected in drop box
$thirdTypeSelect = GETPOST("third_select_id");
-$type_element = GETPOST('type_element')?GETPOST('type_element'):'';
+$type_element = GETPOSTISSET('type_element')?GETPOST('type_element'):'';
// Load translation files required by the page
$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products"));
@@ -173,13 +173,13 @@ if ($type_element == 'fichinter')
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle, ';
$tables_from = MAIN_DB_PREFIX.'fichinterdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter as f ON d.fk_fichinter=f.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)";
$where = ' WHERE f.entity IN ('.getEntity('ficheinter').')';
$dateprint = 'f.datec';
$doc_number='f.ref';
}
-if ($type_element == 'invoice')
+elseif ($type_element == 'invoice')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic=new Facture($db);
@@ -187,14 +187,14 @@ if ($type_element == 'invoice')
$tables_from = MAIN_DB_PREFIX.'facturedet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON d.fk_facture=f.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)";
$where = " WHERE f.entity IN (".getEntity('invoice').")";
$dateprint = 'f.datef';
$doc_number='f.ref';
$thirdTypeSelect='customer';
}
-if ($type_element == 'propal')
+elseif ($type_element == 'propal')
{
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$documentstatic=new Propal($db);
@@ -202,14 +202,14 @@ if ($type_element == 'propal')
$tables_from = MAIN_DB_PREFIX.'propaldet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal as c ON d.fk_propal=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('propal').')';
$datePrint = 'c.datep';
$doc_number='c.ref';
$thirdTypeSelect='customer';
}
-if ($type_element == 'order')
+elseif ($type_element == 'order')
{
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$documentstatic=new Commande($db);
@@ -217,14 +217,14 @@ if ($type_element == 'order')
$tables_from = MAIN_DB_PREFIX.'commandedet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON d.fk_commande=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('order').')';
$dateprint = 'c.date_commande';
$doc_number='c.ref';
$thirdTypeSelect='customer';
}
-if ($type_element == 'supplier_invoice')
+elseif ($type_element == 'supplier_invoice')
{ // Supplier : Show products from invoices.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$documentstatic=new FactureFournisseur($db);
@@ -232,14 +232,14 @@ if ($type_element == 'supplier_invoice')
$tables_from = MAIN_DB_PREFIX.'facture_fourn_det d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)";
$where = ' WHERE f.entity IN ('.getEntity($documentstatic->element).')';
$dateprint = 'f.datef';
$doc_number='f.ref';
$thirdTypeSelect='supplier';
}
-//if ($type_element == 'supplier_proposal')
+//elseif ($type_element == 'supplier_proposal')
//{
// require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
// $documentstatic=new SupplierProposal($db);
@@ -252,7 +252,7 @@ if ($type_element == 'supplier_invoice')
// $doc_number='c.ref';
// $thirdTypeSelect='supplier';
//}
-if ($type_element == 'supplier_order')
+elseif ($type_element == 'supplier_order')
{ // Supplier : Show products from orders.
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$documentstatic=new CommandeFournisseur($db);
@@ -260,14 +260,14 @@ if ($type_element == 'supplier_order')
$tables_from = MAIN_DB_PREFIX.'commande_fournisseurdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur as c ON d.fk_commande=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity($documentstatic->element).')';
$dateprint = 'c.date_valid';
$doc_number='c.ref';
$thirdTypeSelect='supplier';
}
-if ($type_element == 'contract')
+elseif ($type_element == 'contract')
{ // Order
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
$documentstatic=new Contrat($db);
@@ -276,7 +276,7 @@ if ($type_element == 'contract')
$tables_from = MAIN_DB_PREFIX.'contratdet d';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contrat as c ON d.fk_contrat=c.rowid';
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
- $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
+ $tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople='.$object->id;
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)";
$where = ' WHERE c.entity IN ('.getEntity('contrat').')';
$dateprint = 'c.date_valid';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 666b80fb2d4..0a2c59ece2c 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -245,7 +245,7 @@ class Contrat extends CommonObject
else
{
$langs->load("errors");
- print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
+ print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Contract"));
return "";
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 67c3f0f9630..f69b4db68c1 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -2053,6 +2053,43 @@ abstract class CommonObject
return -2;
}
}
+
+ /**
+ * Change the retained warranty payments terms
+ *
+ * @param int $id Id of new payment terms
+ * @return int >0 if OK, <0 if KO
+ */
+ public function setRetainedWarrantyPaymentTerms($id)
+ {
+ dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')');
+ if ($this->statut >= 0 || $this->element == 'societe')
+ {
+ $fieldname = 'retained_warranty_fk_cond_reglement';
+
+ $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
+ $sql .= ' SET '.$fieldname.' = '.$id;
+ $sql .= ' WHERE rowid='.$this->id;
+
+ if ($this->db->query($sql))
+ {
+ $this->retained_warranty_fk_cond_reglement = $id;
+ return 1;
+ }
+ else
+ {
+ dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Erreur '.$sql.' - '.$this->db->error());
+ $this->error=$this->db->error();
+ return -1;
+ }
+ }
+ else
+ {
+ dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible');
+ $this->error='Status of the object is incompatible '.$this->statut;
+ return -2;
+ }
+ }
/**
* Define delivery address
@@ -6047,6 +6084,12 @@ abstract class CommonObject
$type='link';
$param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
}
+ elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) {
+ $param['options'] = array($reg[1] . ':' . $reg[2] . ':' . $reg[3] . ':' . $reg[4] => 'N');
+ $type = 'sellist';
+ }
+
+
$langfile=$val['langfile'];
$list=$val['list'];
$help=$val['help'];
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 0e6b0befef9..09130bb130a 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -1411,7 +1411,7 @@ class ExtraFields
// current object id can be use into filter
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
- } elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) {
+ } elseif (preg_match("#^.*list.php$#", $_SERVER["PHP_SELF"])) {
// Pattern for word=$ID$
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
@@ -1445,13 +1445,13 @@ class ExtraFields
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
} else {
if (!empty($matchCondition[1])) {
- $boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 ');
+ $boolCond = (($matchCondition[1] == "AND") ? ' AND TRUE ' : ' OR FALSE ');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
} elseif (!empty($matchCondition[3])) {
- $boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR');
+ $boolCond = (($matchCondition[3] == "AND") ? ' TRUE AND ' : ' FALSE OR');
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
} else {
- $InfoFieldList[4] = 1;
+ $InfoFieldList[4] = " TRUE ";
}
}
diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php
index f9b0a59280f..ea038fa8131 100644
--- a/htdocs/core/class/html.formmargin.class.php
+++ b/htdocs/core/class/html.formmargin.class.php
@@ -199,8 +199,6 @@ class FormMargin
if (! $user->rights->margins->liretous) return;
- $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
-
$marginInfo = $this->getMarginInfosArray($object, $force_price);
if (! empty($conf->global->MARGIN_ADD_SHOWHIDE_BUTTON)) // TODO Warning this feature rely on an external js file that may be removed. Using native js function document.cookie should be better
@@ -240,13 +238,13 @@ class FormMargin
//if ($marginInfo['margin_on_products'] != 0 && $marginInfo['margin_on_services'] != 0) {
print ' ';
print '| '.$langs->trans('MarginOnProducts').' | ';
- print ''.price($marginInfo['pv_products'], null, null, null, null, $rounding).' | ';
- print ''.price($marginInfo['pa_products'], null, null, null, null, $rounding).' | ';
- print ''.price($marginInfo['margin_on_products'], null, null, null, null, $rounding).' | ';
+ print ''.price($marginInfo['pv_products']).' | ';
+ print ''.price($marginInfo['pa_products']).' | ';
+ print ''.price($marginInfo['margin_on_products']).' | ';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
- print ''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, $rounding).'%').' | ';
+ print ''.(($marginInfo['margin_rate_products'] == '')?'':price($marginInfo['margin_rate_products'], null, null, null, null, 2).'%').' | ';
if (! empty($conf->global->DISPLAY_MARK_RATES))
- print ''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, $rounding).'%').' | ';
+ print ''.(($marginInfo['mark_rate_products'] == '')?'':price($marginInfo['mark_rate_products'], null, null, null, null, 2).'%').' | ';
print ' ';
}
@@ -254,13 +252,13 @@ class FormMargin
{
print ' ';
print '| '.$langs->trans('MarginOnServices').' | ';
- print ''.price($marginInfo['pv_services'], null, null, null, null, $rounding).' | ';
- print ''.price($marginInfo['pa_services'], null, null, null, null, $rounding).' | ';
- print ''.price($marginInfo['margin_on_services'], null, null, null, null, $rounding).' | ';
+ print ''.price($marginInfo['pv_services']).' | ';
+ print ''.price($marginInfo['pa_services']).' | ';
+ print ''.price($marginInfo['margin_on_services']).' | ';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
- print ''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, $rounding).'%').' | ';
+ print ''.(($marginInfo['margin_rate_services'] == '')?'':price($marginInfo['margin_rate_services'], null, null, null, null, 2).'%').' | ';
if (! empty($conf->global->DISPLAY_MARK_RATES))
- print ''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, $rounding).'%').' | ';
+ print ''.(($marginInfo['mark_rate_services'] == '')?'':price($marginInfo['mark_rate_services'], null, null, null, null, 2).'%').' | ';
print ' ';
}
@@ -268,13 +266,13 @@ class FormMargin
{
print ' ';
print '| '.$langs->trans('TotalMargin').' | ';
- print ''.price($marginInfo['pv_total'], null, null, null, null, $rounding).' | ';
- print ''.price($marginInfo['pa_total'], null, null, null, null, $rounding).' | ';
- print ''.price($marginInfo['total_margin'], null, null, null, null, $rounding).' | ';
+ print ''.price($marginInfo['pv_total']).' | ';
+ print ''.price($marginInfo['pa_total']).' | ';
+ print ''.price($marginInfo['total_margin']).' | ';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
- print ''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, $rounding).'%').' | ';
+ print ''.(($marginInfo['total_margin_rate'] == '')?'':price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').' | ';
if (! empty($conf->global->DISPLAY_MARK_RATES))
- print ''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, $rounding).'%').' | ';
+ print ''.(($marginInfo['total_mark_rate'] == '')?'':price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').' | ';
print ' ';
}
print ' ';
diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php
index 14c69259b98..79ad6d19115 100644
--- a/htdocs/core/js/lib_foot.js.php
+++ b/htdocs/core/js/lib_foot.js.php
@@ -148,6 +148,7 @@ print '
/* Set handler to add page_y param on output (click on href links or submit button) */
jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop();
+
if (page_y > 0)
{
if (this.href)
@@ -157,7 +158,7 @@ print '
}
else
{
- console.log("We click on tag with .reposition class but element is not an html tag, so we try to update form field page_y with value "+page_y);
+ console.log("We click on tag with .reposition class but element is not an html tag, so we try to update input form field page_y with value "+page_y);
jQuery("input[type=hidden][name=page_y]").val(page_y);
}
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 9aa6177adf4..e34c3e3b7b5 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2447,6 +2447,13 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
$newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 1).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
}
}
+ elseif (strtoupper($countrycode) == "JM")
+ {//Jamaïque
+ if(dol_strlen($newphone) == 12)
+ {//ex: +1867_ABC_DEFG
+ $newphone = substr($newphone, 0, 5).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4);
+ }
+ }
elseif (strtoupper($countrycode) == "MG")
{//Madagascar
if(dol_strlen($phone) == 13)
@@ -4400,7 +4407,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
{
if ($currency_code == 'auto') $currency_code=$conf->currency;
- $listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY');
+ $listofcurrenciesbefore=array('USD','GBP','AUD','HKD','MXN','PEN','CNY','CAD');
$listoflanguagesbefore=array('nl_NL');
if (in_array($currency_code, $listofcurrenciesbefore) || in_array($outlangs->defaultlang, $listoflanguagesbefore))
{
@@ -6554,10 +6561,17 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o
$newmesgarray=array();
foreach($mesgarray as $val)
{
- $tmpmesgstring=preg_replace('/<\/div>/', ' ', $val);
- $tmpmesgstring=preg_replace('/ /', '', $tmpmesgstring);
- $tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
- $newmesgarray[]=$tmpmesgstring;
+ if (is_string($val))
+ {
+ $tmpmesgstring=preg_replace('/<\/div> /', ' ', $val);
+ $tmpmesgstring=preg_replace('/ /', '', $tmpmesgstring);
+ $tmpmesgstring=preg_replace('/<\/div>/', '', $tmpmesgstring);
+ $newmesgarray[]=$tmpmesgstring;
+ }
+ else
+ {
+ dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING);
+ }
}
$mesgarray=$newmesgarray;
}
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index 9495a13edde..b3d518eb088 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -136,7 +136,14 @@ function invoice_admin_prepare_head()
$head[$h][1] = $langs->trans("Payments");
$head[$h][2] = 'payment';
$h++;
-
+
+ if($conf->global->INVOICE_USE_SITUATION){
+ $head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
+ $head[$h][1] = $langs->trans("InvoiceSituation");
+ $head[$h][2] = 'situation';
+ $h++;
+ }
+
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index c1b5f4c489d..ba42ebd23d8 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -2212,3 +2212,49 @@ function pdf_getSizeForImage($realpath)
}
return array('width'=>$width,'height'=>$height);
}
+
+/**
+ * Return line total amount discount
+ *
+ * @param Object $object Object
+ * @param int $i Current line number
+ * @param Translate $outputlangs Object langs for output
+ * @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
+ * @return string Return total of line excl tax
+ */
+function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0)
+{
+ global $conf, $hookmanager;
+ $sign=1;
+ if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
+ if ($object->lines[$i]->special_code == 3)
+ {
+ return $outputlangs->transnoentities("Option");
+ }
+ else
+ {
+
+ if (is_object($hookmanager))
+ {
+ $special_code = $object->lines[$i]->special_code;
+ if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
+
+ $parameters = array(
+ 'i'=>$i,
+ 'outputlangs'=>$outputlangs,
+ 'hidedetails'=>$hidedetails,
+ 'special_code'=>$special_code
+ );
+
+ $action='';
+
+ if( $hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action)>0)
+ {
+ return $hookmanager->resPrint; // Note that $action and $object may have been modified by some hooks
+ }
+ }
+
+ if (empty($hidedetails) || $hidedetails > 1) return $sign * ( ($object->lines[$i]->subprice * $object->lines[$i]->qty) - $object->lines[$i]->total_ht );
+ }
+ return '';
+}
diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php
index d5e2d3be854..07573db1a11 100644
--- a/htdocs/core/lib/takepos.lib.php
+++ b/htdocs/core/lib/takepos.lib.php
@@ -38,7 +38,8 @@ function takepos_prepare_head()
$head[$h][2] = 'setup';
$h++;
- for ($i = 1; $i <= $conf->global->TAKEPOS_NUM_TERMINALS; $i++)
+ $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS);
+ for ($i = 1; $i <= $numterminals; $i++)
{
$head[$h][0] = DOL_URL_ROOT.'/takepos/admin/terminal.php?terminal='.$i;
$head[$h][1] = $langs->trans("Terminal"). " ".$i;
diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
index 80876747d59..f2ef19ca19a 100644
--- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
+++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php
@@ -252,7 +252,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$pdf->MultiCell(22, 2, $outputlangs->transnoentities("Owner"), 0, 'L');
$pdf->SetFont('', '', $default_font_size);
$pdf->SetXY(32, 26);
- $pdf->MultiCell(60, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L');
+ $pdf->MultiCell(80, 2, $outputlangs->convToOutputCharset($this->account->proprio), 0, 'L');
$pdf->SetFont('', '', $default_font_size);
$pdf->SetXY(10, 32);
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 53929f28e75..acc88a1e96a 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -1347,6 +1347,50 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
+
+ // Retained warranty
+ if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) )
+ {
+ $displayWarranty = false;
+
+ // Check if this situation invoice is 100% for real
+ if(!empty($object->lines)){
+ $displayWarranty = true;
+ foreach($object->lines as $i => $line){
+ if($line->product_type < 2 && $line->situation_percent < 100){
+ $displayWarranty = false;
+ break;
+ }
+ }
+ }
+
+ if($displayWarranty){
+ $pdf->SetTextColor(40, 40, 40);
+ $pdf->SetFillColor(255, 255, 255);
+
+ $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
+ $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
+
+ // Billed - retained warranty
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
+
+ // retained warranty
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+
+ $retainedWarrantyToPayOn = $outputlangs->transnoentities("RetainedWarranty") . ' ('.$object->retained_warranty.'%)';
+ $retainedWarrantyToPayOn.= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("toPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
+
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
+ }
+ }
}
}
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index b5529c78d8e..26e2b1824d8 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -1225,13 +1225,172 @@ class pdf_sponge extends ModelePDFFactures
$useborder=0;
$index = 0;
+
+
+ // pourcentage global d'avancement
+ $percent = 0;
+ $i=0;
+ foreach ($object->lines as $line)
+ {
+ if(!class_exists('TSubtotal') || !TSubtotal::isModSubtotalLine($line)){
+ $percent += $line->situation_percent;
+ $i++;
+ }
+ }
+ if(!empty($i)){
+ $avancementGlobal = $percent/$i;
+ }
+ else{
+ $avancementGlobal = 0;
+ }
+
+ $object->fetchPreviousNextSituationInvoice();
+ $TPreviousIncoice = $object->tab_previous_situation_invoice;
+
+ $total_a_payer = 0;
+ $total_a_payer_ttc = 0;
+ foreach ($TPreviousIncoice as &$fac){
+ $total_a_payer += $fac->total_ht;
+ $total_a_payer_ttc += $fac->total_ttc;
+ }
+ $total_a_payer += $object->total_ht;
+ $total_a_payer_ttc += $object->total_ttc;
+
+ if(!empty($avancementGlobal)){
+ $total_a_payer = $total_a_payer * 100 / $avancementGlobal;
+ $total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal;
+ }
+ else{
+ $total_a_payer = 0;
+ $total_a_payer_ttc = 0;
+ }
+
+ $deja_paye = 0;
+ $i = 1;
+ if(!empty($TPreviousIncoice)){
+
+ $pdf->setY($tab2_top);
+ $posy = $pdf->GetY();
+
+
+
+
+ foreach ($TPreviousIncoice as &$fac){
+
+ if($posy > $this->page_hauteur - 4 ) {
+ $this->_pagefoot($pdf, $object, $outputlangs, 1);
+ $pdf->addPage();
+ $pdf->setY($this->marge_haute);
+ $posy = $pdf->GetY();
+ }
+
+ // cumul TVA précédent
+ $index++;
+ $pdf->SetFillColor(255, 255, 255);
+ $pdf->SetXY($col1x, $posy);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $posy);
+
+ $facSign = '';
+ if($i>1){
+ $facSign = $fac->total_ht>=0?'+':'';
+ }
+
+ $displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs);
+
+ $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
+
+ $i++;
+ $deja_paye += $fac->total_ht;
+ $posy += $tab2_hl;
+
+ $pdf->setY($posy);
+ }
+
+ // Display curent total
+ $pdf->SetFillColor(255, 255, 255);
+ $pdf->SetXY($col1x, $posy);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $posy);
+ $facSign = '';
+ if($i>1){
+ $facSign = $object->total_ht>=0?'+':''; // gestion d'un cas particulier client
+ }
+
+ if($fac->type === facture::TYPE_CREDIT_NOTE){
+ $facSign = '-'; // les avoirs
+ }
+
+
+ $displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs);
+ $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1);
+
+ $posy += $tab2_hl;
+
+ // Display all total
+ $pdf->SetFont('', '', $default_font_size - 1);
+ $pdf->SetFillColor(255, 255, 255);
+ $pdf->SetXY($col1x, $posy);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1);
+
+ $pdf->SetXY($col2x, $posy);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer*$avancementGlobal/100, 0, $outputlangs), 0, 'R', 1);
+ $pdf->SetFont('', '', $default_font_size - 2);
+
+ $posy += $tab2_hl;
+
+ if($posy > $this->page_hauteur - 4 ) {
+ $pdf->addPage();
+ $pdf->setY($this->marge_haute);
+ $posy = $pdf->GetY();
+ }
+
+ $tab2_top = $posy;
+ $index=0;
+ }
+
+ $tab2_top += 3;
+
+ // Get Total HT
+ $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
+
+ // Total remise
+ $total_line_remise=0;
+ foreach($object->lines as $i => $line) {
+ $total_line_remise+= pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib
+ // Gestion remise sous forme de ligne négative
+ if($line->total_ht < 0) $total_line_remise += -$line->total_ht;
+ }
+ if($total_line_remise > 0) {
+ if (! empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) {
+ $pdf->SetFillColor(255, 255, 255);
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount"), 0, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1);
+
+ $index++;
+ }
+ // Show total NET before discount
+ if (! empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) {
+ $pdf->SetFillColor(255, 255, 255);
+ $pdf->SetXY($col1x, $tab2_top + 0);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount"), 0, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + 0);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1);
+
+ $index++;
+ }
+ }
+
// Total HT
$pdf->SetFillColor(255, 255, 255);
- $pdf->SetXY($col1x, $tab2_top + 0);
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1);
- $total_ht = ($conf->multicurrency->enabled && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht);
- $pdf->SetXY($col2x, $tab2_top + 0);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (! empty($object->remise)?$object->remise:0)), 0, $outputlangs), 0, 'R', 1);
// Show VAT by rates and total
@@ -1256,7 +1415,7 @@ class pdf_sponge extends ModelePDFFactures
//{
foreach($this->localtax1 as $localtax_type => $localtax_rate)
{
- if (in_array((string) $localtax_type, array('1','3','5'))) continue;
+ if (in_array((string) $localtax_type, array('1', '3', '5'))) continue;
foreach($localtax_rate as $tvakey => $tvaval)
{
@@ -1330,7 +1489,14 @@ class pdf_sponge extends ModelePDFFactures
}
if($sum_pdf_tva!=$object->total_tva) { // apply coef to recover the VAT object amount (the good one)
- $coef_fix_tva = $object->total_tva / $sum_pdf_tva;
+ if(!empty($sum_pdf_tva))
+ {
+ $coef_fix_tva = $object->total_tva / $sum_pdf_tva;
+ }
+ else {
+ $coef_fix_tva = 1;
+ }
+
foreach($this->tva as $tvakey => $tvaval) {
$this->tva[$tvakey]=$tvaval * $coef_fix_tva;
@@ -1427,7 +1593,7 @@ class pdf_sponge extends ModelePDFFactures
}
}
}
- //}
+
// Revenue stamp
if (price2num($object->revenuestamp) != 0)
@@ -1449,6 +1615,69 @@ class pdf_sponge extends ModelePDFFactures
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1);
+
+
+ /*if($object->type == Facture::TYPE_SITUATION)
+ {
+ // reste à payer total
+ $index++;
+
+ $pdf->SetFont('','', $default_font_size - 1);
+ $pdf->SetFillColor(255,255,255);
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities('SituationTotalRayToRest'), 0, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer_ttc-$deja_paye, 0, $outputlangs), 0, 'R', 1);
+ }*/
+
+
+ // Retained warranty
+ if( !empty($object->situation_final) && ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) ) ) )
+ {
+ $displayWarranty = false;
+
+ // Check if this situation invoice is 100% for real
+ if(!empty($object->situation_final)){
+ $displayWarranty = true;
+ }
+ elseif(!empty($object->lines) && $object->status == Facture::STATUS_DRAFT ){
+ // $object->situation_final need validation to be done so this test is need for draft
+ $displayWarranty = true;
+ foreach($object->lines as $i => $line){
+ if($line->product_type < 2 && $line->situation_percent < 100){
+ $displayWarranty = false;
+ break;
+ }
+ }
+ }
+
+ if($displayWarranty){
+ $pdf->SetTextColor(40, 40, 40);
+ $pdf->SetFillColor(255, 255, 255);
+
+ $retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100;
+ $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
+
+ // Billed - retained warranty
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1);
+
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1);
+
+ // retained warranty
+ $index++;
+ $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
+
+ $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty") . ' ('.$object->retained_warranty.'%)';
+ $retainedWarrantyToPayOn.= !empty($object->retained_warranty_date_limit)?' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
+
+ $pdf->MultiCell($col2x-$col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1);
+ $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
+ $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1);
+ }
+ }
}
}
@@ -1456,7 +1685,7 @@ class pdf_sponge extends ModelePDFFactures
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
- //print "x".$creditnoteamount."-".$depositsamount;exit;
+
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
if ($object->paye) $resteapayer=0;
@@ -1509,6 +1738,20 @@ class pdf_sponge extends ModelePDFFactures
return ($tab2_top + ($tab2_hl * $index));
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+ /**
+ * Return list of active generation modules
+ *
+ * @param DoliDB $db Database handler
+ * @param integer $maxfilenamelength Max length of value to show
+ * @return array List of templates
+ */
+ public static function liste_modeles($db, $maxfilenamelength = 0)
+ {
+ // phpcs:enable
+ return parent::liste_modeles($db, $maxfilenamelength); // TODO: Change the autogenerated stub
+ }
+
/**
* Show table for lines
*
diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
index fa32d3df0d2..936eabeadda 100644
--- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
+++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php
@@ -136,12 +136,12 @@ class pdf_soleil extends ModelePDFFicheinter
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1; // Affiche logo
- $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
- $this->option_modereg = 0; // Affiche mode reglement
- $this->option_condreg = 0; // Affiche conditions reglement
- $this->option_codeproduitservice = 0; // Affiche code produit-service
- $this->option_multilang = 1; // Dispo en plusieurs langues
+ $this->option_logo = 1; // Display logo
+ $this->option_tva = 0; // Manage the vat option FACTURE_TVAOPTION
+ $this->option_modereg = 0; // Display payment mode
+ $this->option_condreg = 0; // Display payment terms
+ $this->option_codeproduitservice = 0; // Display product-service code
+ $this->option_multilang = 1; // Available in several languages
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
// Get source company
diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php
index 1311264f7fb..0a60d9dc0ae 100644
--- a/htdocs/core/modules/import/import_csv.modules.php
+++ b/htdocs/core/modules/import/import_csv.modules.php
@@ -594,16 +594,25 @@ class ImportCsv extends ModeleImports
// Test regexp
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{
- // If test is "Must exist in a field@table"
- if (preg_match('/^(.*)@(.*)$/', $objimport->array_import_regex[0][$val], $reg))
+ // If test is "Must exist in a field@table or field@table:..."
+ if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{
$field=$reg[1];
$table=$reg[2];
+ $filter=!empty($reg[3])?substr($reg[3], 1):'';
+
+ $cachekey = $field.'@'.$table;
+ if(! empty($filter)) $cachekey.= ':'.$filter;
// Load content of field@table into cache array
- if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache
+ if (! is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
{
$sql="SELECT ".$field." as aliasfield FROM ".$table;
+ if(! empty($filter))
+ {
+ $sql.= ' WHERE ' . $filter;
+ }
+
$resql=$this->db->query($sql);
if ($resql)
{
@@ -612,7 +621,7 @@ class ImportCsv extends ModeleImports
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
- if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield;
+ if ($obj) $this->cachefieldtable[$cachekey][]=$obj->aliasfield;
$i++;
}
}
@@ -623,9 +632,11 @@ class ImportCsv extends ModeleImports
}
// Now we check cache is not empty (should not) and key is into cache
- if (! is_array($this->cachefieldtable[$field.'@'.$table]) || ! in_array($newval, $this->cachefieldtable[$field.'@'.$table]))
+ if (! is_array($this->cachefieldtable[$cachekey]) || ! in_array($newval, $this->cachefieldtable[$cachekey]))
{
- $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $table);
+ $tableforerror = $table;
+ if(! empty($filter)) $tableforerror.= ':'.$filter;
+ $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;
diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php
index 00db9096bca..af9c0e2c412 100644
--- a/htdocs/core/modules/import/import_xlsx.modules.php
+++ b/htdocs/core/modules/import/import_xlsx.modules.php
@@ -621,16 +621,25 @@ class ImportXlsx extends ModeleImports
// Test regexp
if (! empty($objimport->array_import_regex[0][$val]) && ($newval != ''))
{
- // If test is "Must exist in a field@table"
- if (preg_match('/^(.*)@(.*)$/', $objimport->array_import_regex[0][$val], $reg))
+ // If test is "Must exist in a field@table or field@table:..."
+ if (preg_match('/^(.+)@([^:]+)(:.+)?$/', $objimport->array_import_regex[0][$val], $reg))
{
$field=$reg[1];
$table=$reg[2];
+ $filter=!empty($reg[3])?substr($reg[3], 1):'';
+
+ $cachekey = $field.'@'.$table;
+ if(! empty($filter)) $cachekey.= ':'.$filter;
// Load content of field@table into cache array
- if (! is_array($this->cachefieldtable[$field.'@'.$table])) // If content of field@table not already loaded into cache
+ if (! is_array($this->cachefieldtable[$cachekey])) // If content of field@table not already loaded into cache
{
$sql="SELECT ".$field." as aliasfield FROM ".$table;
+ if(! empty($filter))
+ {
+ $sql.= ' WHERE ' . $filter;
+ }
+
$resql=$this->db->query($sql);
if ($resql)
{
@@ -639,7 +648,7 @@ class ImportXlsx extends ModeleImports
while ($i < $num)
{
$obj=$this->db->fetch_object($resql);
- if ($obj) $this->cachefieldtable[$field.'@'.$table][]=$obj->aliasfield;
+ if ($obj) $this->cachefieldtable[$cachekey][]=$obj->aliasfield;
$i++;
}
}
@@ -650,9 +659,11 @@ class ImportXlsx extends ModeleImports
}
// Now we check cache is not empty (should not) and key is into cache
- if (! is_array($this->cachefieldtable[$field.'@'.$table]) || ! in_array($newval, $this->cachefieldtable[$field.'@'.$table]))
+ if (! is_array($this->cachefieldtable[$cachekey]) || ! in_array($newval, $this->cachefieldtable[$cachekey]))
{
- $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $table);
+ $tableforerror = $table;
+ if(! empty($filter)) $tableforerror.= ':'.$filter;
+ $this->errors[$error]['lib']=$langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
$this->errors[$error]['type']='FOREIGNKEY';
$errorforthistable++;
$error++;
diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
index 0a339a9a61f..fcb5ef8433e 100644
--- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
+++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php
@@ -139,9 +139,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
- $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
- $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
- $this->option_codeproduitservice = 1; // Affiche code produit-service
+ $this->option_logo = 1; // Display logo FAC_PDF_LOGO
+ $this->option_tva = 1; // Manage the vat option FACTURE_TVAOPTION
+ $this->option_codeproduitservice = 1; // Display product-service code
$this->franchise=!$mysoc->tva_assuj;
diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php
index 092d5ac10b7..4b819a5bcae 100644
--- a/htdocs/core/modules/modCategorie.class.php
+++ b/htdocs/core/modules/modCategorie.class.php
@@ -425,8 +425,8 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product');
- $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"
- );
+ $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*");
+ $this->import_regex_array[$r]=array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0');
$this->import_convertvalue_array[$r]=array(
'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'),
@@ -444,7 +444,10 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe');
- $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"
+ $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*");
+ $this->import_regex_array[$r]=array(
+ 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2',
+ 'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0'
);
$this->import_convertvalue_array[$r]=array(
@@ -463,7 +466,10 @@ class modCategorie extends DolibarrModules
$this->import_icon[$r]=$this->picto;
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
$this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur');
- $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"
+ $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*");
+ $this->import_regex_array[$r]=array(
+ 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1',
+ 'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0'
);
$this->import_convertvalue_array[$r]=array(
diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
index 1d7e3d983fb..381d68c16d2 100644
--- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php
+++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php
@@ -438,7 +438,7 @@ class pdf_beluga extends ModelePDFProjects
$pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R');
}
$pdf->SetXY($this->posxstatut, $curY);
- $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Statut"), 1, 'R');
+ $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxstatut, 3, $outputlangs->transnoentities("Status"), 1, 'R');
if (is_array($elementarray) && count($elementarray) > 0)
{
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index bf46ecb9890..75c6f72e1df 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -255,6 +255,25 @@ if ($nolinesbefore) {
{
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth300', 0, '', GETPOST('combinations', 'array'));
}
+
+ if (! empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS))
+ {
+ ?>
+
+ select_produits_fournisseurs($object->socid, GETPOST('idprodfournprice'), 'idprodfournprice', '', '', $ajaxoptions, 1, $alsoproductwithnosupplierprice, 'maxwidth300');
- ?>
-
- global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_SUPPLIER_PRODUCTS))
+ {
+ ?>
+
+ ';
echo '';
diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
index 2c5c27bc939..5fd43a69a37 100644
--- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
+++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php
@@ -114,8 +114,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of order = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
- if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
- {
+ if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
+ {
foreach($object->linkedObjects['propal'] as $element)
{
$ret=$element->classifyBilled($user);
@@ -143,7 +143,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
- if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
+ if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['commande'] as $element)
{
@@ -166,7 +166,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Propal::STATUS_SIGNED || $element->statut == Propal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
- if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
+ if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['propal'] as $element)
{
@@ -195,8 +195,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == CommandeFournisseur::STATUS_ACCEPTED || $element->statut == CommandeFournisseur::STATUS_ORDERSENT || $element->statut == CommandeFournisseur::STATUS_RECEIVED_PARTIALLY || $element->statut == CommandeFournisseur::STATUS_RECEIVED_COMPLETELY) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
- if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
- {
+ if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
+ {
foreach($object->linkedObjects['order_supplier'] as $element)
{
$ret=$element->classifyBilled($user);
@@ -218,7 +218,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == SupplierProposal::STATUS_SIGNED || $element->statut == SupplierProposal::STATUS_BILLED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked supplier proposals = ".$totalonlinkedelements.", of supplier invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
- if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
+ if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['supplier_proposal'] as $element)
{
@@ -246,7 +246,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($element->statut == Commande::STATUS_VALIDATED || $element->statut == Commande::STATUS_SHIPMENTONPROCESS || $element->statut == Commande::STATUS_CLOSED) $totalonlinkedelements += $element->total_ht;
}
dol_syslog("Amount of linked orders = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht));
- if ( ($totalonlinkedelements == $object->total_ht) || (! empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) )
+ if ($this->shouldClassify($conf, $totalonlinkedelements, $object->total_ht))
{
foreach($object->linkedObjects['commande'] as $element)
{
@@ -345,4 +345,24 @@ class InterfaceWorkflowManager extends DolibarrTriggers
return 0;
}
+
+ /**
+ * @param Object $conf Dolibarr settings object
+ * @param float $totalonlinkedelements Sum of total amounts (excl VAT) of
+ * invoices linked to $object
+ * @param float $object_total_ht The total amount (excl VAT) of the object
+ * (an order, a proposal, a bill, etc.)
+ * @return bool True if the amounts are equal (rounded on total amount)
+ * True if the module is configured to skip the amount equality check
+ * False otherwise.
+ */
+ private function shouldClassify($conf, $totalonlinkedelements, $object_total_ht)
+ {
+ // if the configuration allows unmatching amounts, allow classification anyway
+ if (!empty($conf->global->WORKFLOW_CLASSIFY_IF_AMOUNTS_ARE_DIFFERENTS)) {
+ return true;
+ }
+ // if the amount are same, allow classification, else deny
+ return (price2num($totalonlinkedelements, 'MT') == price2num($object_total_ht, 'MT'));
+ }
}
diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
index bdd07c4e38d..07499ac8893 100644
--- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
@@ -649,12 +649,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Load translation files required by the page
$langs->loadLangs(array("agenda","other","members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
+ $member = $this->context['member'];
+ if (! is_object($member)) // This should not happen
+ {
+ include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
+ $member = new Adherent($this->db);
+ $member->fetch($this->fk_adherent);
+ }
+
+ if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg=$langs->transnoentities("MemberSubscriptionAddedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
+ $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
+ $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
+ $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
$object->sendtoid=0;
if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
@@ -664,12 +672,20 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Load translation files required by the page
$langs->loadLangs(array("agenda","other","members"));
- if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->ref, $object->getFullName($langs));
- $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$object->getFullName($langs);
- $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->type;
- $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->last_subscription_amount;
- $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->last_subscription_date_start, 'day').' - '.dol_print_date($object->last_subscription_date_end, 'day');
+ $member = $this->context['member'];
+ if (! is_object($member)) // This should not happen
+ {
+ include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
+ $member = new Adherent($this->db);
+ $member->fetch($this->fk_adherent);
+ }
+
+ if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg=$langs->transnoentities("MemberSubscriptionModifiedInDolibarr", $object->id, $member->getFullName($langs));
+ $object->actionmsg.="\n".$langs->transnoentities("Member").': '.$member->getFullName($langs);
+ $object->actionmsg.="\n".$langs->transnoentities("Type").': '.$object->fk_type;
+ $object->actionmsg.="\n".$langs->transnoentities("Amount").': '.$object->amount;
+ $object->actionmsg.="\n".$langs->transnoentities("Period").': '.dol_print_date($object->dateh, 'day').' - '.dol_print_date($object->datef, 'day');
$object->sendtoid=0;
if ($object->fk_soc > 0) $object->socid=$object->fk_soc;
diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php
index bdbed6b2027..cc05bf686c3 100644
--- a/htdocs/expedition/card.php
+++ b/htdocs/expedition/card.php
@@ -1584,9 +1584,9 @@ if ($action == 'create')
print $line->showOptionals($extrafieldsline, 'edit', array('style'=>$bc[$var], 'colspan'=>$colspan), $indiceAsked);
print ' |
';
}
-
- $indiceAsked++;
}
+
+ $indiceAsked++;
}
print "";
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 04044e0ad97..a764e2df47c 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -1958,7 +1958,7 @@ else
if ($resql)
{
$num = $db->num_rows($resql);
- $i = 0; $total = 0;
+ $i = 0; $totalpaid = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index e4d70ff255a..51485a7db5e 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -701,7 +701,7 @@ class PaiementFourn extends Paiement
else
{
$langs->load("errors");
- print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete");
+ print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Supplier"));
return "";
}
}
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index 48599a5bbf2..df29d329e0d 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -3,7 +3,7 @@
* Copyright (C) 2004-2016 Laurent Destailleur