';
$moreforfilter .= $langs->trans('DateOperationShort').' : ';
- $moreforfilter .= '
'.$langs->trans('From') . ' ';
+ $moreforfilter .= '
'.$langs->trans('From') . ' ';
$moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1).'
';
- $moreforfilter .= ' - ';
- $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
';
+ //$moreforfilter .= ' - ';
+ $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 1).'
';
$moreforfilter .= '
';
$moreforfilter .= $langs->trans('DateValueShort').' : ';
- $moreforfilter .= '
'.$langs->trans('From') . ' ';
+ $moreforfilter .= '
'.$langs->trans('From') . ' ';
$moreforfilter .= $form->select_date($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 1).'
';
- $moreforfilter .= ' - ';
- $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
';
+ //$moreforfilter .= ' - ';
+ $moreforfilter .= '
'.$langs->trans('to') . ' ' . $form->select_date($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 1).'
';
$moreforfilter .= '
';
$parameters=array();
@@ -757,7 +757,8 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
- print '
'."\n";
+ print '";
+
print '';
$db->free($resql);
}
diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index 7b44bb5b6b4..d2b3c167872 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -603,7 +603,7 @@ else
print '| '.$object->label.' | ';*/
// Type
- print '| '.$langs->trans("AccountType").' | ';
+ print '
| '.$langs->trans("AccountType").' | ';
print ''.$object->type_lib[$object->type].' |
';
// Currency
@@ -683,12 +683,12 @@ else
// Categories
if ($conf->categorie->enabled) {
- print '| '.$langs->trans("Categories").' | ';
+ print ' |
| '.$langs->trans("Categories").' | ';
print $form->showCategories($object->id,'account',1);
print " |
";
}
- print '| '.$langs->trans("Comment").' | ';
+ print '
| '.$langs->trans("Comment").' | ';
print ''.dol_htmlentitiesbr($object->comment).' |
';
print '
';
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index b0437ee9e1b..d4a69d13a5b 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1224,8 +1224,9 @@ class Account extends CommonObject
$label .= '
' . $langs->trans('AccountNumber') . ': ' . $this->number;
if (! empty($conf->accounting->enabled))
{
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$langs->load("accountancy");
- $label .= '
' . $langs->trans('AccountAccounting') . ': ' . $this->account_number;
+ $label .= '
' . $langs->trans('AccountAccounting') . ': ' . length_accountg($this->account_number);
$label .= '
' . $langs->trans('AccountancyJournal') . ': ' . $this->accountancy_journal;
}
$linkclose = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php
index ca1b2cfdaa1..51cb5c636fd 100644
--- a/htdocs/compta/bank/index.php
+++ b/htdocs/compta/bank/index.php
@@ -276,6 +276,7 @@ if (! empty($moreforfilter))
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+print '
';
print '
'."\n";
// Fields title
@@ -583,6 +584,9 @@ if (isset($totalarray['totalbalancefield']))
}
print '
';
+print "
";
+
+print "";
/*
diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php
index 3de977f29cf..7cc31e576f6 100644
--- a/htdocs/compta/bank/treso.php
+++ b/htdocs/compta/bank/treso.php
@@ -104,10 +104,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$solde = $object->solde(0);
- /*
- * Affiche tableau des echeances a venir
- */
- print '
';
+ // Show next coming entries
+ print '';
+ print '
';
// Ligne de titre tableau des ecritures
print '';
@@ -121,7 +120,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$var=true;
- // Solde actuel
+ // Current balance
$var=!$var;
print '
';
print '| '.$langs->trans("CurrentBalance").' | ';
@@ -327,7 +326,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
print '
';
print "
";
-
+ print "
";
}
else
{
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 2bf69038e78..07cb56b830b 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -3726,6 +3726,7 @@ else if ($id > 0 || ! empty($ref))
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
}
+ print '';
print '
';
// Show global modifiers
@@ -3797,7 +3798,8 @@ else if ($id > 0 || ! empty($ref))
}
print "
\n";
-
+ print "
";
+
print "\n";
dol_fiche_end();
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index b938bdd0883..e02ec4541ef 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -409,7 +409,7 @@ class Facture extends CommonInvoice
{
foreach($this->linked_objects as $origin => $tmp_origin_id)
{
- if (is_array($tmp_origin_id)) // New baheviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
+ if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
{
foreach($tmp_origin_id as $origin_id)
{
@@ -424,51 +424,51 @@ class Facture extends CommonInvoice
else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
{
$origin_id = $tmp_origin_id;
- $ret = $this->add_object_linked($this->origin, $origin_id);
+ $ret = $this->add_object_linked($origin, $origin_id);
if (! $ret)
{
dol_print_error($this->db);
$error++;
}
}
-
- if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
- {
- $originforcontact = $this->origin;
- $originidforcontact = $origin_id;
- if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
- {
- require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
- $exp = new Expedition($this->db);
- $exp->fetch($origin_id);
- $exp->fetchObjectLinked();
- if (count($exp->linkedObjectsIds['commande']) > 0)
- {
- foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
- {
- $originforcontact = 'commande';
- $originidforcontact = $value->id;
- break; // We take first one
- }
- }
- }
-
- $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
- $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
-
- $resqlcontact = $this->db->query($sqlcontact);
- if ($resqlcontact)
- {
- while($objcontact = $this->db->fetch_object($resqlcontact))
- {
- //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
- $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
- }
- }
- else dol_print_error($resqlcontact);
- }
}
}
+
+ if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
+ {
+ $originforcontact = $this->origin;
+ $originidforcontact = $this->origin_id;
+ if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
+ {
+ require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
+ $exp = new Expedition($this->db);
+ $exp->fetch($this->origin_id);
+ $exp->fetchObjectLinked();
+ if (count($exp->linkedObjectsIds['commande']) > 0)
+ {
+ foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
+ {
+ $originforcontact = 'commande';
+ $originidforcontact = $value->id;
+ break; // We take first one
+ }
+ }
+ }
+
+ $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
+ $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
+
+ $resqlcontact = $this->db->query($sqlcontact);
+ if ($resqlcontact)
+ {
+ while($objcontact = $this->db->fetch_object($resqlcontact))
+ {
+ //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
+ $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
+ }
+ }
+ else dol_print_error($resqlcontact);
+ }
/*
* Insert lines of invoices into database
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index c1381be0ea5..51295cd0cf1 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -712,11 +712,11 @@ if (empty($reshook))
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
// Unset extrafield
if (is_array($extralabelsline))
- {
+ {
// Get extra fields
foreach ($extralabelsline as $key => $value)
- {
- unset($_POST["options_" . $key]);
+ {
+ unset($_POST["options_" . $key]);
}
}
@@ -1610,7 +1610,10 @@ else
print $langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'
';
$i = 0;
- print '';
+
+ print '';
+ print '
'."\n";
+
print '';
print_liste_field_titre($langs->trans("Ref"),$_SERVER['PHP_SELF'],"f.titre","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER['PHP_SELF'],"s.nom","",$param,"",$sortfield,$sortorder);
@@ -1780,6 +1783,9 @@ else
else print '
| '.$langs->trans("NoneF").' |
';
print "
";
+ print "
";
+ print "";
+
$db->free($resql);
}
else
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index c38c8060bd7..ea012cb3672 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -636,7 +636,8 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
- print ''."\n";
+ print '';
+ print '
'."\n";
print '';
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
@@ -1135,6 +1136,7 @@ if ($resql)
print $hookmanager->resPrint;
print "
\n";
+ print "
";
print "\n";
diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php
index df02264badc..df507490aec 100644
--- a/htdocs/compta/paiement/cheque/list.php
+++ b/htdocs/compta/paiement/cheque/list.php
@@ -1,6 +1,6 @@
- * Copyright (C) 2007-2009 Laurent Destailleur
+ * Copyright (C) 2007-2016 Laurent Destailleur
* Copyright (C) 2009-2012 Regis Houssin
* Copyright (C) 2014 Alexandre Spangaro
* Copyright (C) 2016 Juanjo Menent
@@ -62,8 +62,13 @@ $formother = new FormOther($db);
$checkdepositstatic=new RemiseCheque($db);
$accountstatic=new Account($db);
+
+/*
+ * Actions
+ */
+
// If click on purge search criteria ?
-if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
+if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{
$search_ref='';
$search_amount='';
@@ -72,6 +77,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$month='';
}
+
+
/*
* View
*/
@@ -134,8 +141,12 @@ if ($resql)
print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit);
- print '';
- print '';
+ $moreforfilter='';
+
+ print '';
+ print '
'."\n";
+
+ print '';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.ref","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder);
@@ -219,6 +230,7 @@ if ($resql)
print '
';
}
print "
";
+ print "
";
print "\n";
}
else
diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php
index 17882e76a6a..9495b56e90b 100644
--- a/htdocs/compta/paiement/list.php
+++ b/htdocs/compta/paiement/list.php
@@ -129,7 +129,7 @@ else
$sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives
$sql.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code,";
- $sql.= " ba.rowid as bid, ba.label,";
+ $sql.= " ba.rowid as bid, ba.ref as bref, ba.label as blabel, ba.number, ba.account_number as account_number, ba.accountancy_journal as accountancy_journal,";
$sql.= " s.rowid as socid, s.nom as name";
// Add fields for extrafields
foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key;
@@ -222,7 +222,9 @@ if ($resql)
print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit);
- print '';
+ print '';
+ print '
'."\n";
+
print '';
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder);
@@ -320,10 +322,14 @@ if ($resql)
if (! empty($conf->banque->enabled))
{
print '| ';
- if ($objp->bid)
+ if ($objp->bid > 0)
{
$accountstatic->id=$objp->bid;
- $accountstatic->label=$objp->label;
+ $accountstatic->ref=$objp->bref;
+ $accountstatic->label=$objp->blabel;
+ $accountstatic->number=$objp->number;
+ $accountstatic->account_number=$objp->account_number;
+ $accountstatic->accountancy_journal=$objp->accountancy_journal;
print $accountstatic->getNomUrl(1);
}
else print ' ';
@@ -347,6 +353,7 @@ if ($resql)
$i++;
}
print " |
\n";
+ print "
";
print "\n";
}
else
diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php
index 6355fc03fab..37d55522749 100644
--- a/htdocs/compta/salaries/index.php
+++ b/htdocs/compta/salaries/index.php
@@ -151,8 +151,10 @@ if ($result)
print_barre_liste($langs->trans("SalariesPayments"),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit);
- print '';
- print '';
+ print '';
+ print '
'."\n";
+
+ print '';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Employee"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
@@ -257,7 +259,7 @@ if ($result)
print " |
";
print "
";
-
+ print '
';
print '';
$db->free($result);
@@ -268,7 +270,5 @@ else
}
-
llxFooter();
-
$db->close();
diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php
index 6a4f7f836e7..66d6a65dd56 100644
--- a/htdocs/compta/sociales/index.php
+++ b/htdocs/compta/sociales/index.php
@@ -174,8 +174,9 @@ if ($resql)
}
else
{
-
- print '';
+ print '';
+ print '
'."\n";
+
print '';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"id","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"cs.libelle","",$param,'align="left"',$sortfield,$sortorder);
@@ -286,6 +287,7 @@ if ($resql)
}
print '
';
+ print '
';
}
print '';
}
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index 7b2e5528eb6..04b73ccbb6d 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -483,7 +483,8 @@ if ($moreforfilter)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
-print '';
+print '';
+print '
'."\n";
// Ligne des titres
print '';
@@ -795,6 +796,7 @@ while ($i < min($num,$limit))
}
print "
";
+print "
";
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_companies.png', 0, '', '', $limit, 1);
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 588d6282140..c6e9a12e338 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -1928,7 +1928,9 @@ else
';
print '
';
- print ''; // Array with (n*2)+1 lines
+
+ print '';
+ print '
'; // Array with (n*2)+1 lines
// Trick to not show product entries
$savproductenabled=$conf->product->enabled;
@@ -1950,7 +1952,7 @@ else
$conf->product->enabled = $savproductenabled;
print '
';
-
+ print '
';
print '';
}
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 75100aae9e6..a8f84731650 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -934,56 +934,72 @@ class Contrat extends CommonObject
if (! $error)
{
// Add object linked
- if (is_array($this->linked_objects) && ! empty($this->linked_objects))
+ if (! $error && $this->id && is_array($this->linked_objects) && ! empty($this->linked_objects))
{
- foreach($this->linked_objects as $origin => $origin_id)
+ foreach($this->linked_objects as $origin => $tmp_origin_id)
{
- $ret = $this->add_object_linked($origin, $origin_id);
- if (! $ret)
+ if (is_array($tmp_origin_id)) // New behaviour, if linked_object can have several links per type, so is something like array('contract'=>array(id1, id2, ...))
{
- dol_print_error($this->db);
- $error++;
+ foreach($tmp_origin_id as $origin_id)
+ {
+ $ret = $this->add_object_linked($origin, $origin_id);
+ if (! $ret)
+ {
+ dol_print_error($this->db);
+ $error++;
+ }
+ }
+ }
+ else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
+ {
+ $origin_id = $tmp_origin_id;
+ $ret = $this->add_object_linked($origin, $origin_id);
+ if (! $ret)
+ {
+ dol_print_error($this->db);
+ $error++;
+ }
}
-
- if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
- {
- $originforcontact = $origin;
- $originidforcontact = $origin_id;
- if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
- {
- require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
- $exp = new Expedition($db);
- $exp->fetch($origin_id);
- $exp->fetchObjectLinked();
- if (count($exp->linkedObjectsIds['commande']) > 0)
- {
- foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
- {
- $originforcontact = 'commande';
- $originidforcontact = $value->id;
- break; // We take first one
- }
- }
- }
-
- $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
- $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
-
- $resqlcontact = $this->db->query($sqlcontact);
- if ($resqlcontact)
- {
- while($objcontact = $this->db->fetch_object($resqlcontact))
- {
- if ($objcontact->source == 'internal' && in_array($objcontact->code, array('SALESREPSIGN', 'SALESREPFOLL'))) continue; // ignore this, already forced previously
-
- //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
- $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
- }
- }
- else dol_print_error($resqlcontact);
- }
}
}
+
+ if (! $error && $this->id && ! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN) && ! empty($this->origin) && ! empty($this->origin_id)) // Get contact from origin object
+ {
+ $originforcontact = $this->origin;
+ $originidforcontact = $this->origin_id;
+ if ($originforcontact == 'shipping') // shipment and order share the same contacts. If creating from shipment we take data of order
+ {
+ require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
+ $exp = new Expedition($db);
+ $exp->fetch($this->origin_id);
+ $exp->fetchObjectLinked();
+ if (count($exp->linkedObjectsIds['commande']) > 0)
+ {
+ foreach ($exp->linkedObjectsIds['commande'] as $key => $value)
+ {
+ $originforcontact = 'commande';
+ $originidforcontact = $value->id;
+ break; // We take first one
+ }
+ }
+ }
+
+ $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
+ $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
+
+ $resqlcontact = $this->db->query($sqlcontact);
+ if ($resqlcontact)
+ {
+ while($objcontact = $this->db->fetch_object($resqlcontact))
+ {
+ if ($objcontact->source == 'internal' && in_array($objcontact->code, array('SALESREPSIGN', 'SALESREPFOLL'))) continue; // ignore this, already forced previously
+
+ //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n";
+ $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object
+ }
+ }
+ else dol_print_error($resqlcontact);
+ }
}
if (! $error)
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index c003b638748..e0f465b5389 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -393,7 +393,8 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
- print ''."\n";
+ print '';
+ print '
'."\n";
print '';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
@@ -723,6 +724,8 @@ if ($resql)
$db->free($resql);
print '
';
+ print '
';
+
print '';
}
else
diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php
index 836e2fd82f6..e4a18e1599a 100644
--- a/htdocs/contrat/services.php
+++ b/htdocs/contrat/services.php
@@ -271,6 +271,7 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+ print '';
print '
'."\n";
print '';
@@ -449,7 +450,10 @@ if ($resql)
}
$db->free($resql);
- print '
';
+ print '
';
+ print '';
+
+ print '';
}
else
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 28b9517fe0b..dadc470e273 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -549,6 +549,7 @@ class FormFile
$buttonlabeltoshow=$buttonlabel;
if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate');
+ if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; # So we switch to form after a generation
if (empty($noform)) $out.= '